-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathproducts.go
863 lines (760 loc) · 35.1 KB
/
products.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
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
//********************************************************************************************************************//
//
// Copyright (C) 2018 - 2022 J&J Ideenschmiede GmbH <[email protected]>
//
// This file is part of goafterbuy.
// All code may be used. Feel free and maybe code something better.
//
// Author: Jonas Kwiedor (aka gowizzard)
//
//********************************************************************************************************************//
package goafterbuy
import (
"bytes"
"encoding/xml"
)
// ProductsBody is to send the body data
type ProductsBody struct {
Request ProductsRequest `xml:"Request"`
}
type ProductsRequest struct {
AfterbuyGlobal AfterbuyGlobal `xml:"AfterbuyGlobal"`
DataFilter *ProductsRequestDataFilter `xml:"DataFilter"`
MaxShopItems int `xml:"MaxShopItems"`
SuppressBaseProductRelatedData int `xml:"SuppressBaseProductRelatedData"`
PaginationEnabled int `xml:"PaginationEnabled"`
PageNumber int `xml:"PageNumber"`
}
type ProductsRequestDataFilter struct {
Filter []ProductsRequestFilter `xml:"Filter"`
}
type ProductsRequestFilter struct {
FilterName string `xml:"FilterName"`
FilterValues ProductsRequestFilterValues `xml:"FilterValues"`
}
type ProductsRequestFilterValues struct {
LevelFrom int `xml:"LevelFrom,omitempty"`
LevelTo int `xml:"LevelTo,omitempty"`
ValueFrom int `xml:"ValueFrom,omitempty"`
ValueTo int `xml:"ValueTo,omitempty"`
DateFrom string `xml:"DateFrom,omitempty"`
DateTo string `xml:"DateTo,omitempty"`
FilterValue []string `xml:"FilterValue,omitempty"`
}
// ProductsReturn is to decode the xml data
type ProductsReturn struct {
XmlName xml.Name `xml:"Afterbuy"`
CallStatus string `xml:"CallStatus"`
CallName string `xml:"CallName"`
VersionId int `xml:"VersionID"`
Result ProductsReturnResult `xml:"Result"`
}
type ProductsReturnResult struct {
XmlName xml.Name `xml:"Result"`
HasMoreProducts int `xml:"HasMoreProducts"`
Products ProductsReturnProducts `xml:"Products"`
ShippingServiceList string `xml:"ShippingServiceList"`
LastProductId int `xml:"LastProductID"`
PaginationResult ProductsReturnPaginationResult `xml:"PaginationResult"`
ErrorList ProductsReturnErrorList `xml:"ErrorList"`
}
type ProductsReturnProducts struct {
XmlName xml.Name `xml:"Products"`
Product []ProductsReturnProduct `xml:"Product"`
}
type ProductsReturnProduct struct {
XmlName xml.Name `xml:"Product"`
ProductShopOption int `xml:"ProductShopOption"`
ProductId int `xml:"ProductID"`
Anr int `xml:"Anr"`
Ean string `xml:"EAN"`
Name string `xml:"Name"`
CanonicalUrl string `xml:"CanonicalUrl"`
SeoName string `xml:"SeoName"`
EnergyClass string `xml:"EnergyClass"`
EnergyClassPictureUrl string `xml:"EnergyClassPictureUrl"`
DataSheetUrl string `xml:"DataSheetUrl"`
ModDate string `xml:"ModDate"`
BaseProductFlag int `xml:"BaseProductFlag"`
BaseProductShowMode int `xml:"BaseProductShowMode"`
BaseProducts ProductsReturnBaseProducts `xml:"BaseProducts"`
ShortDescription string `xml:"ShortDescription"`
Memo string `xml:"Memo"`
GoogleBaseLabels string `xml:"GoogleBaseLabels"`
HeaderId int `xml:"HeaderID"`
HeaderDescriptionName string `xml:"HeaderDescriptionName"`
HeaderDescriptionValue string `xml:"HeaderDescriptionValue"`
Description string `xml:"Description"`
FooterId int `xml:"FooterID"`
FooterDescriptionName string `xml:"FooterDescriptionName"`
FooterDescriptionValue string `xml:"FooterDescriptionValue"`
Keywords string `xml:"Keywords"`
AvailableShop int `xml:"AvailableShop"`
Quantity int `xml:"Quantity"`
AuctionQuantity int `xml:"AuctionQuantity"`
Stock int `xml:"Stock"`
Discontinued int `xml:"Discontinued"`
MergeStock int `xml:"MergeStock"`
UnitOfQuantity string `xml:"UnitOfQuantity"`
BasepriceFactor string `xml:"BasepriceFactor"`
MinimumStock int `xml:"MinimumStock"`
MinimumOrderQuantity int `xml:"MinimumOrderQuantity"`
FullFilmentQuantity int `xml:"FullFilmentQuantity"`
FullFilmentImport interface{} `xml:"FullFilmentImport"`
SellingPrice string `xml:"SellingPrice"`
BuyingPrice string `xml:"BuyingPrice"`
DealerPrice string `xml:"DealerPrice"`
AdditionalPrices ProductsReturnAdditionalPrices `xml:"AdditionalPrices"`
Level int `xml:"Level"`
Position int `xml:"Position"`
TitleReplace int `xml:"TitleReplace"`
ScaledDiscounts ProductsReturnScaledDiscounts `xml:"ScaledDiscounts"`
TaxRate string `xml:"TaxRate"`
Weight string `xml:"Weight"`
SearchAlias string `xml:"SearchAlias"`
Froogle int `xml:"Froogle"`
GoogleBaseShipping string `xml:"GoogleBaseShipping"`
Kelkoo int `xml:"Kelkoo"`
ShippingGroup string `xml:"ShippingGroup"`
ShopShippingGroup string `xml:"ShopShippingGroup"`
SearchEngineShipping string `xml:"SearchEngineShipping"`
CrossCatalogId int `xml:"CrossCatalogID"`
Features ProductsReturnFeatures `xml:"Features"`
FreeValue1 string `xml:"FreeValue1"`
FreeValue2 string `xml:"FreeValue2"`
FreeValue3 string `xml:"FreeValue3"`
FreeValue4 string `xml:"FreeValue4"`
FreeValue5 string `xml:"FreeValue5"`
FreeValue6 string `xml:"FreeValue6"`
FreeValue7 string `xml:"FreeValue7"`
FreeValue8 string `xml:"FreeValue8"`
FreeValue9 string `xml:"FreeValue9"`
FreeValue10 string `xml:"FreeValue10"`
DeliveryTime string `xml:"DeliveryTime"`
Stocklocation1 string `xml:"Stocklocation_1"`
Stocklocation2 string `xml:"Stocklocation_2"`
Stocklocation3 string `xml:"Stocklocation_3"`
Stocklocation4 string `xml:"Stocklocation_4"`
ImageSmallUrl string `xml:"ImageSmallURL"`
ImageLargeUrl string `xml:"ImageLargeURL"`
ProductPictures ProductsReturnProductPictures `xml:"ProductPictures"`
AmazonStandardProductIdType string `xml:"AmazonStandardProductIDType"`
AmazonStandardProductIdValue string `xml:"AmazonStandardProductIDValue"`
ManufacturerStandardProductIdType string `xml:"ManufacturerStandardProductIDType"`
ManufacturerStandardProductIdValue string `xml:"ManufacturerStandardProductIDValue"`
ProductBrand string `xml:"ProductBrand"`
CustomsTariffNumber string `xml:"CustomsTariffNumber"`
CountryOfOrigin string `xml:"CountryOfOrigin"`
LastSale string `xml:"LastSale"`
AdditionalDescriptionFields ProductsReturnAdditionalDescriptionFields `xml:"AdditionalDescriptionFields"`
Catalogs ProductsReturnCatalogs `xml:"Catalogs"`
Attributes ProductsReturnAttributes `xml:"Attributes"`
PartsFitment ProductsReturnPartsFitment `xml:"PartsFitment"`
GoogleProductCategory string `xml:"GoogleProductCategory"`
Facebook int `xml:"Facebook"`
ManufacturerPartNumber string `xml:"ManufacturerPartNumber"`
Condition int `xml:"Condition"`
AgeGroup int `xml:"AgeGroup"`
Gender int `xml:"Gender"`
Material string `xml:"Material"`
Pattern string `xml:"Pattern"`
CustomLabel0 string `xml:"CustomLabel0"`
CustomLabel1 string `xml:"CustomLabel1"`
CustomLabel2 string `xml:"CustomLabel2"`
CustomLabel3 string `xml:"CustomLabel3"`
CustomLabel4 string `xml:"CustomLabel4"`
MultiLanguage ProductsReturnMultiLanguage `xml:"MultiLanguage"`
EconomicOperators ProductsReturnEconomicOperators `xml:"EconomicOperators"`
}
type ProductsReturnBaseProducts struct {
XmlName xml.Name `xml:"BaseProducts"`
BaseProduct []ProductsReturnBaseProduct `xml:"BaseProduct"`
}
type ProductsReturnBaseProduct struct {
XmlName xml.Name `xml:"BaseProduct"`
BaseProductId int `xml:"BaseProductID"`
BaseProductType int `xml:"BaseProductType"`
BaseProductsRelationData ProductsReturnBaseProductsRelationData `xml:"BaseProductsRelationData"`
}
type ProductsReturnBaseProductsRelationData struct {
XmlName xml.Name `xml:"BaseProductsRelationData"`
Postion int `xml:"Position"`
VariationLabel string `xml:"VariationLabel"`
DefaultProduct int `xml:"DefaultProduct"`
EbayVariationData []ProductsReturnEbayVariationData `xml:"eBayVariationData"`
}
type ProductsReturnEbayVariationData struct {
XmlName xml.Name `xml:"eBayVariationData"`
EbayVariationName string `xml:"eBayVariationName"`
EbayVariationValue string `xml:"eBayVariationValue"`
EbayVariationPosition int `xml:"eBayVariationPosition"`
EbayVariationUrls string `xml:"eBayVariationUrls"`
}
type ProductsReturnAdditionalPrices struct {
XmlName xml.Name `xml:"AdditionalPrices"`
AdditionalPrice []ProductsReturnAdditionalPrice `xml:"AdditionalPrice"`
}
type ProductsReturnAdditionalPrice struct {
XmlName xml.Name `xml:"AdditionalPrice"`
DefinitionId int `xml:"DefinitionId"`
Name string `xml:"Name"`
Value string `xml:"Value"`
Pretax bool `xml:"Pretax"`
}
type ProductsReturnScaledDiscounts struct {
XmlName xml.Name `xml:"ScaledDiscounts"`
ScaledDiscount []ProductsReturnScaledDiscount `xml:"ScaledDiscount"`
}
type ProductsReturnScaledDiscount struct {
XmlName xml.Name `xml:"ScaledDiscount"`
ScaledQuantity int `xml:"ScaledQuantity"`
ScaledPrice string `xml:"ScaledPrice"`
ScaledDPrice string `xml:"ScaledDPrice"`
}
type ProductsReturnFeatures struct {
XmlName xml.Name `xml:"Features"`
Feature []ProductsReturnFeature `xml:"Feature"`
}
type ProductsReturnFeature struct {
XmlName xml.Name `xml:"Feature"`
Id int `xml:"ID"`
Name string `xml:"Name"`
Value string `xml:"Value"`
}
type ProductsReturnProductPictures struct {
XmlName xml.Name `xml:"ProductPictures"`
ProductPicture []ProductsReturnProductPicture `xml:"ProductPicture"`
}
type ProductsReturnProductPicture struct {
XmlName xml.Name `xml:"ProductPicture"`
Nr int `xml:"Nr"`
Typ int `xml:"Typ"`
Url string `xml:"Url"`
AltText string `xml:"AltText"`
Childs ProductsReturnChilds `xml:"Childs"`
}
type ProductsReturnChilds struct {
XmlName xml.Name `xml:"Childs"`
ProductPicture []ProductsReturnChildsProductPicture `xml:"ProductPicture"`
}
type ProductsReturnChildsProductPicture struct {
XmlName xml.Name `xml:"ProductPicture"`
Nr int `xml:"Nr"`
Typ int `xml:"Typ"`
Url string `xml:"Url"`
AltText string `xml:"AltText"`
}
type ProductsReturnAdditionalDescriptionFields struct {
XmlName xml.Name `xml:"AdditionalDescriptionFields"`
AdditionalDescriptionField []ProductsReturnAdditionalDescriptionField `xml:"AdditionalDescriptionField"`
}
type ProductsReturnAdditionalDescriptionField struct {
XmlName xml.Name `xml:"AdditionalDescriptionField"`
FieldId int `xml:"FieldID"`
FieldName string `xml:"FieldName"`
FieldLabel string `xml:"FieldLabel"`
FieldContent string `xml:"FieldContent"`
}
type ProductsReturnCatalogs struct {
XmlName xml.Name `xml:"Catalogs"`
CatalogId []int `xml:"CatalogID"`
}
type ProductsReturnAttributes struct {
XmlName xml.Name `xml:"Attributes"`
Attribut []ProductsReturnAttribut `xml:"Attribut"`
}
type ProductsReturnAttribut struct {
XmlName xml.Name `xml:"Attribut"`
AttributName string `xml:"AttributName"`
AttributValue string `xml:"AttributValue"`
AttributType int `xml:"AttributType"`
AttributRequired int `xml:"AttributRequired"`
AttributPosition int `xml:"AttributPosition"`
}
type ProductsReturnPartsFitment struct {
XmlName xml.Name `xml:"ProductsReturnPartsFitment"`
PartsProperties []ProductsReturnPartsProperties `xml:"PartsProperties"`
}
type ProductsReturnPartsProperties struct {
XmlName xml.Name `xml:"PartsProperties"`
PartsProperty []ProductsReturnPartsProperty `xml:"PartsProperty"`
}
type ProductsReturnPartsProperty struct {
XmlName xml.Name `xml:"PartsProperty"`
PropertyName string `xml:"PropertyName"`
PropertyValue string `xml:"PropertyValue"`
}
type ProductsReturnPaginationResult struct {
XmlName xml.Name `xml:"PaginationResult"`
TotalNumberOfEntries int `xml:"TotalNumberOfEntries"`
TotalNumberOfPages int `xml:"TotalNumberOfPages"`
ItemsPerPage int `xml:"ItemsPerPage"`
PageNumber int `xml:"PageNumber"`
}
type ProductsReturnEconomicOperators struct {
XmlName xml.Name `xml:"EconomicOperators"`
EconomicOperator []ProductsReturnEconomicOperator `xml:"EconomicOperator"`
}
type ProductsReturnEconomicOperator struct {
XmlName xml.Name `xml:"EconomicOperator"`
DatabaseId int `xml:"DatabaseId"`
ContactType int `xml:"ContactType"`
Company string `xml:"Company"`
Street1 string `xml:"Street1"`
Street2 string `xml:"Street2"`
PostalCode string `xml:"PostalCode"`
City string `xml:"City"`
StateOrProvince string `xml:"StateOrProvince"`
Country string `xml:"Country"`
Email string `xml:"Email"`
ContactUrl string `xml:"ContactUrl"`
Phone string `xml:"Phone"`
}
type ProductsReturnMultiLanguage struct {
XmlName xml.Name `xml:"MultiLanguage"`
At ProductsReturnLanguageAt `xml:"AT"`
B ProductsReturnLanguageB `xml:"B"`
Bg ProductsReturnLanguageBg `xml:"BG"`
Ch ProductsReturnLanguageCh `xml:"CH"`
Cy ProductsReturnLanguageCy `xml:"CY"`
Cz ProductsReturnLanguageCz `xml:"CZ"`
De ProductsReturnLanguageDe `xml:"DE"`
Dk ProductsReturnLanguageDe `xml:"DK"`
E ProductsReturnLanguageE `xml:"E"`
Fin ProductsReturnLanguageFin `xml:"FIN"`
Fr ProductsReturnLanguageFr `xml:"FR"`
Gb ProductsReturnLanguageGb `xml:"GB"`
Gr ProductsReturnLanguageGr `xml:"GR"`
H ProductsReturnLanguageH `xml:"H"`
Hr ProductsReturnLanguageHr `xml:"HR"`
I ProductsReturnLanguageI `xml:"I"`
Irl ProductsReturnLanguageI `xml:"IRL"`
Is ProductsReturnLanguageIs `xml:"IS"`
J ProductsReturnLanguageJ `xml:"J"`
Kp ProductsReturnLanguageKp `xml:"KP"`
Lt ProductsReturnLanguageLt `xml:"LT"`
Lu ProductsReturnLanguageLu `xml:"LU"`
Lv ProductsReturnLanguageLv `xml:"LV"`
Mt ProductsReturnLanguageMt `xml:"MT"`
N ProductsReturnLanguageN `xml:"N"`
Nl ProductsReturnLanguageNl `xml:"NL"`
P ProductsReturnLanguageP `xml:"P"`
Pl ProductsReturnLanguagePl `xml:"PL"`
Ro ProductsReturnLanguageRo `xml:"RO"`
Ru ProductsReturnLanguageRu `xml:"RU"`
S ProductsReturnLanguageS `xml:"S"`
Sk ProductsReturnLanguageSk `xml:"SK"`
Slo ProductsReturnLanguageSlo `xml:"SLO"`
Tr ProductsReturnLanguageTr `xml:"TR"`
Us ProductsReturnLanguageUs `xml:"US"`
}
type ProductsReturnLanguageAt struct {
XmlName xml.Name `xml:"AT"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageB struct {
XmlName xml.Name `xml:"B"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageBg struct {
XmlName xml.Name `xml:"BG"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageCh struct {
XmlName xml.Name `xml:"CH"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageCy struct {
XmlName xml.Name `xml:"CY"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageCz struct {
XmlName xml.Name `xml:"CZ"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageDe struct {
XmlName xml.Name `xml:"DE"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageDk struct {
XmlName xml.Name `xml:"DK"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageE struct {
XmlName xml.Name `xml:"E"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageFin struct {
XmlName xml.Name `xml:"FIN"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageFr struct {
XmlName xml.Name `xml:"FR"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageGb struct {
XmlName xml.Name `xml:"GB"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageGr struct {
XmlName xml.Name `xml:"GR"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageH struct {
XmlName xml.Name `xml:"H"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageHr struct {
XmlName xml.Name `xml:"HR"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageI struct {
XmlName xml.Name `xml:"I"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageIrl struct {
XmlName xml.Name `xml:"IRL"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageIs struct {
XmlName xml.Name `xml:"IS"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageJ struct {
XmlName xml.Name `xml:"J"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageKp struct {
XmlName xml.Name `xml:"KP"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageLt struct {
XmlName xml.Name `xml:"LT"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageLu struct {
XmlName xml.Name `xml:"LU"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageLv struct {
XmlName xml.Name `xml:"LV"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageMt struct {
XmlName xml.Name `xml:"MT"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageN struct {
XmlName xml.Name `xml:"N"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageNl struct {
XmlName xml.Name `xml:"NL"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageP struct {
XmlName xml.Name `xml:"P"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguagePl struct {
XmlName xml.Name `xml:"PL"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageRo struct {
XmlName xml.Name `xml:"RO"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageRu struct {
XmlName xml.Name `xml:"RU"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageS struct {
XmlName xml.Name `xml:"S"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageSk struct {
XmlName xml.Name `xml:"SK"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageSlo struct {
XmlName xml.Name `xml:"SLO"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageTr struct {
XmlName xml.Name `xml:"TR"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnLanguageUs struct {
XmlName xml.Name `xml:"US"`
Alias string `xml:"Alias"`
Beschreibung string `xml:"Beschreibung"`
Kurzbeschreibung string `xml:"Kurzbeschreibung"`
Name string `xml:"Name"`
Ust string `xml:"ust"`
}
type ProductsReturnErrorList struct {
XmlName xml.Name `xml:"ErrorList"`
Error []ProductsReturnError `xml:"Error"`
}
type ProductsReturnError struct {
XmlName xml.Name `xml:"Error"`
ErrorCode int `xml:"ErrorCode"`
ErrorDescription string `xml:"ErrorDescription"`
ErrorLongDescription string `xml:"ErrorLongDescription"`
}
// UpdateProductsBody is to send the body data
type UpdateProductsBody struct {
Request UpdateProductsRequest `xml:"Request"`
}
type UpdateProductsRequest struct {
AfterbuyGlobal AfterbuyGlobal `xml:"AfterbuyGlobal"`
Products UpdateProductsProducts `xml:"Products"`
}
type UpdateProductsProducts struct {
XmlName xml.Name `xml:"Products"`
Product []UpdateProductsProduct `xml:"Product"`
}
type UpdateProductsProduct struct {
XmlName xml.Name `xml:"Product"`
ProductIdent UpdateProductsProductIdent `xml:"ProductIdent"`
Quantity int `xml:"Quantity"`
AuctionQuantity int `xml:"AuctionQuantity"`
Stock int `xml:"Stock"`
SellingPrice string `xml:"SellingPrice"`
BuyingPrice string `xml:"BuyingPrice"`
DealerPrice string `xml:"DealerPrice"`
}
type UpdateProductsProductIdent struct {
XmlName xml.Name `xml:"ProductIdent"`
ProductInsert int `xml:"ProductInsert"`
ProductID int `xml:"ProductID"`
Anr int `xml:"Anr"`
EAN string `xml:"EAN"`
}
// UpdateProductsReturn is to decode the xml data
type UpdateProductsReturn struct {
XmlName xml.Name `xml:"Afterbuy"`
CallStatus string `xml:"CallStatus"`
CallName string `xml:"CallName"`
VersionID int `xml:"VersionID"`
Result UpdateProductsReturnResult `xml:"Result"`
}
type UpdateProductsReturnResult struct {
XmlName xml.Name `xml:"Result"`
WarningList UpdateProductsReturnWarningList `xml:"WarningList"`
}
type UpdateProductsReturnWarningList struct {
XmlName xml.Name `xml:"WarningList"`
Warning []UpdateProductsReturnWarning `xml:"Warning"`
}
type UpdateProductsReturnWarning struct {
XmlName xml.Name `xml:"Warning"`
WarningCode int `xml:"WarningCode"`
WarningDescription string `xml:"WarningDescription"`
WarningLongDescription string `xml:"WarningLongDescription"`
UserProductId string `xml:"UserProductId"`
}
// Products are to get all products from ab interface
func Products(body ProductsBody) (ProductsReturn, error) {
// Convert body
convert, err := xml.Marshal(body)
if err != nil {
return ProductsReturn{}, err
}
// Set config for request
c := Config{
BaseUrl: "https://api.afterbuy.de/afterbuy/ABInterface.aspx",
Method: "GET",
Body: bytes.NewBuffer(convert),
Header: map[string]string{},
}
// Add header to config
header := make(map[string]string)
header["Content-Type"] = "application/xml"
c.Header = header
// Send new request
response, err := c.Send()
if err != nil {
return ProductsReturn{}, err
}
// Close request body
defer response.Body.Close()
// Decode data
var decode ProductsReturn
err = xml.NewDecoder(response.Body).Decode(&decode)
if err != nil {
return ProductsReturn{}, err
}
// Return data
return decode, nil
}
// UpdateProducts are to update a product from ab interface
func UpdateProducts(body UpdateProductsBody) (UpdateProductsReturn, error) {
// Convert body
convert, err := xml.Marshal(body)
if err != nil {
return UpdateProductsReturn{}, err
}
// Set config for request
c := Config{
BaseUrl: "https://api.afterbuy.de/afterbuy/ABInterface.aspx",
Method: "GET",
Body: bytes.NewBuffer(convert),
Header: map[string]string{},
}
// Add header to config
header := make(map[string]string)
header["Content-Type"] = "application/xml"
c.Header = header
// Send new request
response, err := c.Send()
if err != nil {
return UpdateProductsReturn{}, err
}
// Close request body
defer response.Body.Close()
// Decode data
var decode UpdateProductsReturn
err = xml.NewDecoder(response.Body).Decode(&decode)
if err != nil {
return UpdateProductsReturn{}, err
}
// Return data
return decode, nil
}