forked from getconversio/go-shopify
-
Notifications
You must be signed in to change notification settings - Fork 247
/
access_scopes.go
30 lines (24 loc) · 877 Bytes
/
access_scopes.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 goshopify
import "context"
type AccessScopesService interface {
List(context.Context, interface{}) ([]AccessScope, error)
}
type AccessScope struct {
Handle string `json:"handle,omitempty"`
}
// AccessScopesResource represents the result from the oauth/access_scopes.json endpoint
type AccessScopesResource struct {
AccessScopes []AccessScope `json:"access_scopes,omitempty"`
}
// AccessScopesServiceOp handles communication with the Access Scopes
// related methods of the Shopify API
type AccessScopesServiceOp struct {
client *Client
}
// List gets access scopes based on used oauth token
func (s *AccessScopesServiceOp) List(ctx context.Context, options interface{}) ([]AccessScope, error) {
path := "oauth/access_scopes.json"
resource := new(AccessScopesResource)
err := s.client.Get(ctx, path, resource, options)
return resource.AccessScopes, err
}