forked from labd/commercetools-go-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types_customer.go
824 lines (743 loc) · 26.8 KB
/
types_customer.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
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
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
// Automatically generated, do not edit
package commercetools
import (
"encoding/json"
"errors"
"time"
)
// AnonymousCartSignInMode is an enum type
type AnonymousCartSignInMode string
// Enum values for AnonymousCartSignInMode
const (
AnonymousCartSignInModeMergeWithExistingCustomerCart AnonymousCartSignInMode = "MergeWithExistingCustomerCart"
AnonymousCartSignInModeUseAsNewActiveCustomerCart AnonymousCartSignInMode = "UseAsNewActiveCustomerCart"
)
// CustomerUpdateAction uses action as discriminator attribute
type CustomerUpdateAction interface{}
func mapDiscriminatorCustomerUpdateAction(input interface{}) (CustomerUpdateAction, error) {
var discriminator string
if data, ok := input.(map[string]interface{}); ok {
discriminator, ok = data["action"].(string)
if !ok {
return nil, errors.New("Error processing discriminator field 'action'")
}
} else {
return nil, errors.New("Invalid data")
}
switch discriminator {
case "addAddress":
new := CustomerAddAddressAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "addBillingAddressId":
new := CustomerAddBillingAddressIDAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "addShippingAddressId":
new := CustomerAddShippingAddressIDAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "addStore":
new := CustomerAddStoreAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "changeAddress":
new := CustomerChangeAddressAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "changeEmail":
new := CustomerChangeEmailAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "removeAddress":
new := CustomerRemoveAddressAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "removeBillingAddressId":
new := CustomerRemoveBillingAddressIDAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "removeShippingAddressId":
new := CustomerRemoveShippingAddressIDAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "removeStore":
new := CustomerRemoveStoreAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "setCompanyName":
new := CustomerSetCompanyNameAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "setCustomField":
new := CustomerSetCustomFieldAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "setCustomType":
new := CustomerSetCustomTypeAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "setCustomerGroup":
new := CustomerSetCustomerGroupAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "setCustomerNumber":
new := CustomerSetCustomerNumberAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "setDateOfBirth":
new := CustomerSetDateOfBirthAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "setDefaultBillingAddress":
new := CustomerSetDefaultBillingAddressAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "setDefaultShippingAddress":
new := CustomerSetDefaultShippingAddressAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "setExternalId":
new := CustomerSetExternalIDAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "setFirstName":
new := CustomerSetFirstNameAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "setKey":
new := CustomerSetKeyAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "setLastName":
new := CustomerSetLastNameAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "setLocale":
new := CustomerSetLocaleAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "setMiddleName":
new := CustomerSetMiddleNameAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "setSalutation":
new := CustomerSetSalutationAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "setStores":
new := CustomerSetStoresAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "setTitle":
new := CustomerSetTitleAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "setVatId":
new := CustomerSetVatIDAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
}
return nil, nil
}
// Customer is of type BaseResource
type Customer struct {
Version int `json:"version"`
VatID string `json:"vatId,omitempty"`
Title string `json:"title,omitempty"`
Stores []StoreKeyReference `json:"stores,omitempty"`
ShippingAddressIds []string `json:"shippingAddressIds,omitempty"`
Salutation string `json:"salutation,omitempty"`
Password string `json:"password"`
MiddleName string `json:"middleName,omitempty"`
Locale string `json:"locale,omitempty"`
LastName string `json:"lastName,omitempty"`
LastModifiedBy *LastModifiedBy `json:"lastModifiedBy,omitempty"`
LastModifiedAt time.Time `json:"lastModifiedAt"`
Key string `json:"key,omitempty"`
IsEmailVerified bool `json:"isEmailVerified"`
ID string `json:"id"`
FirstName string `json:"firstName,omitempty"`
ExternalID string `json:"externalId,omitempty"`
Email string `json:"email"`
DefaultShippingAddressID string `json:"defaultShippingAddressId,omitempty"`
DefaultBillingAddressID string `json:"defaultBillingAddressId,omitempty"`
DateOfBirth *Date `json:"dateOfBirth,omitempty"`
CustomerNumber string `json:"customerNumber,omitempty"`
CustomerGroup *CustomerGroupReference `json:"customerGroup,omitempty"`
Custom *CustomFields `json:"custom,omitempty"`
CreatedBy *CreatedBy `json:"createdBy,omitempty"`
CreatedAt time.Time `json:"createdAt"`
CompanyName string `json:"companyName,omitempty"`
BillingAddressIds []string `json:"billingAddressIds,omitempty"`
Addresses []Address `json:"addresses"`
}
// CustomerAddAddressAction implements the interface CustomerUpdateAction
type CustomerAddAddressAction struct {
Address *Address `json:"address"`
}
// MarshalJSON override to set the discriminator value
func (obj CustomerAddAddressAction) MarshalJSON() ([]byte, error) {
type Alias CustomerAddAddressAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "addAddress", Alias: (*Alias)(&obj)})
}
// CustomerAddBillingAddressIDAction implements the interface CustomerUpdateAction
type CustomerAddBillingAddressIDAction struct {
AddressKey string `json:"addressKey,omitempty"`
AddressID string `json:"addressId,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj CustomerAddBillingAddressIDAction) MarshalJSON() ([]byte, error) {
type Alias CustomerAddBillingAddressIDAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "addBillingAddressId", Alias: (*Alias)(&obj)})
}
// CustomerAddShippingAddressIDAction implements the interface CustomerUpdateAction
type CustomerAddShippingAddressIDAction struct {
AddressKey string `json:"addressKey,omitempty"`
AddressID string `json:"addressId,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj CustomerAddShippingAddressIDAction) MarshalJSON() ([]byte, error) {
type Alias CustomerAddShippingAddressIDAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "addShippingAddressId", Alias: (*Alias)(&obj)})
}
// CustomerAddStoreAction implements the interface CustomerUpdateAction
type CustomerAddStoreAction struct {
Store *StoreResourceIdentifier `json:"store"`
}
// MarshalJSON override to set the discriminator value
func (obj CustomerAddStoreAction) MarshalJSON() ([]byte, error) {
type Alias CustomerAddStoreAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "addStore", Alias: (*Alias)(&obj)})
}
// CustomerChangeAddressAction implements the interface CustomerUpdateAction
type CustomerChangeAddressAction struct {
AddressKey string `json:"addressKey,omitempty"`
AddressID string `json:"addressId,omitempty"`
Address *Address `json:"address"`
}
// MarshalJSON override to set the discriminator value
func (obj CustomerChangeAddressAction) MarshalJSON() ([]byte, error) {
type Alias CustomerChangeAddressAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "changeAddress", Alias: (*Alias)(&obj)})
}
// CustomerChangeEmailAction implements the interface CustomerUpdateAction
type CustomerChangeEmailAction struct {
Email string `json:"email"`
}
// MarshalJSON override to set the discriminator value
func (obj CustomerChangeEmailAction) MarshalJSON() ([]byte, error) {
type Alias CustomerChangeEmailAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "changeEmail", Alias: (*Alias)(&obj)})
}
// CustomerChangePassword is a standalone struct
type CustomerChangePassword struct {
Version int `json:"version"`
NewPassword string `json:"newPassword"`
ID string `json:"id"`
CurrentPassword string `json:"currentPassword"`
}
// CustomerCreateEmailToken is a standalone struct
type CustomerCreateEmailToken struct {
Version int `json:"version,omitempty"`
TTLMinutes int `json:"ttlMinutes"`
ID string `json:"id"`
}
// CustomerCreatePasswordResetToken is a standalone struct
type CustomerCreatePasswordResetToken struct {
TTLMinutes int `json:"ttlMinutes,omitempty"`
Email string `json:"email"`
}
// CustomerDraft is a standalone struct
type CustomerDraft struct {
VatID string `json:"vatId,omitempty"`
Title string `json:"title,omitempty"`
Stores []StoreResourceIdentifier `json:"stores,omitempty"`
ShippingAddresses []int `json:"shippingAddresses,omitempty"`
Salutation string `json:"salutation,omitempty"`
Password string `json:"password"`
MiddleName string `json:"middleName,omitempty"`
Locale string `json:"locale,omitempty"`
LastName string `json:"lastName,omitempty"`
Key string `json:"key,omitempty"`
IsEmailVerified bool `json:"isEmailVerified"`
FirstName string `json:"firstName,omitempty"`
ExternalID string `json:"externalId,omitempty"`
Email string `json:"email"`
DefaultShippingAddress int `json:"defaultShippingAddress,omitempty"`
DefaultBillingAddress int `json:"defaultBillingAddress,omitempty"`
DateOfBirth *Date `json:"dateOfBirth,omitempty"`
CustomerNumber string `json:"customerNumber,omitempty"`
CustomerGroup *CustomerGroupResourceIdentifier `json:"customerGroup,omitempty"`
Custom *CustomFieldsDraft `json:"custom,omitempty"`
CompanyName string `json:"companyName,omitempty"`
BillingAddresses []int `json:"billingAddresses,omitempty"`
AnonymousID string `json:"anonymousId,omitempty"`
AnonymousCartID string `json:"anonymousCartId,omitempty"`
Addresses []Address `json:"addresses,omitempty"`
}
// CustomerEmailVerify is a standalone struct
type CustomerEmailVerify struct {
Version int `json:"version,omitempty"`
TokenValue string `json:"tokenValue"`
}
// CustomerPagedQueryResponse is a standalone struct
type CustomerPagedQueryResponse struct {
Total int `json:"total,omitempty"`
Results []Customer `json:"results"`
Offset int `json:"offset"`
Limit int `json:"limit"`
Count int `json:"count"`
}
// CustomerReference implements the interface Reference
type CustomerReference struct {
ID string `json:"id"`
Obj *Customer `json:"obj,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj CustomerReference) MarshalJSON() ([]byte, error) {
type Alias CustomerReference
return json.Marshal(struct {
TypeID string `json:"typeId"`
*Alias
}{TypeID: "customer", Alias: (*Alias)(&obj)})
}
// CustomerRemoveAddressAction implements the interface CustomerUpdateAction
type CustomerRemoveAddressAction struct {
AddressKey string `json:"addressKey,omitempty"`
AddressID string `json:"addressId,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj CustomerRemoveAddressAction) MarshalJSON() ([]byte, error) {
type Alias CustomerRemoveAddressAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "removeAddress", Alias: (*Alias)(&obj)})
}
// CustomerRemoveBillingAddressIDAction implements the interface CustomerUpdateAction
type CustomerRemoveBillingAddressIDAction struct {
AddressKey string `json:"addressKey,omitempty"`
AddressID string `json:"addressId,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj CustomerRemoveBillingAddressIDAction) MarshalJSON() ([]byte, error) {
type Alias CustomerRemoveBillingAddressIDAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "removeBillingAddressId", Alias: (*Alias)(&obj)})
}
// CustomerRemoveShippingAddressIDAction implements the interface CustomerUpdateAction
type CustomerRemoveShippingAddressIDAction struct {
AddressKey string `json:"addressKey,omitempty"`
AddressID string `json:"addressId,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj CustomerRemoveShippingAddressIDAction) MarshalJSON() ([]byte, error) {
type Alias CustomerRemoveShippingAddressIDAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "removeShippingAddressId", Alias: (*Alias)(&obj)})
}
// CustomerRemoveStoreAction implements the interface CustomerUpdateAction
type CustomerRemoveStoreAction struct {
Store *StoreResourceIdentifier `json:"store"`
}
// MarshalJSON override to set the discriminator value
func (obj CustomerRemoveStoreAction) MarshalJSON() ([]byte, error) {
type Alias CustomerRemoveStoreAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "removeStore", Alias: (*Alias)(&obj)})
}
// CustomerResetPassword is a standalone struct
type CustomerResetPassword struct {
Version int `json:"version,omitempty"`
TokenValue string `json:"tokenValue"`
NewPassword string `json:"newPassword"`
}
// CustomerResourceIdentifier implements the interface ResourceIdentifier
type CustomerResourceIdentifier struct {
Key string `json:"key,omitempty"`
ID string `json:"id,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj CustomerResourceIdentifier) MarshalJSON() ([]byte, error) {
type Alias CustomerResourceIdentifier
return json.Marshal(struct {
TypeID string `json:"typeId"`
*Alias
}{TypeID: "customer", Alias: (*Alias)(&obj)})
}
// CustomerSetCompanyNameAction implements the interface CustomerUpdateAction
type CustomerSetCompanyNameAction struct {
CompanyName string `json:"companyName,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj CustomerSetCompanyNameAction) MarshalJSON() ([]byte, error) {
type Alias CustomerSetCompanyNameAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "setCompanyName", Alias: (*Alias)(&obj)})
}
// CustomerSetCustomFieldAction implements the interface CustomerUpdateAction
type CustomerSetCustomFieldAction struct {
Value interface{} `json:"value,omitempty"`
Name string `json:"name"`
}
// MarshalJSON override to set the discriminator value
func (obj CustomerSetCustomFieldAction) MarshalJSON() ([]byte, error) {
type Alias CustomerSetCustomFieldAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "setCustomField", Alias: (*Alias)(&obj)})
}
// CustomerSetCustomTypeAction implements the interface CustomerUpdateAction
type CustomerSetCustomTypeAction struct {
Type *TypeResourceIdentifier `json:"type,omitempty"`
Fields *FieldContainer `json:"fields,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj CustomerSetCustomTypeAction) MarshalJSON() ([]byte, error) {
type Alias CustomerSetCustomTypeAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "setCustomType", Alias: (*Alias)(&obj)})
}
// CustomerSetCustomerGroupAction implements the interface CustomerUpdateAction
type CustomerSetCustomerGroupAction struct {
CustomerGroup *CustomerGroupResourceIdentifier `json:"customerGroup,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj CustomerSetCustomerGroupAction) MarshalJSON() ([]byte, error) {
type Alias CustomerSetCustomerGroupAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "setCustomerGroup", Alias: (*Alias)(&obj)})
}
// CustomerSetCustomerNumberAction implements the interface CustomerUpdateAction
type CustomerSetCustomerNumberAction struct {
CustomerNumber string `json:"customerNumber,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj CustomerSetCustomerNumberAction) MarshalJSON() ([]byte, error) {
type Alias CustomerSetCustomerNumberAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "setCustomerNumber", Alias: (*Alias)(&obj)})
}
// CustomerSetDateOfBirthAction implements the interface CustomerUpdateAction
type CustomerSetDateOfBirthAction struct {
DateOfBirth *Date `json:"dateOfBirth,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj CustomerSetDateOfBirthAction) MarshalJSON() ([]byte, error) {
type Alias CustomerSetDateOfBirthAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "setDateOfBirth", Alias: (*Alias)(&obj)})
}
// CustomerSetDefaultBillingAddressAction implements the interface CustomerUpdateAction
type CustomerSetDefaultBillingAddressAction struct {
AddressKey string `json:"addressKey,omitempty"`
AddressID string `json:"addressId,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj CustomerSetDefaultBillingAddressAction) MarshalJSON() ([]byte, error) {
type Alias CustomerSetDefaultBillingAddressAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "setDefaultBillingAddress", Alias: (*Alias)(&obj)})
}
// CustomerSetDefaultShippingAddressAction implements the interface CustomerUpdateAction
type CustomerSetDefaultShippingAddressAction struct {
AddressKey string `json:"addressKey,omitempty"`
AddressID string `json:"addressId,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj CustomerSetDefaultShippingAddressAction) MarshalJSON() ([]byte, error) {
type Alias CustomerSetDefaultShippingAddressAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "setDefaultShippingAddress", Alias: (*Alias)(&obj)})
}
// CustomerSetExternalIDAction implements the interface CustomerUpdateAction
type CustomerSetExternalIDAction struct {
ExternalID string `json:"externalId,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj CustomerSetExternalIDAction) MarshalJSON() ([]byte, error) {
type Alias CustomerSetExternalIDAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "setExternalId", Alias: (*Alias)(&obj)})
}
// CustomerSetFirstNameAction implements the interface CustomerUpdateAction
type CustomerSetFirstNameAction struct {
FirstName string `json:"firstName,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj CustomerSetFirstNameAction) MarshalJSON() ([]byte, error) {
type Alias CustomerSetFirstNameAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "setFirstName", Alias: (*Alias)(&obj)})
}
// CustomerSetKeyAction implements the interface CustomerUpdateAction
type CustomerSetKeyAction struct {
Key string `json:"key,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj CustomerSetKeyAction) MarshalJSON() ([]byte, error) {
type Alias CustomerSetKeyAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "setKey", Alias: (*Alias)(&obj)})
}
// CustomerSetLastNameAction implements the interface CustomerUpdateAction
type CustomerSetLastNameAction struct {
LastName string `json:"lastName,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj CustomerSetLastNameAction) MarshalJSON() ([]byte, error) {
type Alias CustomerSetLastNameAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "setLastName", Alias: (*Alias)(&obj)})
}
// CustomerSetLocaleAction implements the interface CustomerUpdateAction
type CustomerSetLocaleAction struct {
Locale string `json:"locale,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj CustomerSetLocaleAction) MarshalJSON() ([]byte, error) {
type Alias CustomerSetLocaleAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "setLocale", Alias: (*Alias)(&obj)})
}
// CustomerSetMiddleNameAction implements the interface CustomerUpdateAction
type CustomerSetMiddleNameAction struct {
MiddleName string `json:"middleName,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj CustomerSetMiddleNameAction) MarshalJSON() ([]byte, error) {
type Alias CustomerSetMiddleNameAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "setMiddleName", Alias: (*Alias)(&obj)})
}
// CustomerSetSalutationAction implements the interface CustomerUpdateAction
type CustomerSetSalutationAction struct {
Salutation string `json:"salutation,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj CustomerSetSalutationAction) MarshalJSON() ([]byte, error) {
type Alias CustomerSetSalutationAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "setSalutation", Alias: (*Alias)(&obj)})
}
// CustomerSetStoresAction implements the interface CustomerUpdateAction
type CustomerSetStoresAction struct {
Stores []StoreResourceIdentifier `json:"stores,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj CustomerSetStoresAction) MarshalJSON() ([]byte, error) {
type Alias CustomerSetStoresAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "setStores", Alias: (*Alias)(&obj)})
}
// CustomerSetTitleAction implements the interface CustomerUpdateAction
type CustomerSetTitleAction struct {
Title string `json:"title,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj CustomerSetTitleAction) MarshalJSON() ([]byte, error) {
type Alias CustomerSetTitleAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "setTitle", Alias: (*Alias)(&obj)})
}
// CustomerSetVatIDAction implements the interface CustomerUpdateAction
type CustomerSetVatIDAction struct {
VatID string `json:"vatId,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj CustomerSetVatIDAction) MarshalJSON() ([]byte, error) {
type Alias CustomerSetVatIDAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "setVatId", Alias: (*Alias)(&obj)})
}
// CustomerSignInResult is a standalone struct
type CustomerSignInResult struct {
Customer *Customer `json:"customer"`
Cart interface{} `json:"cart,omitempty"`
}
// CustomerSignin is a standalone struct
type CustomerSignin struct {
UpdateProductData bool `json:"updateProductData"`
Password string `json:"password"`
Email string `json:"email"`
AnonymousID string `json:"anonymousId,omitempty"`
AnonymousCartSignInMode AnonymousCartSignInMode `json:"anonymousCartSignInMode,omitempty"`
AnonymousCartID string `json:"anonymousCartId,omitempty"`
}
// CustomerToken is a standalone struct
type CustomerToken struct {
Value string `json:"value"`
LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"`
ID string `json:"id"`
ExpiresAt time.Time `json:"expiresAt"`
CustomerID string `json:"customerId"`
CreatedAt time.Time `json:"createdAt"`
}
// CustomerUpdate is a standalone struct
type CustomerUpdate struct {
Version int `json:"version"`
Actions []CustomerUpdateAction `json:"actions"`
}
type CustomerResponse struct {
Customer *Customer `json:"customer"`
}
// UnmarshalJSON override to deserialize correct attribute types based
// on the discriminator value
func (obj *CustomerUpdate) UnmarshalJSON(data []byte) error {
type Alias CustomerUpdate
if err := json.Unmarshal(data, (*Alias)(obj)); err != nil {
return err
}
for i := range obj.Actions {
var err error
obj.Actions[i], err = mapDiscriminatorCustomerUpdateAction(obj.Actions[i])
if err != nil {
return err
}
}
return nil
}