-
Notifications
You must be signed in to change notification settings - Fork 0
/
achievements_list.go
30 lines (23 loc) · 940 Bytes
/
achievements_list.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
package appstore
import (
"context"
"fmt"
)
// https://developer.apple.com/documentation/appstoreconnectapi/list_all_achievements
func (c *Client) ListAchievements(ctx context.Context, gameCenter *Resource[GameCenter]) ([]Resource[Achievement], error) {
url := gameCenter.Links.Self + "/gameCenterAchievements"
resp, err := doList[Achievement](c, ctx, url)
if err != nil {
return nil, fmt.Errorf("failed to list achievements: %w", err)
}
return resp, nil
}
// https://developer.apple.com/documentation/appstoreconnectapi/list_all_localizations_for_an_achievement
func (c *Client) ListAchievementLocalizations(ctx context.Context, ach *Resource[Achievement]) ([]Resource[AchievementLocalization], error) {
url := ach.Links.Self + "/localizations"
resp, err := doList[AchievementLocalization](c, ctx, url)
if err != nil {
return nil, fmt.Errorf("failed to list achievement localizations: %w", err)
}
return resp, nil
}