Repository navigation
Expand file tree
/
Copy pathmodel_change.go
More file actions
488 lines (407 loc) · 12.9 KB
/
Copy pathmodel_change.go
File metadata and controls
488 lines (407 loc) · 12.9 KB
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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
/*
Streaming Availability API
Streaming Availability API allows getting streaming availability information of movies and series; and querying the list of available shows on streaming services such as Netflix, Disney+, Apple TV, Max and Hulu across 66 countries!
API version: 4.1.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package streaming
import (
"encoding/json"
"bytes"
"fmt"
)
// checks if the Change type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &Change{}
// Change A change object represents a future or past change in a streaming catalog. It contains the details such as the type of the change (could be past change such as like new, updated, removed; or a future change such as expiring, upcoming), the affected item type (show, season or episode), timestamp of the change and more. Via change endpoints, you can get the most recent updates in the streaming catalogs. On top of the changes, you can also get the details of the affected shows. Every change object has a showId field. You can find the list of shows affected by the changes in the shows field of the response, and match the show ids with the showId field of the change objects.
type Change struct {
// Type of the change.
ChangeType ChangeType `json:"changeType"`
// Type of the item affected from the change.
ItemType ItemType `json:"itemType"`
// Id of the show affected from the change.
ShowId string `json:"showId"`
// Type of the show affected from the change.
ShowType ShowType `json:"showType"`
// Number of the season affected from the change. Omitted if item_type is not seasonor episode.
Season *int32 `json:"season,omitempty"`
// Number of the episode affected from the change. Omitted if item_type is not episode.
Episode *int32 `json:"episode,omitempty"`
// Service affected from the change.
Service ServiceInfo `json:"service"`
StreamingOptionType StreamingOptionType `json:"streamingOptionType"`
// Addon info, if the streamingOptionType is addon. Otherwise omitted.
Addon *Addon `json:"addon,omitempty"`
// [Unix Time Stamp](https://www.unixtimestamp.com/) of the change. Past changes (new, updated, removed) will always have a timestamp. Future changes (expiring, upcoming) will have a timestamp if the exact date is known. If not, timestamp will be omitted, e.g. a show is known to be expiring soon, but the exact date is not known.
Timestamp *int64 `json:"timestamp,omitempty"`
// Deep link to the affected streaming option's page in the web app of the streaming service. This field is guaranteed to be populated when changeType is new, updated, expiring or removed. When changeType is upcoming, this field might be populated or null depending on if the link of the future streaming option is known.
Link *string `json:"link,omitempty"`
}
type _Change Change
// NewChange instantiates a new Change object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewChange(changeType ChangeType, itemType ItemType, showId string, showType ShowType, service ServiceInfo, streamingOptionType StreamingOptionType) *Change {
this := Change{}
this.ChangeType = changeType
this.ItemType = itemType
this.ShowId = showId
this.ShowType = showType
this.Service = service
this.StreamingOptionType = streamingOptionType
return &this
}
// NewChangeWithDefaults instantiates a new Change object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewChangeWithDefaults() *Change {
this := Change{}
return &this
}
// GetChangeType returns the ChangeType field value
func (o *Change) GetChangeType() ChangeType {
if o == nil {
var ret ChangeType
return ret
}
return o.ChangeType
}
// GetChangeTypeOk returns a tuple with the ChangeType field value
// and a boolean to check if the value has been set.
func (o *Change) GetChangeTypeOk() (*ChangeType, bool) {
if o == nil {
return nil, false
}
return &o.ChangeType, true
}
// SetChangeType sets field value
func (o *Change) SetChangeType(v ChangeType) {
o.ChangeType = v
}
// GetItemType returns the ItemType field value
func (o *Change) GetItemType() ItemType {
if o == nil {
var ret ItemType
return ret
}
return o.ItemType
}
// GetItemTypeOk returns a tuple with the ItemType field value
// and a boolean to check if the value has been set.
func (o *Change) GetItemTypeOk() (*ItemType, bool) {
if o == nil {
return nil, false
}
return &o.ItemType, true
}
// SetItemType sets field value
func (o *Change) SetItemType(v ItemType) {
o.ItemType = v
}
// GetShowId returns the ShowId field value
func (o *Change) GetShowId() string {
if o == nil {
var ret string
return ret
}
return o.ShowId
}
// GetShowIdOk returns a tuple with the ShowId field value
// and a boolean to check if the value has been set.
func (o *Change) GetShowIdOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.ShowId, true
}
// SetShowId sets field value
func (o *Change) SetShowId(v string) {
o.ShowId = v
}
// GetShowType returns the ShowType field value
func (o *Change) GetShowType() ShowType {
if o == nil {
var ret ShowType
return ret
}
return o.ShowType
}
// GetShowTypeOk returns a tuple with the ShowType field value
// and a boolean to check if the value has been set.
func (o *Change) GetShowTypeOk() (*ShowType, bool) {
if o == nil {
return nil, false
}
return &o.ShowType, true
}
// SetShowType sets field value
func (o *Change) SetShowType(v ShowType) {
o.ShowType = v
}
// GetSeason returns the Season field value if set, zero value otherwise.
func (o *Change) GetSeason() int32 {
if o == nil || IsNil(o.Season) {
var ret int32
return ret
}
return *o.Season
}
// GetSeasonOk returns a tuple with the Season field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Change) GetSeasonOk() (*int32, bool) {
if o == nil || IsNil(o.Season) {
return nil, false
}
return o.Season, true
}
// HasSeason returns a boolean if a field has been set.
func (o *Change) HasSeason() bool {
if o != nil && !IsNil(o.Season) {
return true
}
return false
}
// SetSeason gets a reference to the given int32 and assigns it to the Season field.
func (o *Change) SetSeason(v int32) {
o.Season = &v
}
// GetEpisode returns the Episode field value if set, zero value otherwise.
func (o *Change) GetEpisode() int32 {
if o == nil || IsNil(o.Episode) {
var ret int32
return ret
}
return *o.Episode
}
// GetEpisodeOk returns a tuple with the Episode field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Change) GetEpisodeOk() (*int32, bool) {
if o == nil || IsNil(o.Episode) {
return nil, false
}
return o.Episode, true
}
// HasEpisode returns a boolean if a field has been set.
func (o *Change) HasEpisode() bool {
if o != nil && !IsNil(o.Episode) {
return true
}
return false
}
// SetEpisode gets a reference to the given int32 and assigns it to the Episode field.
func (o *Change) SetEpisode(v int32) {
o.Episode = &v
}
// GetService returns the Service field value
func (o *Change) GetService() ServiceInfo {
if o == nil {
var ret ServiceInfo
return ret
}
return o.Service
}
// GetServiceOk returns a tuple with the Service field value
// and a boolean to check if the value has been set.
func (o *Change) GetServiceOk() (*ServiceInfo, bool) {
if o == nil {
return nil, false
}
return &o.Service, true
}
// SetService sets field value
func (o *Change) SetService(v ServiceInfo) {
o.Service = v
}
// GetStreamingOptionType returns the StreamingOptionType field value
func (o *Change) GetStreamingOptionType() StreamingOptionType {
if o == nil {
var ret StreamingOptionType
return ret
}
return o.StreamingOptionType
}
// GetStreamingOptionTypeOk returns a tuple with the StreamingOptionType field value
// and a boolean to check if the value has been set.
func (o *Change) GetStreamingOptionTypeOk() (*StreamingOptionType, bool) {
if o == nil {
return nil, false
}
return &o.StreamingOptionType, true
}
// SetStreamingOptionType sets field value
func (o *Change) SetStreamingOptionType(v StreamingOptionType) {
o.StreamingOptionType = v
}
// GetAddon returns the Addon field value if set, zero value otherwise.
func (o *Change) GetAddon() Addon {
if o == nil || IsNil(o.Addon) {
var ret Addon
return ret
}
return *o.Addon
}
// GetAddonOk returns a tuple with the Addon field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Change) GetAddonOk() (*Addon, bool) {
if o == nil || IsNil(o.Addon) {
return nil, false
}
return o.Addon, true
}
// HasAddon returns a boolean if a field has been set.
func (o *Change) HasAddon() bool {
if o != nil && !IsNil(o.Addon) {
return true
}
return false
}
// SetAddon gets a reference to the given Addon and assigns it to the Addon field.
func (o *Change) SetAddon(v Addon) {
o.Addon = &v
}
// GetTimestamp returns the Timestamp field value if set, zero value otherwise.
func (o *Change) GetTimestamp() int64 {
if o == nil || IsNil(o.Timestamp) {
var ret int64
return ret
}
return *o.Timestamp
}
// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Change) GetTimestampOk() (*int64, bool) {
if o == nil || IsNil(o.Timestamp) {
return nil, false
}
return o.Timestamp, true
}
// HasTimestamp returns a boolean if a field has been set.
func (o *Change) HasTimestamp() bool {
if o != nil && !IsNil(o.Timestamp) {
return true
}
return false
}
// SetTimestamp gets a reference to the given int64 and assigns it to the Timestamp field.
func (o *Change) SetTimestamp(v int64) {
o.Timestamp = &v
}
// GetLink returns the Link field value if set, zero value otherwise.
func (o *Change) GetLink() string {
if o == nil || IsNil(o.Link) {
var ret string
return ret
}
return *o.Link
}
// GetLinkOk returns a tuple with the Link field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Change) GetLinkOk() (*string, bool) {
if o == nil || IsNil(o.Link) {
return nil, false
}
return o.Link, true
}
// HasLink returns a boolean if a field has been set.
func (o *Change) HasLink() bool {
if o != nil && !IsNil(o.Link) {
return true
}
return false
}
// SetLink gets a reference to the given string and assigns it to the Link field.
func (o *Change) SetLink(v string) {
o.Link = &v
}
func (o Change) MarshalJSON() ([]byte, error) {
toSerialize,err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o Change) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["changeType"] = o.ChangeType
toSerialize["itemType"] = o.ItemType
toSerialize["showId"] = o.ShowId
toSerialize["showType"] = o.ShowType
if !IsNil(o.Season) {
toSerialize["season"] = o.Season
}
if !IsNil(o.Episode) {
toSerialize["episode"] = o.Episode
}
toSerialize["service"] = o.Service
toSerialize["streamingOptionType"] = o.StreamingOptionType
if !IsNil(o.Addon) {
toSerialize["addon"] = o.Addon
}
if !IsNil(o.Timestamp) {
toSerialize["timestamp"] = o.Timestamp
}
if !IsNil(o.Link) {
toSerialize["link"] = o.Link
}
return toSerialize, nil
}
func (o *Change) UnmarshalJSON(data []byte) (err error) {
// This validates that all required properties are included in the JSON object
// by unmarshalling the object into a generic map with string keys and checking
// that every required field exists as a key in the generic map.
requiredProperties := []string{
"changeType",
"itemType",
"showId",
"showType",
"service",
"streamingOptionType",
}
allProperties := make(map[string]interface{})
err = json.Unmarshal(data, &allProperties)
if err != nil {
return err;
}
for _, requiredProperty := range(requiredProperties) {
if _, exists := allProperties[requiredProperty]; !exists {
return fmt.Errorf("no value given for required property %v", requiredProperty)
}
}
varChange := _Change{}
decoder := json.NewDecoder(bytes.NewReader(data))
decoder.DisallowUnknownFields()
err = decoder.Decode(&varChange)
if err != nil {
return err
}
*o = Change(varChange)
return err
}
type NullableChange struct {
value *Change
isSet bool
}
func (v NullableChange) Get() *Change {
return v.value
}
func (v *NullableChange) Set(val *Change) {
v.value = val
v.isSet = true
}
func (v NullableChange) IsSet() bool {
return v.isSet
}
func (v *NullableChange) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableChange(val *Change) *NullableChange {
return &NullableChange{value: val, isSet: true}
}
func (v NullableChange) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableChange) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}