-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbookings.go
1787 lines (1566 loc) · 56.7 KB
/
bookings.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 BulkRetrieveBookingsRequest struct {
// A non-empty list of [Booking](entity:Booking) IDs specifying bookings to retrieve.
BookingIDs []string `json:"booking_ids,omitempty" url:"-"`
}
type BulkRetrieveTeamMemberBookingProfilesRequest struct {
// A non-empty list of IDs of team members whose booking profiles you want to retrieve.
TeamMemberIDs []string `json:"team_member_ids,omitempty" url:"-"`
}
type RetrieveLocationBookingProfileRequest struct {
// The ID of the location to retrieve the booking profile.
LocationID string `json:"-" url:"-"`
}
type SearchAvailabilityRequest struct {
// Query conditions used to filter buyer-accessible booking availabilities.
Query *SearchAvailabilityQuery `json:"query,omitempty" url:"-"`
}
type CancelBookingRequest struct {
// The ID of the [Booking](entity:Booking) object representing the to-be-cancelled booking.
BookingID string `json:"-" url:"-"`
// A unique key to make this request an idempotent operation.
IdempotencyKey *string `json:"idempotency_key,omitempty" url:"-"`
// The revision number for the booking used for optimistic concurrency.
BookingVersion *int `json:"booking_version,omitempty" url:"-"`
}
type CreateBookingRequest struct {
// A unique key to make this request an idempotent operation.
IdempotencyKey *string `json:"idempotency_key,omitempty" url:"-"`
// The details of the booking to be created.
Booking *Booking `json:"booking,omitempty" url:"-"`
}
type BookingsGetRequest struct {
// The ID of the [Booking](entity:Booking) object representing the to-be-retrieved booking.
BookingID string `json:"-" url:"-"`
}
type BookingsListRequest struct {
// The maximum number of results per page to return in a paged response.
Limit *int `json:"-" url:"limit,omitempty"`
// The pagination cursor from the preceding response to return the next page of the results. Do not set this when retrieving the first page of the results.
Cursor *string `json:"-" url:"cursor,omitempty"`
// The [customer](entity:Customer) for whom to retrieve bookings. If this is not set, bookings for all customers are retrieved.
CustomerID *string `json:"-" url:"customer_id,omitempty"`
// The team member for whom to retrieve bookings. If this is not set, bookings of all members are retrieved.
TeamMemberID *string `json:"-" url:"team_member_id,omitempty"`
// The location for which to retrieve bookings. If this is not set, all locations' bookings are retrieved.
LocationID *string `json:"-" url:"location_id,omitempty"`
// The RFC 3339 timestamp specifying the earliest of the start time. If this is not set, the current time is used.
StartAtMin *string `json:"-" url:"start_at_min,omitempty"`
// The RFC 3339 timestamp specifying the latest of the start time. If this is not set, the time of 31 days after `start_at_min` is used.
StartAtMax *string `json:"-" url:"start_at_max,omitempty"`
}
// Defines an appointment segment of a booking.
type AppointmentSegment struct {
// The time span in minutes of an appointment segment.
DurationMinutes *int `json:"duration_minutes,omitempty" url:"duration_minutes,omitempty"`
// The ID of the [CatalogItemVariation](entity:CatalogItemVariation) object representing the service booked in this segment.
ServiceVariationID *string `json:"service_variation_id,omitempty" url:"service_variation_id,omitempty"`
// The ID of the [TeamMember](entity:TeamMember) object representing the team member booked in this segment.
TeamMemberID string `json:"team_member_id" url:"team_member_id"`
// The current version of the item variation representing the service booked in this segment.
ServiceVariationVersion *int64 `json:"service_variation_version,omitempty" url:"service_variation_version,omitempty"`
// Time between the end of this segment and the beginning of the subsequent segment.
IntermissionMinutes *int `json:"intermission_minutes,omitempty" url:"intermission_minutes,omitempty"`
// Whether the customer accepts any team member, instead of a specific one, to serve this segment.
AnyTeamMember *bool `json:"any_team_member,omitempty" url:"any_team_member,omitempty"`
// The IDs of the seller-accessible resources used for this appointment segment.
ResourceIDs []string `json:"resource_ids,omitempty" url:"resource_ids,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (a *AppointmentSegment) GetDurationMinutes() *int {
if a == nil {
return nil
}
return a.DurationMinutes
}
func (a *AppointmentSegment) GetServiceVariationID() *string {
if a == nil {
return nil
}
return a.ServiceVariationID
}
func (a *AppointmentSegment) GetTeamMemberID() string {
if a == nil {
return ""
}
return a.TeamMemberID
}
func (a *AppointmentSegment) GetServiceVariationVersion() *int64 {
if a == nil {
return nil
}
return a.ServiceVariationVersion
}
func (a *AppointmentSegment) GetIntermissionMinutes() *int {
if a == nil {
return nil
}
return a.IntermissionMinutes
}
func (a *AppointmentSegment) GetAnyTeamMember() *bool {
if a == nil {
return nil
}
return a.AnyTeamMember
}
func (a *AppointmentSegment) GetResourceIDs() []string {
if a == nil {
return nil
}
return a.ResourceIDs
}
func (a *AppointmentSegment) GetExtraProperties() map[string]interface{} {
return a.extraProperties
}
func (a *AppointmentSegment) UnmarshalJSON(data []byte) error {
type unmarshaler AppointmentSegment
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*a = AppointmentSegment(value)
extraProperties, err := internal.ExtractExtraProperties(data, *a)
if err != nil {
return err
}
a.extraProperties = extraProperties
a.rawJSON = json.RawMessage(data)
return nil
}
func (a *AppointmentSegment) String() string {
if len(a.rawJSON) > 0 {
if value, err := internal.StringifyJSON(a.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(a); err == nil {
return value
}
return fmt.Sprintf("%#v", a)
}
// Defines an appointment slot that encapsulates the appointment segments, location and starting time available for booking.
type Availability struct {
// The RFC 3339 timestamp specifying the beginning time of the slot available for booking.
StartAt *string `json:"start_at,omitempty" url:"start_at,omitempty"`
// The ID of the location available for booking.
LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"`
// The list of appointment segments available for booking
AppointmentSegments []*AppointmentSegment `json:"appointment_segments,omitempty" url:"appointment_segments,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (a *Availability) GetStartAt() *string {
if a == nil {
return nil
}
return a.StartAt
}
func (a *Availability) GetLocationID() *string {
if a == nil {
return nil
}
return a.LocationID
}
func (a *Availability) GetAppointmentSegments() []*AppointmentSegment {
if a == nil {
return nil
}
return a.AppointmentSegments
}
func (a *Availability) GetExtraProperties() map[string]interface{} {
return a.extraProperties
}
func (a *Availability) UnmarshalJSON(data []byte) error {
type unmarshaler Availability
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*a = Availability(value)
extraProperties, err := internal.ExtractExtraProperties(data, *a)
if err != nil {
return err
}
a.extraProperties = extraProperties
a.rawJSON = json.RawMessage(data)
return nil
}
func (a *Availability) String() string {
if len(a.rawJSON) > 0 {
if value, err := internal.StringifyJSON(a.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(a); err == nil {
return value
}
return fmt.Sprintf("%#v", a)
}
// Represents a booking as a time-bound service contract for a seller's staff member to provide a specified service
// at a given location to a requesting customer in one or more appointment segments.
type Booking struct {
// A unique ID of this object representing a booking.
ID *string `json:"id,omitempty" url:"id,omitempty"`
// The revision number for the booking used for optimistic concurrency.
Version *int `json:"version,omitempty" url:"version,omitempty"`
// The status of the booking, describing where the booking stands with respect to the booking state machine.
// See [BookingStatus](#type-bookingstatus) for possible values
Status *BookingStatus `json:"status,omitempty" url:"status,omitempty"`
// The RFC 3339 timestamp specifying the creation time of this booking.
CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"`
// The RFC 3339 timestamp specifying the most recent update time of this booking.
UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"`
// The RFC 3339 timestamp specifying the starting time of this booking.
StartAt *string `json:"start_at,omitempty" url:"start_at,omitempty"`
// The ID of the [Location](entity:Location) object representing the location where the booked service is provided. Once set when the booking is created, its value cannot be changed.
LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"`
// The ID of the [Customer](entity:Customer) object representing the customer receiving the booked service.
CustomerID *string `json:"customer_id,omitempty" url:"customer_id,omitempty"`
// The free-text field for the customer to supply notes about the booking. For example, the note can be preferences that cannot be expressed by supported attributes of a relevant [CatalogObject](entity:CatalogObject) instance.
CustomerNote *string `json:"customer_note,omitempty" url:"customer_note,omitempty"`
// The free-text field for the seller to supply notes about the booking. For example, the note can be preferences that cannot be expressed by supported attributes of a specific [CatalogObject](entity:CatalogObject) instance.
// This field should not be visible to customers.
SellerNote *string `json:"seller_note,omitempty" url:"seller_note,omitempty"`
// A list of appointment segments for this booking.
AppointmentSegments []*AppointmentSegment `json:"appointment_segments,omitempty" url:"appointment_segments,omitempty"`
// Additional time at the end of a booking.
// Applications should not make this field visible to customers of a seller.
TransitionTimeMinutes *int `json:"transition_time_minutes,omitempty" url:"transition_time_minutes,omitempty"`
// Whether the booking is of a full business day.
AllDay *bool `json:"all_day,omitempty" url:"all_day,omitempty"`
// The type of location where the booking is held.
// See [BusinessAppointmentSettingsBookingLocationType](#type-businessappointmentsettingsbookinglocationtype) for possible values
LocationType *BusinessAppointmentSettingsBookingLocationType `json:"location_type,omitempty" url:"location_type,omitempty"`
// Information about the booking creator.
CreatorDetails *BookingCreatorDetails `json:"creator_details,omitempty" url:"creator_details,omitempty"`
// The source of the booking.
// Access to this field requires seller-level permissions.
// See [BookingBookingSource](#type-bookingbookingsource) for possible values
Source *BookingBookingSource `json:"source,omitempty" url:"source,omitempty"`
// Stores a customer address if the location type is `CUSTOMER_LOCATION`.
Address *Address `json:"address,omitempty" url:"address,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (b *Booking) GetID() *string {
if b == nil {
return nil
}
return b.ID
}
func (b *Booking) GetVersion() *int {
if b == nil {
return nil
}
return b.Version
}
func (b *Booking) GetStatus() *BookingStatus {
if b == nil {
return nil
}
return b.Status
}
func (b *Booking) GetCreatedAt() *string {
if b == nil {
return nil
}
return b.CreatedAt
}
func (b *Booking) GetUpdatedAt() *string {
if b == nil {
return nil
}
return b.UpdatedAt
}
func (b *Booking) GetStartAt() *string {
if b == nil {
return nil
}
return b.StartAt
}
func (b *Booking) GetLocationID() *string {
if b == nil {
return nil
}
return b.LocationID
}
func (b *Booking) GetCustomerID() *string {
if b == nil {
return nil
}
return b.CustomerID
}
func (b *Booking) GetCustomerNote() *string {
if b == nil {
return nil
}
return b.CustomerNote
}
func (b *Booking) GetSellerNote() *string {
if b == nil {
return nil
}
return b.SellerNote
}
func (b *Booking) GetAppointmentSegments() []*AppointmentSegment {
if b == nil {
return nil
}
return b.AppointmentSegments
}
func (b *Booking) GetTransitionTimeMinutes() *int {
if b == nil {
return nil
}
return b.TransitionTimeMinutes
}
func (b *Booking) GetAllDay() *bool {
if b == nil {
return nil
}
return b.AllDay
}
func (b *Booking) GetLocationType() *BusinessAppointmentSettingsBookingLocationType {
if b == nil {
return nil
}
return b.LocationType
}
func (b *Booking) GetCreatorDetails() *BookingCreatorDetails {
if b == nil {
return nil
}
return b.CreatorDetails
}
func (b *Booking) GetSource() *BookingBookingSource {
if b == nil {
return nil
}
return b.Source
}
func (b *Booking) GetAddress() *Address {
if b == nil {
return nil
}
return b.Address
}
func (b *Booking) GetExtraProperties() map[string]interface{} {
return b.extraProperties
}
func (b *Booking) UnmarshalJSON(data []byte) error {
type unmarshaler Booking
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*b = Booking(value)
extraProperties, err := internal.ExtractExtraProperties(data, *b)
if err != nil {
return err
}
b.extraProperties = extraProperties
b.rawJSON = json.RawMessage(data)
return nil
}
func (b *Booking) 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)
}
// Supported sources a booking was created from.
type BookingBookingSource string
const (
BookingBookingSourceFirstPartyMerchant BookingBookingSource = "FIRST_PARTY_MERCHANT"
BookingBookingSourceFirstPartyBuyer BookingBookingSource = "FIRST_PARTY_BUYER"
BookingBookingSourceThirdPartyBuyer BookingBookingSource = "THIRD_PARTY_BUYER"
BookingBookingSourceAPI BookingBookingSource = "API"
)
func NewBookingBookingSourceFromString(s string) (BookingBookingSource, error) {
switch s {
case "FIRST_PARTY_MERCHANT":
return BookingBookingSourceFirstPartyMerchant, nil
case "FIRST_PARTY_BUYER":
return BookingBookingSourceFirstPartyBuyer, nil
case "THIRD_PARTY_BUYER":
return BookingBookingSourceThirdPartyBuyer, nil
case "API":
return BookingBookingSourceAPI, nil
}
var t BookingBookingSource
return "", fmt.Errorf("%s is not a valid %T", s, t)
}
func (b BookingBookingSource) Ptr() *BookingBookingSource {
return &b
}
// Information about a booking creator.
type BookingCreatorDetails struct {
// The seller-accessible type of the creator of the booking.
// See [BookingCreatorDetailsCreatorType](#type-bookingcreatordetailscreatortype) for possible values
CreatorType *BookingCreatorDetailsCreatorType `json:"creator_type,omitempty" url:"creator_type,omitempty"`
// The ID of the team member who created the booking, when the booking creator is of the `TEAM_MEMBER` type.
// Access to this field requires seller-level permissions.
TeamMemberID *string `json:"team_member_id,omitempty" url:"team_member_id,omitempty"`
// The ID of the customer who created the booking, when the booking creator is of the `CUSTOMER` type.
// Access to this field requires seller-level permissions.
CustomerID *string `json:"customer_id,omitempty" url:"customer_id,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (b *BookingCreatorDetails) GetCreatorType() *BookingCreatorDetailsCreatorType {
if b == nil {
return nil
}
return b.CreatorType
}
func (b *BookingCreatorDetails) GetTeamMemberID() *string {
if b == nil {
return nil
}
return b.TeamMemberID
}
func (b *BookingCreatorDetails) GetCustomerID() *string {
if b == nil {
return nil
}
return b.CustomerID
}
func (b *BookingCreatorDetails) GetExtraProperties() map[string]interface{} {
return b.extraProperties
}
func (b *BookingCreatorDetails) UnmarshalJSON(data []byte) error {
type unmarshaler BookingCreatorDetails
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*b = BookingCreatorDetails(value)
extraProperties, err := internal.ExtractExtraProperties(data, *b)
if err != nil {
return err
}
b.extraProperties = extraProperties
b.rawJSON = json.RawMessage(data)
return nil
}
func (b *BookingCreatorDetails) 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)
}
// Supported types of a booking creator.
type BookingCreatorDetailsCreatorType string
const (
BookingCreatorDetailsCreatorTypeTeamMember BookingCreatorDetailsCreatorType = "TEAM_MEMBER"
BookingCreatorDetailsCreatorTypeCustomer BookingCreatorDetailsCreatorType = "CUSTOMER"
)
func NewBookingCreatorDetailsCreatorTypeFromString(s string) (BookingCreatorDetailsCreatorType, error) {
switch s {
case "TEAM_MEMBER":
return BookingCreatorDetailsCreatorTypeTeamMember, nil
case "CUSTOMER":
return BookingCreatorDetailsCreatorTypeCustomer, nil
}
var t BookingCreatorDetailsCreatorType
return "", fmt.Errorf("%s is not a valid %T", s, t)
}
func (b BookingCreatorDetailsCreatorType) Ptr() *BookingCreatorDetailsCreatorType {
return &b
}
// Supported booking statuses.
type BookingStatus string
const (
BookingStatusPending BookingStatus = "PENDING"
BookingStatusCancelledByCustomer BookingStatus = "CANCELLED_BY_CUSTOMER"
BookingStatusCancelledBySeller BookingStatus = "CANCELLED_BY_SELLER"
BookingStatusDeclined BookingStatus = "DECLINED"
BookingStatusAccepted BookingStatus = "ACCEPTED"
BookingStatusNoShow BookingStatus = "NO_SHOW"
)
func NewBookingStatusFromString(s string) (BookingStatus, error) {
switch s {
case "PENDING":
return BookingStatusPending, nil
case "CANCELLED_BY_CUSTOMER":
return BookingStatusCancelledByCustomer, nil
case "CANCELLED_BY_SELLER":
return BookingStatusCancelledBySeller, nil
case "DECLINED":
return BookingStatusDeclined, nil
case "ACCEPTED":
return BookingStatusAccepted, nil
case "NO_SHOW":
return BookingStatusNoShow, nil
}
var t BookingStatus
return "", fmt.Errorf("%s is not a valid %T", s, t)
}
func (b BookingStatus) Ptr() *BookingStatus {
return &b
}
// Response payload for bulk retrieval of bookings.
type BulkRetrieveBookingsResponse struct {
// Requested bookings returned as a map containing `booking_id` as the key and `RetrieveBookingResponse` as the value.
Bookings map[string]*GetBookingResponse `json:"bookings,omitempty" url:"bookings,omitempty"`
// Errors that occurred during the request.
Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (b *BulkRetrieveBookingsResponse) GetBookings() map[string]*GetBookingResponse {
if b == nil {
return nil
}
return b.Bookings
}
func (b *BulkRetrieveBookingsResponse) GetErrors() []*Error {
if b == nil {
return nil
}
return b.Errors
}
func (b *BulkRetrieveBookingsResponse) GetExtraProperties() map[string]interface{} {
return b.extraProperties
}
func (b *BulkRetrieveBookingsResponse) UnmarshalJSON(data []byte) error {
type unmarshaler BulkRetrieveBookingsResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*b = BulkRetrieveBookingsResponse(value)
extraProperties, err := internal.ExtractExtraProperties(data, *b)
if err != nil {
return err
}
b.extraProperties = extraProperties
b.rawJSON = json.RawMessage(data)
return nil
}
func (b *BulkRetrieveBookingsResponse) 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)
}
// Response payload for the [BulkRetrieveTeamMemberBookingProfiles](api-endpoint:Bookings-BulkRetrieveTeamMemberBookingProfiles) endpoint.
type BulkRetrieveTeamMemberBookingProfilesResponse struct {
// The returned team members' booking profiles, as a map with `team_member_id` as the key and [TeamMemberBookingProfile](entity:TeamMemberBookingProfile) the value.
TeamMemberBookingProfiles map[string]*GetTeamMemberBookingProfileResponse `json:"team_member_booking_profiles,omitempty" url:"team_member_booking_profiles,omitempty"`
// Errors that occurred during the request.
Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (b *BulkRetrieveTeamMemberBookingProfilesResponse) GetTeamMemberBookingProfiles() map[string]*GetTeamMemberBookingProfileResponse {
if b == nil {
return nil
}
return b.TeamMemberBookingProfiles
}
func (b *BulkRetrieveTeamMemberBookingProfilesResponse) GetErrors() []*Error {
if b == nil {
return nil
}
return b.Errors
}
func (b *BulkRetrieveTeamMemberBookingProfilesResponse) GetExtraProperties() map[string]interface{} {
return b.extraProperties
}
func (b *BulkRetrieveTeamMemberBookingProfilesResponse) UnmarshalJSON(data []byte) error {
type unmarshaler BulkRetrieveTeamMemberBookingProfilesResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*b = BulkRetrieveTeamMemberBookingProfilesResponse(value)
extraProperties, err := internal.ExtractExtraProperties(data, *b)
if err != nil {
return err
}
b.extraProperties = extraProperties
b.rawJSON = json.RawMessage(data)
return nil
}
func (b *BulkRetrieveTeamMemberBookingProfilesResponse) 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)
}
// The service appointment settings, including where and how the service is provided.
type BusinessAppointmentSettings struct {
// Types of the location allowed for bookings.
// See [BusinessAppointmentSettingsBookingLocationType](#type-businessappointmentsettingsbookinglocationtype) for possible values
LocationTypes []BusinessAppointmentSettingsBookingLocationType `json:"location_types,omitempty" url:"location_types,omitempty"`
// The time unit of the service duration for bookings.
// See [BusinessAppointmentSettingsAlignmentTime](#type-businessappointmentsettingsalignmenttime) for possible values
AlignmentTime *BusinessAppointmentSettingsAlignmentTime `json:"alignment_time,omitempty" url:"alignment_time,omitempty"`
// The minimum lead time in seconds before a service can be booked. A booking must be created at least this amount of time before its starting time.
MinBookingLeadTimeSeconds *int `json:"min_booking_lead_time_seconds,omitempty" url:"min_booking_lead_time_seconds,omitempty"`
// The maximum lead time in seconds before a service can be booked. A booking must be created at most this amount of time before its starting time.
MaxBookingLeadTimeSeconds *int `json:"max_booking_lead_time_seconds,omitempty" url:"max_booking_lead_time_seconds,omitempty"`
// Indicates whether a customer can choose from all available time slots and have a staff member assigned
// automatically (`true`) or not (`false`).
AnyTeamMemberBookingEnabled *bool `json:"any_team_member_booking_enabled,omitempty" url:"any_team_member_booking_enabled,omitempty"`
// Indicates whether a customer can book multiple services in a single online booking.
MultipleServiceBookingEnabled *bool `json:"multiple_service_booking_enabled,omitempty" url:"multiple_service_booking_enabled,omitempty"`
// Indicates whether the daily appointment limit applies to team members or to
// business locations.
// See [BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType](#type-businessappointmentsettingsmaxappointmentsperdaylimittype) for possible values
MaxAppointmentsPerDayLimitType *BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType `json:"max_appointments_per_day_limit_type,omitempty" url:"max_appointments_per_day_limit_type,omitempty"`
// The maximum number of daily appointments per team member or per location.
MaxAppointmentsPerDayLimit *int `json:"max_appointments_per_day_limit,omitempty" url:"max_appointments_per_day_limit,omitempty"`
// The cut-off time in seconds for allowing clients to cancel or reschedule an appointment.
CancellationWindowSeconds *int `json:"cancellation_window_seconds,omitempty" url:"cancellation_window_seconds,omitempty"`
// The flat-fee amount charged for a no-show booking.
CancellationFeeMoney *Money `json:"cancellation_fee_money,omitempty" url:"cancellation_fee_money,omitempty"`
// The cancellation policy adopted by the seller.
// See [BusinessAppointmentSettingsCancellationPolicy](#type-businessappointmentsettingscancellationpolicy) for possible values
CancellationPolicy *BusinessAppointmentSettingsCancellationPolicy `json:"cancellation_policy,omitempty" url:"cancellation_policy,omitempty"`
// The free-form text of the seller's cancellation policy.
CancellationPolicyText *string `json:"cancellation_policy_text,omitempty" url:"cancellation_policy_text,omitempty"`
// Indicates whether customers has an assigned staff member (`true`) or can select s staff member of their choice (`false`).
SkipBookingFlowStaffSelection *bool `json:"skip_booking_flow_staff_selection,omitempty" url:"skip_booking_flow_staff_selection,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (b *BusinessAppointmentSettings) GetLocationTypes() []BusinessAppointmentSettingsBookingLocationType {
if b == nil {
return nil
}
return b.LocationTypes
}
func (b *BusinessAppointmentSettings) GetAlignmentTime() *BusinessAppointmentSettingsAlignmentTime {
if b == nil {
return nil
}
return b.AlignmentTime
}
func (b *BusinessAppointmentSettings) GetMinBookingLeadTimeSeconds() *int {
if b == nil {
return nil
}
return b.MinBookingLeadTimeSeconds
}
func (b *BusinessAppointmentSettings) GetMaxBookingLeadTimeSeconds() *int {
if b == nil {
return nil
}
return b.MaxBookingLeadTimeSeconds
}
func (b *BusinessAppointmentSettings) GetAnyTeamMemberBookingEnabled() *bool {
if b == nil {
return nil
}
return b.AnyTeamMemberBookingEnabled
}
func (b *BusinessAppointmentSettings) GetMultipleServiceBookingEnabled() *bool {
if b == nil {
return nil
}
return b.MultipleServiceBookingEnabled
}
func (b *BusinessAppointmentSettings) GetMaxAppointmentsPerDayLimitType() *BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType {
if b == nil {
return nil
}
return b.MaxAppointmentsPerDayLimitType
}
func (b *BusinessAppointmentSettings) GetMaxAppointmentsPerDayLimit() *int {
if b == nil {
return nil
}
return b.MaxAppointmentsPerDayLimit
}
func (b *BusinessAppointmentSettings) GetCancellationWindowSeconds() *int {
if b == nil {
return nil
}
return b.CancellationWindowSeconds
}
func (b *BusinessAppointmentSettings) GetCancellationFeeMoney() *Money {
if b == nil {
return nil
}
return b.CancellationFeeMoney
}
func (b *BusinessAppointmentSettings) GetCancellationPolicy() *BusinessAppointmentSettingsCancellationPolicy {
if b == nil {
return nil
}
return b.CancellationPolicy
}
func (b *BusinessAppointmentSettings) GetCancellationPolicyText() *string {
if b == nil {
return nil
}
return b.CancellationPolicyText
}
func (b *BusinessAppointmentSettings) GetSkipBookingFlowStaffSelection() *bool {
if b == nil {
return nil
}
return b.SkipBookingFlowStaffSelection
}
func (b *BusinessAppointmentSettings) GetExtraProperties() map[string]interface{} {
return b.extraProperties
}
func (b *BusinessAppointmentSettings) UnmarshalJSON(data []byte) error {
type unmarshaler BusinessAppointmentSettings
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*b = BusinessAppointmentSettings(value)
extraProperties, err := internal.ExtractExtraProperties(data, *b)
if err != nil {
return err
}
b.extraProperties = extraProperties
b.rawJSON = json.RawMessage(data)
return nil
}
func (b *BusinessAppointmentSettings) 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)
}
// Time units of a service duration for bookings.
type BusinessAppointmentSettingsAlignmentTime string
const (
BusinessAppointmentSettingsAlignmentTimeServiceDuration BusinessAppointmentSettingsAlignmentTime = "SERVICE_DURATION"
BusinessAppointmentSettingsAlignmentTimeQuarterHourly BusinessAppointmentSettingsAlignmentTime = "QUARTER_HOURLY"
BusinessAppointmentSettingsAlignmentTimeHalfHourly BusinessAppointmentSettingsAlignmentTime = "HALF_HOURLY"
BusinessAppointmentSettingsAlignmentTimeHourly BusinessAppointmentSettingsAlignmentTime = "HOURLY"
)
func NewBusinessAppointmentSettingsAlignmentTimeFromString(s string) (BusinessAppointmentSettingsAlignmentTime, error) {
switch s {
case "SERVICE_DURATION":
return BusinessAppointmentSettingsAlignmentTimeServiceDuration, nil
case "QUARTER_HOURLY":
return BusinessAppointmentSettingsAlignmentTimeQuarterHourly, nil
case "HALF_HOURLY":
return BusinessAppointmentSettingsAlignmentTimeHalfHourly, nil
case "HOURLY":
return BusinessAppointmentSettingsAlignmentTimeHourly, nil
}
var t BusinessAppointmentSettingsAlignmentTime
return "", fmt.Errorf("%s is not a valid %T", s, t)
}
func (b BusinessAppointmentSettingsAlignmentTime) Ptr() *BusinessAppointmentSettingsAlignmentTime {
return &b
}
// Supported types of location where service is provided.
type BusinessAppointmentSettingsBookingLocationType string
const (
BusinessAppointmentSettingsBookingLocationTypeBusinessLocation BusinessAppointmentSettingsBookingLocationType = "BUSINESS_LOCATION"
BusinessAppointmentSettingsBookingLocationTypeCustomerLocation BusinessAppointmentSettingsBookingLocationType = "CUSTOMER_LOCATION"
BusinessAppointmentSettingsBookingLocationTypePhone BusinessAppointmentSettingsBookingLocationType = "PHONE"
)
func NewBusinessAppointmentSettingsBookingLocationTypeFromString(s string) (BusinessAppointmentSettingsBookingLocationType, error) {
switch s {
case "BUSINESS_LOCATION":
return BusinessAppointmentSettingsBookingLocationTypeBusinessLocation, nil
case "CUSTOMER_LOCATION":
return BusinessAppointmentSettingsBookingLocationTypeCustomerLocation, nil
case "PHONE":
return BusinessAppointmentSettingsBookingLocationTypePhone, nil
}
var t BusinessAppointmentSettingsBookingLocationType
return "", fmt.Errorf("%s is not a valid %T", s, t)
}
func (b BusinessAppointmentSettingsBookingLocationType) Ptr() *BusinessAppointmentSettingsBookingLocationType {
return &b
}
// The category of the seller’s cancellation policy.
type BusinessAppointmentSettingsCancellationPolicy string
const (
BusinessAppointmentSettingsCancellationPolicyCancellationTreatedAsNoShow BusinessAppointmentSettingsCancellationPolicy = "CANCELLATION_TREATED_AS_NO_SHOW"
BusinessAppointmentSettingsCancellationPolicyCustomPolicy BusinessAppointmentSettingsCancellationPolicy = "CUSTOM_POLICY"
)
func NewBusinessAppointmentSettingsCancellationPolicyFromString(s string) (BusinessAppointmentSettingsCancellationPolicy, error) {
switch s {
case "CANCELLATION_TREATED_AS_NO_SHOW":
return BusinessAppointmentSettingsCancellationPolicyCancellationTreatedAsNoShow, nil
case "CUSTOM_POLICY":
return BusinessAppointmentSettingsCancellationPolicyCustomPolicy, nil
}
var t BusinessAppointmentSettingsCancellationPolicy
return "", fmt.Errorf("%s is not a valid %T", s, t)
}
func (b BusinessAppointmentSettingsCancellationPolicy) Ptr() *BusinessAppointmentSettingsCancellationPolicy {
return &b
}
// Types of daily appointment limits.
type BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType string
const (
BusinessAppointmentSettingsMaxAppointmentsPerDayLimitTypePerTeamMember BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType = "PER_TEAM_MEMBER"
BusinessAppointmentSettingsMaxAppointmentsPerDayLimitTypePerLocation BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType = "PER_LOCATION"
)
func NewBusinessAppointmentSettingsMaxAppointmentsPerDayLimitTypeFromString(s string) (BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType, error) {
switch s {
case "PER_TEAM_MEMBER":
return BusinessAppointmentSettingsMaxAppointmentsPerDayLimitTypePerTeamMember, nil
case "PER_LOCATION":
return BusinessAppointmentSettingsMaxAppointmentsPerDayLimitTypePerLocation, nil
}
var t BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType
return "", fmt.Errorf("%s is not a valid %T", s, t)
}
func (b BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType) Ptr() *BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType {
return &b
}
// A seller's business booking profile, including booking policy, appointment settings, etc.
type BusinessBookingProfile struct {
// The ID of the seller, obtainable using the Merchants API.
SellerID *string `json:"seller_id,omitempty" url:"seller_id,omitempty"`
// The RFC 3339 timestamp specifying the booking's creation time.
CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"`
// Indicates whether the seller is open for booking.
BookingEnabled *bool `json:"booking_enabled,omitempty" url:"booking_enabled,omitempty"`
// The choice of customer's time zone information of a booking.
// The Square online booking site and all notifications to customers uses either the seller location’s time zone
// or the time zone the customer chooses at booking.
// See [BusinessBookingProfileCustomerTimezoneChoice](#type-businessbookingprofilecustomertimezonechoice) for possible values
CustomerTimezoneChoice *BusinessBookingProfileCustomerTimezoneChoice `json:"customer_timezone_choice,omitempty" url:"customer_timezone_choice,omitempty"`
// The policy for the seller to automatically accept booking requests (`ACCEPT_ALL`) or not (`REQUIRES_ACCEPTANCE`).
// See [BusinessBookingProfileBookingPolicy](#type-businessbookingprofilebookingpolicy) for possible values
BookingPolicy *BusinessBookingProfileBookingPolicy `json:"booking_policy,omitempty" url:"booking_policy,omitempty"`
// Indicates whether customers can cancel or reschedule their own bookings (`true`) or not (`false`).
AllowUserCancel *bool `json:"allow_user_cancel,omitempty" url:"allow_user_cancel,omitempty"`
// Settings for appointment-type bookings.
BusinessAppointmentSettings *BusinessAppointmentSettings `json:"business_appointment_settings,omitempty" url:"business_appointment_settings,omitempty"`
// Indicates whether the seller's subscription to Square Appointments supports creating, updating or canceling an appointment through the API (`true`) or not (`false`) using seller permission.
SupportSellerLevelWrites *bool `json:"support_seller_level_writes,omitempty" url:"support_seller_level_writes,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (b *BusinessBookingProfile) GetSellerID() *string {
if b == nil {
return nil
}
return b.SellerID