-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathresponse.go
693 lines (584 loc) · 20.5 KB
/
response.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
package retailcrm
// SuccessfulResponse type.
type SuccessfulResponse struct {
Success bool `json:"success"`
}
type CreateLoyaltyAccountResponse struct {
SuccessfulResponse
LoyaltyAccount LoyaltyAccount `json:"loyaltyAccount,omitempty"`
Warnings []string `json:"warnings,omitempty"`
}
type EditLoyaltyAccountResponse struct {
SuccessfulResponse
LoyaltyAccount LoyaltyAccount `json:"loyaltyAccount,omitempty"`
}
// CreateResponse type.
type CreateResponse struct {
Success bool `json:"success"`
ID int `json:"id,omitempty"`
}
// OrderCreateResponse type.
type OrderCreateResponse struct {
CreateResponse
Order Order `json:"order,omitempty"`
}
// OperationResponse type.
type OperationResponse struct {
Success bool `json:"success"`
Errors map[string]string `json:"ErrorsList,omitempty"`
}
// VersionResponse return available API versions.
type VersionResponse struct {
Success bool `json:"success,omitempty"`
Versions []string `json:"versions,omitempty"`
}
// CredentialResponse return available API methods.
type CredentialResponse struct {
Success bool `json:"success,omitempty"`
// deprecated
Credentials []string `json:"credentials,omitempty"`
Scopes []string `json:"scopes,omitempty"`
SiteAccess string `json:"siteAccess,omitempty"`
SitesAvailable []string `json:"sitesAvailable,omitempty"`
}
// SystemInfoResponse return system info.
type SystemInfoResponse struct {
Success bool `json:"success,omitempty"`
SystemVersion string `json:"systemVersion,omitempty"`
PublicURL string `json:"publicUrl,omitempty"`
TechnicalURL string `json:"technicalUrl,omitempty"`
}
// CustomerResponse type.
type CustomerResponse struct {
Success bool `json:"success"`
Customer *Customer `json:"customer,omitempty"`
}
// CorporateCustomerResponse type.
type CorporateCustomerResponse struct {
Success bool `json:"success"`
CorporateCustomer *CorporateCustomer `json:"customerCorporate,omitempty"`
}
// CustomersResponse type.
type CustomersResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Customers []Customer `json:"customers,omitempty"`
}
// CorporateCustomersResponse type.
type CorporateCustomersResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
CustomersCorporate []CorporateCustomer `json:"customersCorporate,omitempty"`
}
// CorporateCustomersNotesResponse type.
type CorporateCustomersNotesResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Notes []Note `json:"notes,omitempty"`
}
// CorporateCustomersAddressesResponse type.
type CorporateCustomersAddressesResponse struct {
Success bool `json:"success"`
Addresses []CorporateCustomerAddress `json:"addresses"`
}
// CorporateCustomerCompaniesResponse type.
type CorporateCustomerCompaniesResponse struct {
Success bool `json:"success"`
Companies []Company `json:"companies"`
}
// CorporateCustomerContactsResponse type.
type CorporateCustomerContactsResponse struct {
Success bool `json:"success"`
Contacts []CorporateCustomerContact `json:"contacts"`
}
// CustomerChangeResponse type.
type CustomerChangeResponse struct {
Success bool `json:"success"`
ID int `json:"id,omitempty"`
State string `json:"state,omitempty"`
}
// CorporateCustomerChangeResponse type.
type CorporateCustomerChangeResponse CustomerChangeResponse
// CustomersUploadResponse type.
type CustomersUploadResponse struct {
Success bool `json:"success"`
UploadedCustomers []IdentifiersPair `json:"uploadedCustomers,omitempty"`
FailedCustomers []ExternalID `json:"failedCustomers,omitempty"`
}
// CorporateCustomersUploadResponse type.
type CorporateCustomersUploadResponse CustomersUploadResponse
// CustomersHistoryResponse type.
type CustomersHistoryResponse struct {
Success bool `json:"success,omitempty"`
GeneratedAt string `json:"generatedAt,omitempty"`
History []CustomerHistoryRecord `json:"history,omitempty"`
Pagination *Pagination `json:"pagination,omitempty"`
}
// CorporateCustomersHistoryResponse type.
type CorporateCustomersHistoryResponse struct {
Success bool `json:"success,omitempty"`
GeneratedAt string `json:"generatedAt,omitempty"`
History []CorporateCustomerHistoryRecord `json:"history,omitempty"`
Pagination *Pagination `json:"pagination,omitempty"`
}
// OrderResponse type.
type OrderResponse struct {
Success bool `json:"success"`
Order *Order `json:"order,omitempty"`
}
// OrdersResponse type.
type OrdersResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Orders []Order `json:"orders,omitempty"`
}
// OrdersStatusesResponse type.
type OrdersStatusesResponse struct {
Success bool `json:"success"`
Orders []OrdersStatus `json:"orders"`
}
// OrdersUploadResponse type.
type OrdersUploadResponse struct {
Success bool `json:"success"`
UploadedOrders []IdentifiersPair `json:"uploadedOrders,omitempty"`
FailedOrders []ExternalID `json:"failedOrders,omitempty"`
}
// OrdersHistoryResponse type.
type OrdersHistoryResponse struct {
Success bool `json:"success,omitempty"`
GeneratedAt string `json:"generatedAt,omitempty"`
History []OrdersHistoryRecord `json:"history,omitempty"`
Pagination *Pagination `json:"pagination,omitempty"`
}
// PackResponse type.
type PackResponse struct {
Success bool `json:"success"`
Pack *Pack `json:"pack,omitempty"`
}
// PacksResponse type.
type PacksResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Packs []Pack `json:"packs,omitempty"`
}
// PacksHistoryResponse type.
type PacksHistoryResponse struct {
Success bool `json:"success,omitempty"`
GeneratedAt string `json:"generatedAt,omitempty"`
History []PacksHistoryRecord `json:"history,omitempty"`
Pagination *Pagination `json:"pagination,omitempty"`
}
// UserResponse type.
type UserResponse struct {
Success bool `json:"success"`
User *User `json:"user,omitempty"`
}
// UsersResponse type.
type UsersResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Users []User `json:"users,omitempty"`
}
// UserGroupsResponse type.
type UserGroupsResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Groups []UserGroup `json:"groups,omitempty"`
}
// TaskResponse type.
type TaskResponse struct {
Success bool `json:"success"`
Task *Task `json:"task,omitempty"`
}
// TasksResponse type.
type TasksResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Tasks []Task `json:"tasks,omitempty"`
}
// NotesResponse type.
type NotesResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Notes []Note `json:"notes,omitempty"`
}
// SegmentsResponse type.
type SegmentsResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Segments []Segment `json:"segments,omitempty"`
}
// SettingsResponse type.
type SettingsResponse struct {
Success bool `json:"success"`
Settings Settings `json:"settings,omitempty"`
}
// CountriesResponse type.
type CountriesResponse struct {
Success bool `json:"success"`
CountriesIso []string `json:"countriesIso,omitempty"`
}
// CostGroupsResponse type.
type CostGroupsResponse struct {
Success bool `json:"success"`
CostGroups []CostGroup `json:"costGroups,omitempty"`
}
// CostItemsResponse type.
type CostItemsResponse struct {
Success bool `json:"success"`
CostItems []CostItem `json:"costItems,omitempty"`
}
// CouriersResponse type.
type CouriersResponse struct {
Success bool `json:"success"`
Couriers []Courier `json:"couriers,omitempty"`
}
// DeliveryServiceResponse type.
type DeliveryServiceResponse struct {
Success bool `json:"success"`
DeliveryServices map[string]DeliveryService `json:"deliveryServices,omitempty"`
}
// DeliveryTypesResponse type.
type DeliveryTypesResponse struct {
Success bool `json:"success"`
DeliveryTypes map[string]DeliveryType `json:"deliveryTypes,omitempty"`
}
// LegalEntitiesResponse type.
type LegalEntitiesResponse struct {
Success bool `json:"success"`
LegalEntities []LegalEntity `json:"legalEntities,omitempty"`
}
// OrderMethodsResponse type.
type OrderMethodsResponse struct {
Success bool `json:"success"`
OrderMethods map[string]OrderMethod `json:"orderMethods,omitempty"`
}
// OrderTypesResponse type.
type OrderTypesResponse struct {
Success bool `json:"success"`
OrderTypes map[string]OrderType `json:"orderTypes,omitempty"`
}
// PaymentStatusesResponse type.
type PaymentStatusesResponse struct {
Success bool `json:"success"`
PaymentStatuses map[string]PaymentStatus `json:"paymentStatuses,omitempty"`
}
// PaymentTypesResponse type.
type PaymentTypesResponse struct {
Success bool `json:"success"`
PaymentTypes map[string]PaymentType `json:"paymentTypes,omitempty"`
}
// PriceTypesResponse type.
type PriceTypesResponse struct {
Success bool `json:"success"`
PriceTypes []PriceType `json:"priceTypes,omitempty"`
}
// ProductStatusesResponse type.
type ProductStatusesResponse struct {
Success bool `json:"success"`
ProductStatuses map[string]ProductStatus `json:"productStatuses,omitempty"`
}
// StatusesResponse type.
type StatusesResponse struct {
Success bool `json:"success"`
Statuses map[string]Status `json:"statuses,omitempty"`
}
// StatusGroupsResponse type.
type StatusGroupsResponse struct {
Success bool `json:"success"`
StatusGroups map[string]StatusGroup `json:"statusGroups,omitempty"`
}
// SitesResponse type.
type SitesResponse struct {
Success bool `json:"success"`
Sites map[string]Site `json:"sites,omitempty"`
}
// StoresResponse type.
type StoresResponse struct {
Success bool `json:"success"`
Stores []Store `json:"stores,omitempty"`
}
// InventoriesResponse type.
type InventoriesResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Offers []Offer `json:"offers,omitempty"`
}
// StoreUploadResponse type.
type StoreUploadResponse struct {
Success bool `json:"success"`
ProcessedOffersCount int `json:"processedOffersCount,omitempty"`
NotFoundOffers []Offer `json:"notFoundOffers,omitempty"`
}
// ProductsGroupsResponse type.
type ProductsGroupsResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
ProductGroup []ProductGroup `json:"productGroup,omitempty"`
}
// ProductsResponse type.
type ProductsResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Products []Product `json:"products,omitempty"`
}
type ProductEditNotFoundResponse struct {
ID string `json:"id"`
ExternalID string `json:"externalId,omitempty"`
}
type ProductsBatchEditResponse struct {
SuccessfulResponse
ProcessedProductsCount int `json:"processedProductsCount,omitempty"`
NotFoundProducts []ProductEditNotFoundResponse `json:"notFoundProducts,omitempty"`
}
type ProductsBatchCreateResponse struct {
SuccessfulResponse
ProcessedProductsCount int `json:"processedProductsCount,omitempty"`
AddedProducts []int `json:"addedProducts,omitempty"`
}
// ProductsPropertiesResponse type.
type ProductsPropertiesResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Properties []Property `json:"properties,omitempty"`
}
// DeliveryShipmentsResponse type.
type DeliveryShipmentsResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
DeliveryShipments []DeliveryShipment `json:"deliveryShipments,omitempty"`
}
// DeliveryShipmentResponse type.
type DeliveryShipmentResponse struct {
Success bool `json:"success"`
DeliveryShipment *DeliveryShipment `json:"deliveryShipment,omitempty"`
}
// DeliveryShipmentUpdateResponse type.
type DeliveryShipmentUpdateResponse struct {
Success bool `json:"success"`
ID int `json:"id,omitempty"`
Status string `json:"status,omitempty"`
}
// IntegrationModuleResponse type.
type IntegrationModuleResponse struct {
Success bool `json:"success"`
IntegrationModule *IntegrationModule `json:"integrationModule,omitempty"`
}
// UpdateScopesResponse update scopes response.
type UpdateScopesResponse struct {
ErrorResponse
APIKey string `json:"apiKey"`
}
// IntegrationModuleEditResponse type.
type IntegrationModuleEditResponse struct {
Success bool `json:"success"`
Info ResponseInfo `json:"info,omitempty"`
}
// ResponseInfo type.
type ResponseInfo struct {
MgTransportInfo MgInfo `json:"mgTransport,omitempty"`
MgBotInfo MgInfo `json:"mgBot,omitempty"`
BillingInfo *BillingInfo `json:"billingInfo,omitempty"`
DeliveryTypeInfo DeliveryTypeInfo `json:"deliveryType,omitempty"`
}
type BillingInfo struct {
Price float64 `json:"price,omitempty"`
PriceWithDiscount float64 `json:"priceWithDiscount,omitempty"`
BillingType string `json:"billingType,omitempty"`
Currency *BillingInfoCurrency `json:"currency,omitempty"`
}
type BillingInfoCurrency struct {
Name string `json:"name,omitempty"`
ShortName string `json:"shortName,omitempty"`
Code string `json:"code,omitempty"`
}
// MgInfo type.
type MgInfo struct {
EndpointURL string `json:"endpointUrl"`
Token string `json:"token"`
}
// CostsResponse type.
type CostsResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Costs []Cost `json:"costs,omitempty"`
}
// CostsUploadResponse type.
type CostsUploadResponse struct {
Success bool `json:"success"`
UploadedCosts []int `json:"uploadedCosts,omitempty"`
}
// CostsDeleteResponse type.
type CostsDeleteResponse struct {
Success bool `json:"success"`
Count int `json:"count,omitempty"`
NotRemovedIds []int `json:"notRemovedIds,omitempty"`
}
// CostResponse type.
type CostResponse struct {
Success bool `json:"success"`
Cost *Cost `json:"cost,omitempty"`
}
// FilesResponse type.
type FilesResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Files []File `json:"files,omitempty"`
}
// FileUpload response.
type FileUploadResponse struct {
Success bool `json:"success"`
File *File `json:"file,omitempty"`
}
// FileResponse type.
type FileResponse struct {
Success bool `json:"success"`
File *File `json:"file,omitempty"`
}
// CustomFieldsResponse type.
type CustomFieldsResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
CustomFields []CustomFields `json:"customFields,omitempty"`
}
// CustomDictionariesResponse type.
type CustomDictionariesResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
CustomDictionaries *[]CustomDictionary `json:"customDictionaries,omitempty"`
}
// CustomResponse type.
type CustomResponse struct {
Success bool `json:"success"`
Code string `json:"code,omitempty"`
}
// CustomDictionaryResponse type.
type CustomDictionaryResponse struct {
Success bool `json:"success"`
CustomDictionary *CustomDictionary `json:"CustomDictionary,omitempty"`
}
// CustomFieldResponse type.
type CustomFieldResponse struct {
Success bool `json:"success"`
CustomField CustomFields `json:"customField,omitempty"`
}
// UnitsResponse type.
type UnitsResponse struct {
Success bool `json:"success"`
Units *[]Unit `json:"units,omitempty"`
}
// ErrorResponse should be returned to the one-step connection request in case of failure.
type ErrorResponse struct {
SuccessfulResponse
ErrorMessage string `json:"errorMsg"`
}
// ConnectResponse should be returned to the one-step connection request in case of successful connection.
type ConnectResponse struct {
SuccessfulResponse
AccountURL string `json:"accountUrl"`
}
// ConnectionConfigResponse contains connection configuration for one-step connection.
type ConnectionConfigResponse struct {
SuccessfulResponse
Scopes []string `json:"scopes"`
RegisterURL string `json:"registerUrl"`
}
// NewConnectResponse returns ConnectResponse with the provided account URL.
func NewConnectResponse(accountURL string) ConnectResponse {
return ConnectResponse{
SuccessfulResponse: SuccessfulResponse{Success: true},
AccountURL: accountURL,
}
}
// BonusOperationsResponse type.
type BonusOperationsResponse struct {
Success bool `json:"success"`
Pagination *CursorPagination `json:"pagination,omitempty"`
BonusOperations []BonusOperation `json:"bonusOperations,omitempty"`
}
// AccountBonusOperationsResponse type.
type AccountBonusOperationsResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
BonusOperations []BonusOperation `json:"bonusOperations,omitempty"`
}
// ClientIDResponse type.
type ClientIDResponse struct {
ErrorMsg string `json:"errorMsg,omitempty"`
Errors map[string]string `json:"errors,omitempty"`
FailedClientIds []ClientID `json:"failed_client_ids,omitempty"`
Success bool `json:"success"`
}
// SourcesResponse type.
type SourcesResponse struct {
ErrorMsg string `json:"errorMsg,omitempty"`
Errors map[string]string `json:"errors,omitempty"`
FailedSources []Source `json:"failed_sources,omitempty"`
Success bool `json:"success"`
}
// CurrencyResponse type.
type CurrencyResponse struct {
Currencies []Currency `json:"currencies,omitempty"`
Success bool `json:"success"`
}
// CurrencyCreateResponse type.
type CurrencyCreateResponse struct {
Success bool `json:"success"`
ID int `json:"id,omitempty"`
}
type LoyaltyAccountResponse struct {
SuccessfulResponse
LoyaltyAccount `json:"loyaltyAccount"`
}
type LoyaltyAccountActivateResponse struct {
SuccessfulResponse
LoyaltyAccount `json:"loyaltyAccount"`
Verification SmsVerification `json:"verification,omitempty"`
}
type LoyaltyBonusCreditResponse struct {
SuccessfulResponse
LoyaltyBonus LoyaltyBonus `json:"loyaltyBonus"`
}
type LoyaltyBonusDetailsResponse struct {
SuccessfulResponse
Pagination `json:"pagination"`
Statistic LoyaltyBonusStatisticResponse `json:"statistic"`
Bonuses []BonusDetail `json:"bonuses,omitempty"`
}
type LoyaltyBonusStatisticResponse struct {
TotalAmount float64 `json:"totalAmount"`
}
type LoyaltyAccountsResponse struct {
SuccessfulResponse
Pagination *Pagination `json:"pagination"`
LoyaltyAccounts []LoyaltyAccount `json:"loyaltyAccounts,omitempty"`
}
type LoyaltyCalculateResponse struct {
SuccessfulResponse
Order SerializedLoyaltyOrder `json:"order,omitempty"`
Calculations []LoyaltyCalculation `json:"calculations,omitempty"`
Loyalty SerializedLoyalty `json:"loyalty,omitempty"`
}
type LoyaltiesResponse struct {
SuccessfulResponse
Pagination *Pagination `json:"pagination"`
Loyalties []Loyalty `json:"loyalties,omitempty"`
}
type LoyaltyResponse struct {
SuccessfulResponse
Loyalty Loyalty `json:"loyalty"`
}
type ActionProductsGroupResponse struct {
SuccessfulResponse
ID int `json:"id"`
}
type MGChannelTemplatesResponse struct {
Pagination *Pagination `json:"pagination"`
Templates []MGChannelTemplate `json:"templates"`
SuccessfulResponse
}
type StoreOffersResponse struct {
Pagination *Pagination `json:"pagination"`
SuccessfulResponse
Offers []Offer `json:"offers,omitempty"`
}