-
Notifications
You must be signed in to change notification settings - Fork 0
/
achievements_update.go
40 lines (33 loc) · 1.19 KB
/
achievements_update.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package appstore
import (
"context"
"fmt"
)
// https://developer.apple.com/documentation/appstoreconnectapi/modify_an_achievement
func (c *Client) UpdateAchievement(ctx context.Context, upd AchievementUpdate) (*Resource[Achievement], error) {
url := "https://api.appstoreconnect.apple.com/v1/gameCenterAchievements/" + upd.ID
req := updateResource{
ID: upd.ID,
Type: resourceTypeAchievements,
Attr: upd,
}
resp, err := doUpdate[Achievement](c, ctx, url, req)
if err != nil {
return nil, fmt.Errorf("failed to update achievement: %w", err)
}
return resp, nil
}
// https://developer.apple.com/documentation/appstoreconnectapi/edit_an_achievement_localization
func (c *Client) UpdateAchievementLocalization(ctx context.Context, upd AchievementLocalizationUpdate) (*Resource[AchievementLocalization], error) {
url := "https://api.appstoreconnect.apple.com/v1/gameCenterAchievementLocalizations/" + upd.ID
req := updateResource{
ID: upd.ID,
Type: resourceTypeAchievementLocalizations,
Attr: upd,
}
resp, err := doUpdate[AchievementLocalization](c, ctx, url, req)
if err != nil {
return nil, fmt.Errorf("failed to update achievement localization: %w", err)
}
return resp, nil
}