-
Notifications
You must be signed in to change notification settings - Fork 6
/
entitlement_grant.go
256 lines (192 loc) · 7.31 KB
/
entitlement_grant.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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
// Copyright (c) 2021 AccelByte Inc. All Rights Reserved.
// This is licensed software from AccelByte Inc, for limitations
// and restrictions contact your company contract manager.
// Code generated; DO NOT EDIT.
package platformclientmodels
import (
"encoding/json"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// EntitlementGrant Entitlement grant
//
// swagger:model Entitlement grant.
type EntitlementGrant struct {
// entitlement collection id, length 1-128
CollectionID string `json:"collectionId,omitempty"`
// entitlement end date time
// Format: date-time
EndDate *strfmt.DateTime `json:"endDate,omitempty"`
// grantedCode, the granted code
GrantedCode string `json:"grantedCode,omitempty"`
// itemId
// Required: true
ItemID *string `json:"itemId"`
// itemNamespace
// Required: true
ItemNamespace *string `json:"itemNamespace"`
// language value from language tag, allowed format: en, en-US.<p>Supported language tag : [RFC5646](https://gist.github.com/msikma/8912e62ed866778ff8cd) and [IETF](https://datahub.io/core/language-codes#resource-ietf-language-tags)</p>
Language string `json:"language,omitempty"`
// metadata, It is not stored in the database, only forwarded to AGS event
Metadata interface{} `json:"metadata,omitempty"`
// entitlement Origin, The platform of the entitlement.
// Enum: ['Epic', 'GooglePlay', 'IOS', 'Nintendo', 'Oculus', 'Other', 'Playstation', 'Steam', 'System', 'Twitch', 'Xbox']
Origin string `json:"origin,omitempty"`
// quantity
// Required: true
// Format: int32
Quantity *int32 `json:"quantity"`
// country value from ISO countries
Region string `json:"region,omitempty"`
// source
// Enum: ['ACHIEVEMENT', 'GIFT', 'IAP', 'OTHER', 'PROMOTION', 'PURCHASE', 'REDEEM_CODE', 'REFERRAL_BONUS', 'REWARD']
Source string `json:"source,omitempty"`
// entitlement start date time
// Format: date-time
StartDate *strfmt.DateTime `json:"startDate,omitempty"`
// storeId
StoreID string `json:"storeId,omitempty"`
}
// Validate validates this Entitlement grant
func (m *EntitlementGrant) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateItemID(formats); err != nil {
res = append(res, err)
}
if err := m.validateItemNamespace(formats); err != nil {
res = append(res, err)
}
if err := m.validateLanguage(formats); err != nil {
res = append(res, err)
}
if err := m.validateQuantity(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *EntitlementGrant) validateItemID(formats strfmt.Registry) error {
if err := validate.Required("itemId", "body", m.ItemID); err != nil {
return err
}
return nil
}
func (m *EntitlementGrant) validateItemNamespace(formats strfmt.Registry) error {
if err := validate.Required("itemNamespace", "body", m.ItemNamespace); err != nil {
return err
}
return nil
}
func (m *EntitlementGrant) validateLanguage(formats strfmt.Registry) error {
if swag.IsZero(m.Language) { // not required
return nil
}
if err := validate.Pattern("language", "body", string(m.Language), `^[A-Za-z]{2,4}([_-][A-Za-z]{4})?([_-]([A-Za-z]{2}|[0-9]{3}))?$`); err != nil {
return err
}
return nil
}
var entitlementGrantTypeOriginPropEnum []interface{}
func init() {
var res []string
if err := json.Unmarshal([]byte(`["EPIC", "GOOGLEPLAY", "IOS", "NINTENDO", "OCULUS", "OTHER", "PLAYSTATION", "STEAM", "SYSTEM", "TWITCH", "XBOX"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
entitlementGrantTypeOriginPropEnum = append(entitlementGrantTypeOriginPropEnum, v)
}
}
const (
// EntitlementGrantOriginEPIC captures enum value "EPIC"
EntitlementGrantOriginEPIC string = "EPIC"
// EntitlementGrantOriginGOOGLEPLAY captures enum value "GOOGLEPLAY"
EntitlementGrantOriginGOOGLEPLAY string = "GOOGLEPLAY"
// EntitlementGrantOriginIOS captures enum value "IOS"
EntitlementGrantOriginIOS string = "IOS"
// EntitlementGrantOriginNINTENDO captures enum value "NINTENDO"
EntitlementGrantOriginNINTENDO string = "NINTENDO"
// EntitlementGrantOriginOCULUS captures enum value "OCULUS"
EntitlementGrantOriginOCULUS string = "OCULUS"
// EntitlementGrantOriginOTHER captures enum value "OTHER"
EntitlementGrantOriginOTHER string = "OTHER"
// EntitlementGrantOriginPLAYSTATION captures enum value "PLAYSTATION"
EntitlementGrantOriginPLAYSTATION string = "PLAYSTATION"
// EntitlementGrantOriginSTEAM captures enum value "STEAM"
EntitlementGrantOriginSTEAM string = "STEAM"
// EntitlementGrantOriginSYSTEM captures enum value "SYSTEM"
EntitlementGrantOriginSYSTEM string = "SYSTEM"
// EntitlementGrantOriginTWITCH captures enum value "TWITCH"
EntitlementGrantOriginTWITCH string = "TWITCH"
// EntitlementGrantOriginXBOX captures enum value "XBOX"
EntitlementGrantOriginXBOX string = "XBOX"
)
// prop value enum
func (m *EntitlementGrant) validateOriginEnum(path, location string, value string) error {
if err := validate.EnumCase(path, location, value, entitlementGrantTypeOriginPropEnum, true); err != nil {
return err
}
return nil
}
func (m *EntitlementGrant) validateQuantity(formats strfmt.Registry) error {
if err := validate.Required("quantity", "body", m.Quantity); err != nil {
return err
}
return nil
}
var entitlementGrantTypeSourcePropEnum []interface{}
func init() {
var res []string
if err := json.Unmarshal([]byte(`["ACHIEVEMENT", "GIFT", "IAP", "OTHER", "PROMOTION", "PURCHASE", "REDEEM_CODE", "REFERRAL_BONUS", "REWARD"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
entitlementGrantTypeSourcePropEnum = append(entitlementGrantTypeSourcePropEnum, v)
}
}
const (
// EntitlementGrantSourceACHIEVEMENT captures enum value "ACHIEVEMENT"
EntitlementGrantSourceACHIEVEMENT string = "ACHIEVEMENT"
// EntitlementGrantSourceGIFT captures enum value "GIFT"
EntitlementGrantSourceGIFT string = "GIFT"
// EntitlementGrantSourceIAP captures enum value "IAP"
EntitlementGrantSourceIAP string = "IAP"
// EntitlementGrantSourceOTHER captures enum value "OTHER"
EntitlementGrantSourceOTHER string = "OTHER"
// EntitlementGrantSourcePROMOTION captures enum value "PROMOTION"
EntitlementGrantSourcePROMOTION string = "PROMOTION"
// EntitlementGrantSourcePURCHASE captures enum value "PURCHASE"
EntitlementGrantSourcePURCHASE string = "PURCHASE"
// EntitlementGrantSourceREDEEMCODE captures enum value "REDEEM_CODE"
EntitlementGrantSourceREDEEMCODE string = "REDEEM_CODE"
// EntitlementGrantSourceREFERRALBONUS captures enum value "REFERRAL_BONUS"
EntitlementGrantSourceREFERRALBONUS string = "REFERRAL_BONUS"
// EntitlementGrantSourceREWARD captures enum value "REWARD"
EntitlementGrantSourceREWARD string = "REWARD"
)
// prop value enum
func (m *EntitlementGrant) validateSourceEnum(path, location string, value string) error {
if err := validate.EnumCase(path, location, value, entitlementGrantTypeSourcePropEnum, true); err != nil {
return err
}
return nil
}
// MarshalBinary interface implementation
func (m *EntitlementGrant) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *EntitlementGrant) UnmarshalBinary(b []byte) error {
var res EntitlementGrant
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}