-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinventory.go
1839 lines (1638 loc) · 55.5 KB
/
inventory.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
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// This file was auto-generated by Fern from our API Definition.
package square
import (
json "encoding/json"
fmt "fmt"
internal "github.com/square/square-go-sdk/internal"
)
type InventoryDeprecatedGetAdjustmentRequest struct {
// ID of the [InventoryAdjustment](entity:InventoryAdjustment) to retrieve.
AdjustmentID string `json:"-" url:"-"`
}
type InventoryChangesRequest struct {
// ID of the [CatalogObject](entity:CatalogObject) to retrieve.
CatalogObjectID string `json:"-" url:"-"`
// The [Location](entity:Location) IDs to look up as a comma-separated
// list. An empty list queries all locations.
LocationIDs *string `json:"-" url:"location_ids,omitempty"`
// A pagination cursor returned by a previous call to this endpoint.
// Provide this to retrieve the next set of results for the original query.
//
// See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
Cursor *string `json:"-" url:"cursor,omitempty"`
}
type InventoryDeprecatedGetPhysicalCountRequest struct {
// ID of the
// [InventoryPhysicalCount](entity:InventoryPhysicalCount) to retrieve.
PhysicalCountID string `json:"-" url:"-"`
}
type InventoryGetRequest struct {
// ID of the [CatalogObject](entity:CatalogObject) to retrieve.
CatalogObjectID string `json:"-" url:"-"`
// The [Location](entity:Location) IDs to look up as a comma-separated
// list. An empty list queries all locations.
LocationIDs *string `json:"-" url:"location_ids,omitempty"`
// A pagination cursor returned by a previous call to this endpoint.
// Provide this to retrieve the next set of results for the original query.
//
// See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
Cursor *string `json:"-" url:"cursor,omitempty"`
}
type InventoryGetAdjustmentRequest struct {
// ID of the [InventoryAdjustment](entity:InventoryAdjustment) to retrieve.
AdjustmentID string `json:"-" url:"-"`
}
type InventoryGetPhysicalCountRequest struct {
// ID of the
// [InventoryPhysicalCount](entity:InventoryPhysicalCount) to retrieve.
PhysicalCountID string `json:"-" url:"-"`
}
type InventoryGetTransferRequest struct {
// ID of the [InventoryTransfer](entity:InventoryTransfer) to retrieve.
TransferID string `json:"-" url:"-"`
}
type BatchChangeInventoryRequest struct {
// A client-supplied, universally unique identifier (UUID) for the
// request.
//
// See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the
// [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more
// information.
IdempotencyKey string `json:"idempotency_key" url:"idempotency_key"`
// The set of physical counts and inventory adjustments to be made.
// Changes are applied based on the client-supplied timestamp and may be sent
// out of order.
Changes []*InventoryChange `json:"changes,omitempty" url:"changes,omitempty"`
// Indicates whether the current physical count should be ignored if
// the quantity is unchanged since the last physical count. Default: `true`.
IgnoreUnchangedCounts *bool `json:"ignore_unchanged_counts,omitempty" url:"ignore_unchanged_counts,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (b *BatchChangeInventoryRequest) GetIdempotencyKey() string {
if b == nil {
return ""
}
return b.IdempotencyKey
}
func (b *BatchChangeInventoryRequest) GetChanges() []*InventoryChange {
if b == nil {
return nil
}
return b.Changes
}
func (b *BatchChangeInventoryRequest) GetIgnoreUnchangedCounts() *bool {
if b == nil {
return nil
}
return b.IgnoreUnchangedCounts
}
func (b *BatchChangeInventoryRequest) GetExtraProperties() map[string]interface{} {
return b.extraProperties
}
func (b *BatchChangeInventoryRequest) UnmarshalJSON(data []byte) error {
type unmarshaler BatchChangeInventoryRequest
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*b = BatchChangeInventoryRequest(value)
extraProperties, err := internal.ExtractExtraProperties(data, *b)
if err != nil {
return err
}
b.extraProperties = extraProperties
b.rawJSON = json.RawMessage(data)
return nil
}
func (b *BatchChangeInventoryRequest) String() string {
if len(b.rawJSON) > 0 {
if value, err := internal.StringifyJSON(b.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(b); err == nil {
return value
}
return fmt.Sprintf("%#v", b)
}
type BatchChangeInventoryResponse struct {
// Any errors that occurred during the request.
Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"`
// The current counts for all objects referenced in the request.
Counts []*InventoryCount `json:"counts,omitempty" url:"counts,omitempty"`
// Changes created for the request.
Changes []*InventoryChange `json:"changes,omitempty" url:"changes,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (b *BatchChangeInventoryResponse) GetErrors() []*Error {
if b == nil {
return nil
}
return b.Errors
}
func (b *BatchChangeInventoryResponse) GetCounts() []*InventoryCount {
if b == nil {
return nil
}
return b.Counts
}
func (b *BatchChangeInventoryResponse) GetChanges() []*InventoryChange {
if b == nil {
return nil
}
return b.Changes
}
func (b *BatchChangeInventoryResponse) GetExtraProperties() map[string]interface{} {
return b.extraProperties
}
func (b *BatchChangeInventoryResponse) UnmarshalJSON(data []byte) error {
type unmarshaler BatchChangeInventoryResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*b = BatchChangeInventoryResponse(value)
extraProperties, err := internal.ExtractExtraProperties(data, *b)
if err != nil {
return err
}
b.extraProperties = extraProperties
b.rawJSON = json.RawMessage(data)
return nil
}
func (b *BatchChangeInventoryResponse) String() string {
if len(b.rawJSON) > 0 {
if value, err := internal.StringifyJSON(b.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(b); err == nil {
return value
}
return fmt.Sprintf("%#v", b)
}
type BatchGetInventoryChangesResponse struct {
// Any errors that occurred during the request.
Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"`
// The current calculated inventory changes for the requested objects
// and locations.
Changes []*InventoryChange `json:"changes,omitempty" url:"changes,omitempty"`
// The pagination cursor to be used in a subsequent request. If unset,
// this is the final response.
// See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (b *BatchGetInventoryChangesResponse) GetErrors() []*Error {
if b == nil {
return nil
}
return b.Errors
}
func (b *BatchGetInventoryChangesResponse) GetChanges() []*InventoryChange {
if b == nil {
return nil
}
return b.Changes
}
func (b *BatchGetInventoryChangesResponse) GetCursor() *string {
if b == nil {
return nil
}
return b.Cursor
}
func (b *BatchGetInventoryChangesResponse) GetExtraProperties() map[string]interface{} {
return b.extraProperties
}
func (b *BatchGetInventoryChangesResponse) UnmarshalJSON(data []byte) error {
type unmarshaler BatchGetInventoryChangesResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*b = BatchGetInventoryChangesResponse(value)
extraProperties, err := internal.ExtractExtraProperties(data, *b)
if err != nil {
return err
}
b.extraProperties = extraProperties
b.rawJSON = json.RawMessage(data)
return nil
}
func (b *BatchGetInventoryChangesResponse) String() string {
if len(b.rawJSON) > 0 {
if value, err := internal.StringifyJSON(b.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(b); err == nil {
return value
}
return fmt.Sprintf("%#v", b)
}
type BatchGetInventoryCountsRequest struct {
// The filter to return results by `CatalogObject` ID.
// The filter is applicable only when set. The default is null.
CatalogObjectIDs []string `json:"catalog_object_ids,omitempty" url:"catalog_object_ids,omitempty"`
// The filter to return results by `Location` ID.
// This filter is applicable only when set. The default is null.
LocationIDs []string `json:"location_ids,omitempty" url:"location_ids,omitempty"`
// The filter to return results with their `calculated_at` value
// after the given time as specified in an RFC 3339 timestamp.
// The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
UpdatedAfter *string `json:"updated_after,omitempty" url:"updated_after,omitempty"`
// A pagination cursor returned by a previous call to this endpoint.
// Provide this to retrieve the next set of results for the original query.
//
// See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"`
// The filter to return results by `InventoryState`. The filter is only applicable when set.
// Ignored are untracked states of `NONE`, `SOLD`, and `UNLINKED_RETURN`.
// The default is null.
States []InventoryState `json:"states,omitempty" url:"states,omitempty"`
// The number of [records](entity:InventoryCount) to return.
Limit *int `json:"limit,omitempty" url:"limit,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (b *BatchGetInventoryCountsRequest) GetCatalogObjectIDs() []string {
if b == nil {
return nil
}
return b.CatalogObjectIDs
}
func (b *BatchGetInventoryCountsRequest) GetLocationIDs() []string {
if b == nil {
return nil
}
return b.LocationIDs
}
func (b *BatchGetInventoryCountsRequest) GetUpdatedAfter() *string {
if b == nil {
return nil
}
return b.UpdatedAfter
}
func (b *BatchGetInventoryCountsRequest) GetCursor() *string {
if b == nil {
return nil
}
return b.Cursor
}
func (b *BatchGetInventoryCountsRequest) GetStates() []InventoryState {
if b == nil {
return nil
}
return b.States
}
func (b *BatchGetInventoryCountsRequest) GetLimit() *int {
if b == nil {
return nil
}
return b.Limit
}
func (b *BatchGetInventoryCountsRequest) GetExtraProperties() map[string]interface{} {
return b.extraProperties
}
func (b *BatchGetInventoryCountsRequest) UnmarshalJSON(data []byte) error {
type unmarshaler BatchGetInventoryCountsRequest
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*b = BatchGetInventoryCountsRequest(value)
extraProperties, err := internal.ExtractExtraProperties(data, *b)
if err != nil {
return err
}
b.extraProperties = extraProperties
b.rawJSON = json.RawMessage(data)
return nil
}
func (b *BatchGetInventoryCountsRequest) String() string {
if len(b.rawJSON) > 0 {
if value, err := internal.StringifyJSON(b.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(b); err == nil {
return value
}
return fmt.Sprintf("%#v", b)
}
type BatchGetInventoryCountsResponse struct {
// Any errors that occurred during the request.
Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"`
// The current calculated inventory counts for the requested objects
// and locations.
Counts []*InventoryCount `json:"counts,omitempty" url:"counts,omitempty"`
// The pagination cursor to be used in a subsequent request. If unset,
// this is the final response.
//
// See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (b *BatchGetInventoryCountsResponse) GetErrors() []*Error {
if b == nil {
return nil
}
return b.Errors
}
func (b *BatchGetInventoryCountsResponse) GetCounts() []*InventoryCount {
if b == nil {
return nil
}
return b.Counts
}
func (b *BatchGetInventoryCountsResponse) GetCursor() *string {
if b == nil {
return nil
}
return b.Cursor
}
func (b *BatchGetInventoryCountsResponse) GetExtraProperties() map[string]interface{} {
return b.extraProperties
}
func (b *BatchGetInventoryCountsResponse) UnmarshalJSON(data []byte) error {
type unmarshaler BatchGetInventoryCountsResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*b = BatchGetInventoryCountsResponse(value)
extraProperties, err := internal.ExtractExtraProperties(data, *b)
if err != nil {
return err
}
b.extraProperties = extraProperties
b.rawJSON = json.RawMessage(data)
return nil
}
func (b *BatchGetInventoryCountsResponse) String() string {
if len(b.rawJSON) > 0 {
if value, err := internal.StringifyJSON(b.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(b); err == nil {
return value
}
return fmt.Sprintf("%#v", b)
}
type BatchRetrieveInventoryChangesRequest struct {
// The filter to return results by `CatalogObject` ID.
// The filter is only applicable when set. The default value is null.
CatalogObjectIDs []string `json:"catalog_object_ids,omitempty" url:"catalog_object_ids,omitempty"`
// The filter to return results by `Location` ID.
// The filter is only applicable when set. The default value is null.
LocationIDs []string `json:"location_ids,omitempty" url:"location_ids,omitempty"`
// The filter to return results by `InventoryChangeType` values other than `TRANSFER`.
// The default value is `[PHYSICAL_COUNT, ADJUSTMENT]`.
Types []InventoryChangeType `json:"types,omitempty" url:"types,omitempty"`
// The filter to return `ADJUSTMENT` query results by
// `InventoryState`. This filter is only applied when set.
// The default value is null.
States []InventoryState `json:"states,omitempty" url:"states,omitempty"`
// The filter to return results with their `calculated_at` value
// after the given time as specified in an RFC 3339 timestamp.
// The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
UpdatedAfter *string `json:"updated_after,omitempty" url:"updated_after,omitempty"`
// The filter to return results with their `created_at` or `calculated_at` value
// strictly before the given time as specified in an RFC 3339 timestamp.
// The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
UpdatedBefore *string `json:"updated_before,omitempty" url:"updated_before,omitempty"`
// A pagination cursor returned by a previous call to this endpoint.
// Provide this to retrieve the next set of results for the original query.
//
// See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"`
// The number of [records](entity:InventoryChange) to return.
Limit *int `json:"limit,omitempty" url:"limit,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (b *BatchRetrieveInventoryChangesRequest) GetCatalogObjectIDs() []string {
if b == nil {
return nil
}
return b.CatalogObjectIDs
}
func (b *BatchRetrieveInventoryChangesRequest) GetLocationIDs() []string {
if b == nil {
return nil
}
return b.LocationIDs
}
func (b *BatchRetrieveInventoryChangesRequest) GetTypes() []InventoryChangeType {
if b == nil {
return nil
}
return b.Types
}
func (b *BatchRetrieveInventoryChangesRequest) GetStates() []InventoryState {
if b == nil {
return nil
}
return b.States
}
func (b *BatchRetrieveInventoryChangesRequest) GetUpdatedAfter() *string {
if b == nil {
return nil
}
return b.UpdatedAfter
}
func (b *BatchRetrieveInventoryChangesRequest) GetUpdatedBefore() *string {
if b == nil {
return nil
}
return b.UpdatedBefore
}
func (b *BatchRetrieveInventoryChangesRequest) GetCursor() *string {
if b == nil {
return nil
}
return b.Cursor
}
func (b *BatchRetrieveInventoryChangesRequest) GetLimit() *int {
if b == nil {
return nil
}
return b.Limit
}
func (b *BatchRetrieveInventoryChangesRequest) GetExtraProperties() map[string]interface{} {
return b.extraProperties
}
func (b *BatchRetrieveInventoryChangesRequest) UnmarshalJSON(data []byte) error {
type unmarshaler BatchRetrieveInventoryChangesRequest
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*b = BatchRetrieveInventoryChangesRequest(value)
extraProperties, err := internal.ExtractExtraProperties(data, *b)
if err != nil {
return err
}
b.extraProperties = extraProperties
b.rawJSON = json.RawMessage(data)
return nil
}
func (b *BatchRetrieveInventoryChangesRequest) String() string {
if len(b.rawJSON) > 0 {
if value, err := internal.StringifyJSON(b.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(b); err == nil {
return value
}
return fmt.Sprintf("%#v", b)
}
type GetInventoryAdjustmentResponse struct {
// Any errors that occurred during the request.
Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"`
// The requested [InventoryAdjustment](entity:InventoryAdjustment).
Adjustment *InventoryAdjustment `json:"adjustment,omitempty" url:"adjustment,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (g *GetInventoryAdjustmentResponse) GetErrors() []*Error {
if g == nil {
return nil
}
return g.Errors
}
func (g *GetInventoryAdjustmentResponse) GetAdjustment() *InventoryAdjustment {
if g == nil {
return nil
}
return g.Adjustment
}
func (g *GetInventoryAdjustmentResponse) GetExtraProperties() map[string]interface{} {
return g.extraProperties
}
func (g *GetInventoryAdjustmentResponse) UnmarshalJSON(data []byte) error {
type unmarshaler GetInventoryAdjustmentResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*g = GetInventoryAdjustmentResponse(value)
extraProperties, err := internal.ExtractExtraProperties(data, *g)
if err != nil {
return err
}
g.extraProperties = extraProperties
g.rawJSON = json.RawMessage(data)
return nil
}
func (g *GetInventoryAdjustmentResponse) String() string {
if len(g.rawJSON) > 0 {
if value, err := internal.StringifyJSON(g.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(g); err == nil {
return value
}
return fmt.Sprintf("%#v", g)
}
type GetInventoryChangesResponse struct {
// Any errors that occurred during the request.
Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"`
// The set of inventory changes for the requested object and locations.
Changes []*InventoryChange `json:"changes,omitempty" url:"changes,omitempty"`
// The pagination cursor to be used in a subsequent request. If unset,
// this is the final response.
//
// See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (g *GetInventoryChangesResponse) GetErrors() []*Error {
if g == nil {
return nil
}
return g.Errors
}
func (g *GetInventoryChangesResponse) GetChanges() []*InventoryChange {
if g == nil {
return nil
}
return g.Changes
}
func (g *GetInventoryChangesResponse) GetCursor() *string {
if g == nil {
return nil
}
return g.Cursor
}
func (g *GetInventoryChangesResponse) GetExtraProperties() map[string]interface{} {
return g.extraProperties
}
func (g *GetInventoryChangesResponse) UnmarshalJSON(data []byte) error {
type unmarshaler GetInventoryChangesResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*g = GetInventoryChangesResponse(value)
extraProperties, err := internal.ExtractExtraProperties(data, *g)
if err != nil {
return err
}
g.extraProperties = extraProperties
g.rawJSON = json.RawMessage(data)
return nil
}
func (g *GetInventoryChangesResponse) String() string {
if len(g.rawJSON) > 0 {
if value, err := internal.StringifyJSON(g.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(g); err == nil {
return value
}
return fmt.Sprintf("%#v", g)
}
type GetInventoryCountResponse struct {
// Any errors that occurred during the request.
Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"`
// The current calculated inventory counts for the requested object and
// locations.
Counts []*InventoryCount `json:"counts,omitempty" url:"counts,omitempty"`
// The pagination cursor to be used in a subsequent request. If unset,
// this is the final response.
//
// See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (g *GetInventoryCountResponse) GetErrors() []*Error {
if g == nil {
return nil
}
return g.Errors
}
func (g *GetInventoryCountResponse) GetCounts() []*InventoryCount {
if g == nil {
return nil
}
return g.Counts
}
func (g *GetInventoryCountResponse) GetCursor() *string {
if g == nil {
return nil
}
return g.Cursor
}
func (g *GetInventoryCountResponse) GetExtraProperties() map[string]interface{} {
return g.extraProperties
}
func (g *GetInventoryCountResponse) UnmarshalJSON(data []byte) error {
type unmarshaler GetInventoryCountResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*g = GetInventoryCountResponse(value)
extraProperties, err := internal.ExtractExtraProperties(data, *g)
if err != nil {
return err
}
g.extraProperties = extraProperties
g.rawJSON = json.RawMessage(data)
return nil
}
func (g *GetInventoryCountResponse) String() string {
if len(g.rawJSON) > 0 {
if value, err := internal.StringifyJSON(g.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(g); err == nil {
return value
}
return fmt.Sprintf("%#v", g)
}
type GetInventoryPhysicalCountResponse struct {
// Any errors that occurred during the request.
Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"`
// The requested [InventoryPhysicalCount](entity:InventoryPhysicalCount).
Count *InventoryPhysicalCount `json:"count,omitempty" url:"count,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (g *GetInventoryPhysicalCountResponse) GetErrors() []*Error {
if g == nil {
return nil
}
return g.Errors
}
func (g *GetInventoryPhysicalCountResponse) GetCount() *InventoryPhysicalCount {
if g == nil {
return nil
}
return g.Count
}
func (g *GetInventoryPhysicalCountResponse) GetExtraProperties() map[string]interface{} {
return g.extraProperties
}
func (g *GetInventoryPhysicalCountResponse) UnmarshalJSON(data []byte) error {
type unmarshaler GetInventoryPhysicalCountResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*g = GetInventoryPhysicalCountResponse(value)
extraProperties, err := internal.ExtractExtraProperties(data, *g)
if err != nil {
return err
}
g.extraProperties = extraProperties
g.rawJSON = json.RawMessage(data)
return nil
}
func (g *GetInventoryPhysicalCountResponse) String() string {
if len(g.rawJSON) > 0 {
if value, err := internal.StringifyJSON(g.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(g); err == nil {
return value
}
return fmt.Sprintf("%#v", g)
}
type GetInventoryTransferResponse struct {
// Any errors that occurred during the request.
Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"`
// The requested [InventoryTransfer](entity:InventoryTransfer).
Transfer *InventoryTransfer `json:"transfer,omitempty" url:"transfer,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (g *GetInventoryTransferResponse) GetErrors() []*Error {
if g == nil {
return nil
}
return g.Errors
}
func (g *GetInventoryTransferResponse) GetTransfer() *InventoryTransfer {
if g == nil {
return nil
}
return g.Transfer
}
func (g *GetInventoryTransferResponse) GetExtraProperties() map[string]interface{} {
return g.extraProperties
}
func (g *GetInventoryTransferResponse) UnmarshalJSON(data []byte) error {
type unmarshaler GetInventoryTransferResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*g = GetInventoryTransferResponse(value)
extraProperties, err := internal.ExtractExtraProperties(data, *g)
if err != nil {
return err
}
g.extraProperties = extraProperties
g.rawJSON = json.RawMessage(data)
return nil
}
func (g *GetInventoryTransferResponse) String() string {
if len(g.rawJSON) > 0 {
if value, err := internal.StringifyJSON(g.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(g); err == nil {
return value
}
return fmt.Sprintf("%#v", g)
}
// Represents a change in state or quantity of product inventory at a
// particular time and location.
type InventoryAdjustment struct {
// A unique ID generated by Square for the
// `InventoryAdjustment`.
ID *string `json:"id,omitempty" url:"id,omitempty"`
// An optional ID provided by the application to tie the
// `InventoryAdjustment` to an external
// system.
ReferenceID *string `json:"reference_id,omitempty" url:"reference_id,omitempty"`
// The [inventory state](entity:InventoryState) of the related quantity
// of items before the adjustment.
// See [InventoryState](#type-inventorystate) for possible values
FromState *InventoryState `json:"from_state,omitempty" url:"from_state,omitempty"`
// The [inventory state](entity:InventoryState) of the related quantity
// of items after the adjustment.
// See [InventoryState](#type-inventorystate) for possible values
ToState *InventoryState `json:"to_state,omitempty" url:"to_state,omitempty"`
// The Square-generated ID of the [Location](entity:Location) where the related
// quantity of items is being tracked.
LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"`
// The Square-generated ID of the
// [CatalogObject](entity:CatalogObject) being tracked.
CatalogObjectID *string `json:"catalog_object_id,omitempty" url:"catalog_object_id,omitempty"`
// The [type](entity:CatalogObjectType) of the [CatalogObject](entity:CatalogObject) being tracked.
//
// The Inventory API supports setting and reading the `"catalog_object_type": "ITEM_VARIATION"` field value.
// In addition, it can also read the `"catalog_object_type": "ITEM"` field value that is set by the Square Restaurants app.
CatalogObjectType *string `json:"catalog_object_type,omitempty" url:"catalog_object_type,omitempty"`
// The number of items affected by the adjustment as a decimal string.
// Can support up to 5 digits after the decimal point.
Quantity *string `json:"quantity,omitempty" url:"quantity,omitempty"`
// The total price paid for goods associated with the
// adjustment. Present if and only if `to_state` is `SOLD`. Always
// non-negative.
TotalPriceMoney *Money `json:"total_price_money,omitempty" url:"total_price_money,omitempty"`
// A client-generated RFC 3339-formatted timestamp that indicates when
// the inventory adjustment took place. For inventory adjustment updates, the `occurred_at`
// timestamp cannot be older than 24 hours or in the future relative to the
// time of the request.
OccurredAt *string `json:"occurred_at,omitempty" url:"occurred_at,omitempty"`
// An RFC 3339-formatted timestamp that indicates when the inventory adjustment is received.
CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"`
// Information about the application that caused the
// inventory adjustment.
Source *SourceApplication `json:"source,omitempty" url:"source,omitempty"`
// The Square-generated ID of the [Employee](entity:Employee) responsible for the
// inventory adjustment.
EmployeeID *string `json:"employee_id,omitempty" url:"employee_id,omitempty"`
// The Square-generated ID of the [Team Member](entity:TeamMember) responsible for the
// inventory adjustment.
TeamMemberID *string `json:"team_member_id,omitempty" url:"team_member_id,omitempty"`
// The Square-generated ID of the [Transaction](entity:Transaction) that
// caused the adjustment. Only relevant for payment-related state
// transitions.
TransactionID *string `json:"transaction_id,omitempty" url:"transaction_id,omitempty"`
// The Square-generated ID of the [Refund](entity:Refund) that
// caused the adjustment. Only relevant for refund-related state
// transitions.
RefundID *string `json:"refund_id,omitempty" url:"refund_id,omitempty"`
// The Square-generated ID of the purchase order that caused the
// adjustment. Only relevant for state transitions from the Square for Retail
// app.
PurchaseOrderID *string `json:"purchase_order_id,omitempty" url:"purchase_order_id,omitempty"`
// The Square-generated ID of the goods receipt that caused the
// adjustment. Only relevant for state transitions from the Square for Retail
// app.
GoodsReceiptID *string `json:"goods_receipt_id,omitempty" url:"goods_receipt_id,omitempty"`
// An adjustment group bundling the related adjustments of item variations through stock conversions in a single inventory event.
AdjustmentGroup *InventoryAdjustmentGroup `json:"adjustment_group,omitempty" url:"adjustment_group,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (i *InventoryAdjustment) GetID() *string {
if i == nil {
return nil
}
return i.ID
}
func (i *InventoryAdjustment) GetReferenceID() *string {
if i == nil {
return nil
}
return i.ReferenceID
}
func (i *InventoryAdjustment) GetFromState() *InventoryState {
if i == nil {
return nil
}
return i.FromState
}
func (i *InventoryAdjustment) GetToState() *InventoryState {
if i == nil {
return nil
}
return i.ToState
}
func (i *InventoryAdjustment) GetLocationID() *string {
if i == nil {
return nil
}
return i.LocationID
}
func (i *InventoryAdjustment) GetCatalogObjectID() *string {
if i == nil {
return nil
}
return i.CatalogObjectID
}
func (i *InventoryAdjustment) GetCatalogObjectType() *string {
if i == nil {
return nil
}
return i.CatalogObjectType
}
func (i *InventoryAdjustment) GetQuantity() *string {
if i == nil {
return nil
}
return i.Quantity
}
func (i *InventoryAdjustment) GetTotalPriceMoney() *Money {
if i == nil {
return nil