-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
builds_app_encryption_declarations.go
171 lines (147 loc) · 8.72 KB
/
builds_app_encryption_declarations.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/**
Copyright (C) 2020 Aaron Sky.
This file is part of asc-go, a package for working with Apple's
App Store Connect API.
asc-go is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
asc-go is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with asc-go. If not, see <http://www.gnu.org/licenses/>.
*/
package asc
import (
"context"
"fmt"
)
// AppEncryptionDeclarationState defines model for AppEncryptionDeclarationState.
//
// https://developer.apple.com/documentation/appstoreconnectapi/appencryptiondeclarationstate
type AppEncryptionDeclarationState string
const (
// AppEncryptionDeclarationStateApproved is an app encryption declaration state type for Approved.
AppEncryptionDeclarationStateApproved AppEncryptionDeclarationState = "APPROVED"
// AppEncryptionDeclarationStateExpired is an app encryption declaration state type for Expired.
AppEncryptionDeclarationStateExpired AppEncryptionDeclarationState = "EXPIRED"
// AppEncryptionDeclarationStateInvalid is an app encryption declaration state type for Invalid.
AppEncryptionDeclarationStateInvalid AppEncryptionDeclarationState = "INVALID"
// AppEncryptionDeclarationStateInReview is an app encryption declaration state type for InReview.
AppEncryptionDeclarationStateInReview AppEncryptionDeclarationState = "IN_REVIEW"
// AppEncryptionDeclarationStateRejected is an app encryption declaration state type for Rejected.
AppEncryptionDeclarationStateRejected AppEncryptionDeclarationState = "REJECTED"
)
// AppEncryptionDeclaration defines model for AppEncryptionDeclaration.
//
// https://developer.apple.com/documentation/appstoreconnectapi/appencryptiondeclaration
type AppEncryptionDeclaration struct {
Attributes *AppEncryptionDeclarationAttributes `json:"attributes,omitempty"`
ID string `json:"id"`
Links ResourceLinks `json:"links"`
Relationships *AppEncryptionDeclarationRelationships `json:"relationships,omitempty"`
Type string `json:"type"`
}
// AppEncryptionDeclarationAttributes defines model for AppEncryptionDeclaration.Attributes
//
// https://developer.apple.com/documentation/appstoreconnectapi/appencryptiondeclaration/attributes
type AppEncryptionDeclarationAttributes struct {
AppEncryptionDeclarationState *AppEncryptionDeclarationState `json:"appEncryptionDeclarationState,omitempty"`
AvailableOnFrenchStore *bool `json:"availableOnFrenchStore,omitempty"`
CodeValue *string `json:"codeValue,omitempty"`
ContainsProprietaryCryptography *bool `json:"containsProprietaryCryptography,omitempty"`
ContainsThirdPartyCryptography *bool `json:"containsThirdPartyCryptography,omitempty"`
DocumentName *string `json:"documentName,omitempty"`
DocumentType *string `json:"documentType,omitempty"`
DocumentURL *string `json:"documentUrl,omitempty"`
Exempt *bool `json:"exempt,omitempty"`
Platform *Platform `json:"platform,omitempty"`
UploadedDate *DateTime `json:"uploadedDate,omitempty"`
UsesEncryption *bool `json:"usesEncryption,omitempty"`
}
// AppEncryptionDeclarationRelationships defines model for AppEncryptionDeclaration.Relationships
//
// https://developer.apple.com/documentation/appstoreconnectapi/appencryptiondeclaration/relationships
type AppEncryptionDeclarationRelationships struct {
App *Relationship `json:"app,omitempty"`
}
// AppEncryptionDeclarationResponse defines model for AppEncryptionDeclarationResponse.
//
// https://developer.apple.com/documentation/appstoreconnectapi/appencryptiondeclarationresponse
type AppEncryptionDeclarationResponse struct {
Data AppEncryptionDeclaration `json:"data"`
Included []App `json:"included,omitempty"`
Links DocumentLinks `json:"links"`
}
// AppEncryptionDeclarationsResponse defines model for AppEncryptionDeclarationsResponse.
//
// https://developer.apple.com/documentation/appstoreconnectapi/appencryptiondeclarationsresponse
type AppEncryptionDeclarationsResponse struct {
Data []AppEncryptionDeclaration `json:"data"`
Included []App `json:"included,omitempty"`
Links PagedDocumentLinks `json:"links"`
Meta *PagingInformation `json:"meta,omitempty"`
}
// ListAppEncryptionDeclarationsQuery are query options for ListAppEncryptionDeclarations
//
// https://developer.apple.com/documentation/appstoreconnectapi/list_app_encryption_declarations
type ListAppEncryptionDeclarationsQuery struct {
FieldsAppEncryptionDeclarations []string `url:"fields[appEncryptionDeclarations],omitempty"`
FieldsApps []string `url:"fields[apps],omitempty"`
FilterApp []string `url:"filter[app],omitempty"`
FilterBuilds []string `url:"filter[builds],omitempty"`
FilterPlatforms []string `url:"filter[platforms],omitempty"`
Include []string `url:"include,omitempty"`
Limit int `url:"limit,omitempty"`
Cursor *string `url:"cursor,omitempty"`
}
// GetAppEncryptionDeclarationQuery are query options for GetAppEncryptionDeclaration
//
// https://developer.apple.com/documentation/appstoreconnectapi/read_app_encryption_declaration_information
type GetAppEncryptionDeclarationQuery struct {
FieldsAppEncryptionDeclarations []string `url:"fields[appEncryptionDeclarations],omitempty"`
FieldsApps []string `url:"fields[apps],omitempty"`
Include []string `url:"include,omitempty"`
}
// GetAppForEncryptionDeclarationQuery are query options for GetAppForEncryptionDeclaration
//
// https://developer.apple.com/documentation/appstoreconnectapi/read_the_app_information_of_an_app_encryption_declaration
type GetAppForEncryptionDeclarationQuery struct {
FieldsApps []string `url:"fields[apps],omitempty"`
}
// ListAppEncryptionDeclarations finds and lists all available app encryption declarations.
//
// https://developer.apple.com/documentation/appstoreconnectapi/list_app_encryption_declarations
func (s *BuildsService) ListAppEncryptionDeclarations(ctx context.Context, params *ListAppEncryptionDeclarationsQuery) (*AppEncryptionDeclarationsResponse, *Response, error) {
res := new(AppEncryptionDeclarationsResponse)
resp, err := s.client.get(ctx, "appEncryptionDeclarations", params, res)
return res, resp, err
}
// GetAppEncryptionDeclaration gets information about a specific app encryption declaration.
//
// https://developer.apple.com/documentation/appstoreconnectapi/read_app_encryption_declaration_information
func (s *BuildsService) GetAppEncryptionDeclaration(ctx context.Context, id string, params *GetAppEncryptionDeclarationQuery) (*AppEncryptionDeclarationResponse, *Response, error) {
url := fmt.Sprintf("appEncryptionDeclarations/%s", id)
res := new(AppEncryptionDeclarationResponse)
resp, err := s.client.get(ctx, url, params, res)
return res, resp, err
}
// GetAppForAppEncryptionDeclaration gets the app information from a specific app encryption declaration.
//
// https://developer.apple.com/documentation/appstoreconnectapi/read_the_app_information_of_an_app_encryption_declaration
func (s *BuildsService) GetAppForAppEncryptionDeclaration(ctx context.Context, id string, params *GetAppForEncryptionDeclarationQuery) (*AppResponse, *Response, error) {
url := fmt.Sprintf("appEncryptionDeclarations/%s/app", id)
res := new(AppResponse)
resp, err := s.client.get(ctx, url, params, res)
return res, resp, err
}
// AssignBuildsToAppEncryptionDeclaration assigns one or more builds to an app encryption declaration.
//
// https://developer.apple.com/documentation/appstoreconnectapi/assign_builds_to_an_app_encryption_declaration
func (s *BuildsService) AssignBuildsToAppEncryptionDeclaration(ctx context.Context, id string, buildIDs []string) (*Response, error) {
linkages := newPagedRelationshipDeclaration(buildIDs, "builds")
url := fmt.Sprintf("appStoreVersionSubmissions/%s", id)
return s.client.post(ctx, url, newRequestBody(linkages.Data), nil)
}