diff --git a/applepay/client.go b/applepay/client.go index 13b4f52..9ed8c60 100644 --- a/applepay/client.go +++ b/applepay/client.go @@ -4,12 +4,11 @@ package applepay import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { diff --git a/bankaccounts/client.go b/bankaccounts/client.go index bd09dae..5fda439 100644 --- a/bankaccounts/client.go +++ b/bankaccounts/client.go @@ -5,12 +5,11 @@ package bankaccounts import ( context "context" fmt "fmt" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { @@ -39,7 +38,7 @@ func NewClient(opts ...option.RequestOption) *Client { } } -// Returns a list of [BankAccount]($m/BankAccount) objects linked to a Square account. +// Returns a list of [BankAccount](entity:BankAccount) objects linked to a Square account. func (c *Client) List( ctx context.Context, request *squaregosdk.BankAccountsListRequest, @@ -98,7 +97,7 @@ func (c *Client) List( return pager.GetPage(ctx, request.Cursor) } -// Returns details of a [BankAccount]($m/BankAccount) identified by V1 bank account ID. +// Returns details of a [BankAccount](entity:BankAccount) identified by V1 bank account ID. func (c *Client) GetByV1ID( ctx context.Context, // Connect V1 ID of the desired `BankAccount`. For more information, see @@ -138,7 +137,7 @@ func (c *Client) GetByV1ID( return response, nil } -// Returns details of a [BankAccount]($m/BankAccount) +// Returns details of a [BankAccount](entity:BankAccount) // linked to a Square account. func (c *Client) Get( ctx context.Context, diff --git a/bookingcustomattributes/client.go b/bookingcustomattributes/client.go index d067827..e8318dc 100644 --- a/bookingcustomattributes/client.go +++ b/bookingcustomattributes/client.go @@ -4,12 +4,11 @@ package bookingcustomattributes import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { diff --git a/bookings/client/client.go b/bookings/client/client.go index dc5501e..129c6b8 100644 --- a/bookings/client/client.go +++ b/bookings/client/client.go @@ -5,13 +5,12 @@ package client import ( context "context" fmt "fmt" + squaregosdk "github.com/square/square-go-sdk" + teammemberprofiles "github.com/square/square-go-sdk/bookings/teammemberprofiles" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - teammemberprofiles "github.com/fern-demo/square-go-sdk/bookings/teammemberprofiles" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { diff --git a/bookings/teammemberprofiles/client.go b/bookings/teammemberprofiles/client.go index d077fc5..c2da343 100644 --- a/bookings/teammemberprofiles/client.go +++ b/bookings/teammemberprofiles/client.go @@ -5,13 +5,12 @@ package teammemberprofiles import ( context "context" fmt "fmt" + squaregosdk "github.com/square/square-go-sdk" + bookings "github.com/square/square-go-sdk/bookings" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - bookings "github.com/fern-demo/square-go-sdk/bookings" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { diff --git a/cards.go b/cards.go index 24bb2b8..dd5fe7f 100644 --- a/cards.go +++ b/cards.go @@ -22,6 +22,9 @@ type CreateCardRequest struct { Card *Card `json:"card,omitempty" url:"-"` } +type DisableCardRequest struct { +} + type CardsListRequest struct { // A pagination cursor returned by a previous call to this endpoint. // Provide this to retrieve the next set of results for your original query. diff --git a/cards/client.go b/cards/client.go index a6eb1ee..c038035 100644 --- a/cards/client.go +++ b/cards/client.go @@ -5,12 +5,11 @@ package cards import ( context "context" fmt "fmt" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { @@ -183,6 +182,7 @@ func (c *Client) Disable( ctx context.Context, // Unique ID for the desired Card. cardID string, + request *squaregosdk.DisableCardRequest, opts ...option.RequestOption, ) (*squaregosdk.DisableCardResponse, error) { options := core.NewRequestOptions(opts...) @@ -209,6 +209,7 @@ func (c *Client) Disable( BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, + Request: request, Response: &response, }, ); err != nil { diff --git a/cashdrawers/client/client.go b/cashdrawers/client/client.go index eccf60c..9ccffeb 100644 --- a/cashdrawers/client/client.go +++ b/cashdrawers/client/client.go @@ -3,12 +3,11 @@ package client import ( + shifts "github.com/square/square-go-sdk/cashdrawers/shifts" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - shifts "github.com/fern-demo/square-go-sdk/cashdrawers/shifts" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { diff --git a/cashdrawers/shifts.go b/cashdrawers/shifts.go index c513532..8099089 100644 --- a/cashdrawers/shifts.go +++ b/cashdrawers/shifts.go @@ -3,7 +3,7 @@ package cashdrawers import ( - squaregosdk "github.com/fern-demo/square-go-sdk" + squaregosdk "github.com/square/square-go-sdk" ) type ShiftsGetRequest struct { diff --git a/cashdrawers/shifts/client.go b/cashdrawers/shifts/client.go index ec93674..634e2b4 100644 --- a/cashdrawers/shifts/client.go +++ b/cashdrawers/shifts/client.go @@ -5,13 +5,12 @@ package shifts import ( context "context" fmt "fmt" + squaregosdk "github.com/square/square-go-sdk" + cashdrawers "github.com/square/square-go-sdk/cashdrawers" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - cashdrawers "github.com/fern-demo/square-go-sdk/cashdrawers" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { @@ -86,7 +85,7 @@ func (c *Client) List( } readPageResponse := func(response *squaregosdk.ListCashDrawerShiftsResponse) *core.PageResponse[*string, *squaregosdk.CashDrawerShiftSummary] { next := response.Cursor - results := response.CashDrawerShifts + results := response.Items return &core.PageResponse[*string, *squaregosdk.CashDrawerShiftSummary]{ Next: next, Results: results, @@ -101,7 +100,7 @@ func (c *Client) List( } // Provides the summary details for a single cash drawer shift. See -// [ListCashDrawerShiftEvents]($e/CashDrawers/ListCashDrawerShiftEvents) for a list of cash drawer shift events. +// [ListCashDrawerShiftEvents](api-endpoint:CashDrawers-ListCashDrawerShiftEvents) for a list of cash drawer shift events. func (c *Client) Get( ctx context.Context, // The shift ID. @@ -196,7 +195,7 @@ func (c *Client) ListEvents( } readPageResponse := func(response *squaregosdk.ListCashDrawerShiftEventsResponse) *core.PageResponse[*string, *squaregosdk.CashDrawerShiftEvent] { next := response.Cursor - results := response.CashDrawerShiftEvents + results := response.Events return &core.PageResponse[*string, *squaregosdk.CashDrawerShiftEvent]{ Next: next, Results: results, diff --git a/catalog.go b/catalog.go index d6f3421..9ff867c 100644 --- a/catalog.go +++ b/catalog.go @@ -81,7 +81,7 @@ type BatchGetCatalogObjectsRequest struct { IncludeRelatedObjects *bool `json:"include_related_objects,omitempty" url:"-"` // The specific version of the catalog objects to be included in the response. // This allows you to retrieve historical versions of objects. The specified version value is matched against - // the [CatalogObject]($m/CatalogObject)s' `version` attribute. If not included, results will + // the [CatalogObject](entity:CatalogObject)s' `version` attribute. If not included, results will // be from the current version of the catalog. CatalogVersion *int64 `json:"catalog_version,omitempty" url:"-"` // Indicates whether to include (`true`) or not (`false`) in the response deleted objects, namely, those with the `is_deleted` attribute set to `true`. @@ -150,7 +150,7 @@ type CatalogListRequest struct { Types *string `json:"-" url:"types,omitempty"` // The specific version of the catalog objects to be included in the response. // This allows you to retrieve historical versions of objects. The specified version value is matched against - // the [CatalogObject]($m/CatalogObject)s' `version` attribute. If not included, results will be from the + // the [CatalogObject](entity:CatalogObject)s' `version` attribute. If not included, results will be from the // current version of the catalog. CatalogVersion *int64 `json:"-" url:"catalog_version,omitempty"` } diff --git a/catalog/client/client.go b/catalog/client/client.go index 6fd9a00..3988ba5 100644 --- a/catalog/client/client.go +++ b/catalog/client/client.go @@ -5,14 +5,13 @@ package client import ( context "context" fmt "fmt" + squaregosdk "github.com/square/square-go-sdk" + images "github.com/square/square-go-sdk/catalog/images" + object "github.com/square/square-go-sdk/catalog/object" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - images "github.com/fern-demo/square-go-sdk/catalog/images" - object "github.com/fern-demo/square-go-sdk/catalog/object" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { @@ -46,11 +45,11 @@ func NewClient(opts ...option.RequestOption) *Client { } } -// Deletes a set of [CatalogItem]($m/CatalogItem)s based on the +// Deletes a set of [CatalogItem](entity:CatalogItem)s based on the // provided list of target IDs and returns a set of successfully deleted IDs in // the response. Deletion is a cascading event such that all children of the // targeted object are also deleted. For example, deleting a CatalogItem will -// also delete all of its [CatalogItemVariation]($m/CatalogItemVariation) +// also delete all of its [CatalogItemVariation](entity:CatalogItemVariation) // children. // // `BatchDeleteCatalogObjects` succeeds even if only a portion of the targeted @@ -99,11 +98,11 @@ func (c *Client) BatchDelete( } // Returns a set of objects based on the provided ID. -// Each [CatalogItem]($m/CatalogItem) returned in the set includes all of its +// Each [CatalogItem](entity:CatalogItem) returned in the set includes all of its // child information including: all of its -// [CatalogItemVariation]($m/CatalogItemVariation) objects, references to -// its [CatalogModifierList]($m/CatalogModifierList) objects, and the ids of -// any [CatalogTax]($m/CatalogTax) objects that apply to it. +// [CatalogItemVariation](entity:CatalogItemVariation) objects, references to +// its [CatalogModifierList](entity:CatalogModifierList) objects, and the ids of +// any [CatalogTax](entity:CatalogTax) objects that apply to it. func (c *Client) BatchGet( ctx context.Context, request *squaregosdk.BatchGetCatalogObjectsRequest, @@ -231,13 +230,13 @@ func (c *Client) Info( return response, nil } -// Returns a list of all [CatalogObject]($m/CatalogObject)s of the specified types in the catalog. +// Returns a list of all [CatalogObject](entity:CatalogObject)s of the specified types in the catalog. // -// The `types` parameter is specified as a comma-separated list of the [CatalogObjectType]($m/CatalogObjectType) values, +// The `types` parameter is specified as a comma-separated list of the [CatalogObjectType](entity:CatalogObjectType) values, // for example, "`ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, `CATEGORY`, `DISCOUNT`, `TAX`, `IMAGE`". // // **Important:** ListCatalog does not return deleted catalog items. To retrieve -// deleted catalog items, use [SearchCatalogObjects]($e/Catalog/SearchCatalogObjects) +// deleted catalog items, use [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects) // and set the `include_deleted_objects` attribute value to `true`. func (c *Client) List( ctx context.Context, @@ -297,10 +296,10 @@ func (c *Client) List( return pager.GetPage(ctx, request.Cursor) } -// Searches for [CatalogObject]($m/CatalogObject) of any type by matching supported search attribute values, +// Searches for [CatalogObject](entity:CatalogObject) of any type by matching supported search attribute values, // excluding custom attribute values on items or item variations, against one or more of the specified query filters. // -// This (`SearchCatalogObjects`) endpoint differs from the [SearchCatalogItems]($e/Catalog/SearchCatalogItems) +// This (`SearchCatalogObjects`) endpoint differs from the [SearchCatalogItems](api-endpoint:Catalog-SearchCatalogItems) // endpoint in the following aspects: // // - `SearchCatalogItems` can only search for items or item variations, whereas `SearchCatalogObjects` can search for any type of catalog objects. @@ -348,7 +347,7 @@ func (c *Client) Search( // Searches for catalog items or item variations by matching supported search attribute values, including // custom attribute values, against one or more of the specified query filters. // -// This (`SearchCatalogItems`) endpoint differs from the [SearchCatalogObjects]($e/Catalog/SearchCatalogObjects) +// This (`SearchCatalogItems`) endpoint differs from the [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects) // endpoint in the following aspects: // // - `SearchCatalogItems` can only search for items or item variations, whereas `SearchCatalogObjects` can search for any type of catalog objects. @@ -393,8 +392,8 @@ func (c *Client) SearchItems( return response, nil } -// Updates the [CatalogModifierList]($m/CatalogModifierList) objects -// that apply to the targeted [CatalogItem]($m/CatalogItem) without having +// Updates the [CatalogModifierList](entity:CatalogModifierList) objects +// that apply to the targeted [CatalogItem](entity:CatalogItem) without having // to perform an upsert on the entire item. func (c *Client) UpdateItemModifierLists( ctx context.Context, @@ -434,8 +433,8 @@ func (c *Client) UpdateItemModifierLists( return response, nil } -// Updates the [CatalogTax]($m/CatalogTax) objects that apply to the -// targeted [CatalogItem]($m/CatalogItem) without having to perform an +// Updates the [CatalogTax](entity:CatalogTax) objects that apply to the +// targeted [CatalogItem](entity:CatalogItem) without having to perform an // upsert on the entire item. func (c *Client) UpdateItemTaxes( ctx context.Context, diff --git a/catalog/images.go b/catalog/images.go index 39e7d59..e64954d 100644 --- a/catalog/images.go +++ b/catalog/images.go @@ -3,7 +3,7 @@ package catalog import ( - squaregosdk "github.com/fern-demo/square-go-sdk" + squaregosdk "github.com/square/square-go-sdk" ) type ImagesCreateRequest struct { diff --git a/catalog/images/client.go b/catalog/images/client.go index bad3112..0ab9bb6 100644 --- a/catalog/images/client.go +++ b/catalog/images/client.go @@ -5,17 +5,14 @@ package images import ( bytes "bytes" context "context" - "fmt" + squaregosdk "github.com/square/square-go-sdk" + catalog "github.com/square/square-go-sdk/catalog" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" io "io" multipart "mime/multipart" http "net/http" - "net/textproto" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - catalog "github.com/fern-demo/square-go-sdk/catalog" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { @@ -44,8 +41,8 @@ func NewClient(opts ...option.RequestOption) *Client { } } -// Uploads an image file to be represented by a [CatalogImage]($m/CatalogImage) object that can be linked to an existing -// [CatalogObject]($m/CatalogObject) instance. The resulting `CatalogImage` is unattached to any `CatalogObject` if the `object_id` +// Uploads an image file to be represented by a [CatalogImage](entity:CatalogImage) object that can be linked to an existing +// [CatalogObject](entity:CatalogObject) instance. The resulting `CatalogImage` is unattached to any `CatalogObject` if the `object_id` // is not specified. // // This `CreateCatalogImage` endpoint accepts HTTP multipart/form-data requests with a JSON part and an image file part in @@ -73,11 +70,11 @@ func (c *Client) Create( requestBuffer := bytes.NewBuffer(nil) writer := multipart.NewWriter(requestBuffer) if imageFile != nil { - h := make(textproto.MIMEHeader) - h.Set("Content-Disposition", - fmt.Sprintf(`form-data; name="imageFile"; filename="imageFile_filename"`)) - h.Set("Content-Type", "image/jpeg") - imageFilePart, err := writer.CreatePart(h) + imageFileFilename := "imageFile_filename" + if named, ok := imageFile.(interface{ Name() string }); ok { + imageFileFilename = named.Name() + } + imageFilePart, err := writer.CreateFormFile("image_file", imageFileFilename) if err != nil { return nil, err } @@ -114,7 +111,7 @@ func (c *Client) Create( return response, nil } -// Uploads a new image file to replace the existing one in the specified [CatalogImage]($m/CatalogImage) object. +// Uploads a new image file to replace the existing one in the specified [CatalogImage](entity:CatalogImage) object. // // This `UpdateCatalogImage` endpoint accepts HTTP multipart/form-data requests with a JSON part and an image file part in // JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB. diff --git a/catalog/object.go b/catalog/object.go index c61b0b9..372df45 100644 --- a/catalog/object.go +++ b/catalog/object.go @@ -3,7 +3,7 @@ package catalog import ( - squaregosdk "github.com/fern-demo/square-go-sdk" + squaregosdk "github.com/square/square-go-sdk" ) type ObjectGetRequest struct { @@ -24,7 +24,7 @@ type ObjectGetRequest struct { IncludeRelatedObjects *bool `json:"-" url:"include_related_objects,omitempty"` // Requests objects as of a specific version of the catalog. This allows you to retrieve historical // versions of objects. The value to retrieve a specific version of an object can be found - // in the version field of [CatalogObject]($m/CatalogObject)s. If not included, results will + // in the version field of [CatalogObject](entity:CatalogObject)s. If not included, results will // be from the current version of the catalog. CatalogVersion *int64 `json:"-" url:"catalog_version,omitempty"` // Specifies whether or not to include the `path_to_root` list for each returned category instance. The `path_to_root` list consists diff --git a/catalog/object/client.go b/catalog/object/client.go index 376cc68..3804e5c 100644 --- a/catalog/object/client.go +++ b/catalog/object/client.go @@ -4,13 +4,12 @@ package object import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + catalog "github.com/square/square-go-sdk/catalog" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - catalog "github.com/fern-demo/square-go-sdk/catalog" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { @@ -39,7 +38,7 @@ func NewClient(opts ...option.RequestOption) *Client { } } -// Creates a new or updates the specified [CatalogObject]($m/CatalogObject). +// Creates a new or updates the specified [CatalogObject](entity:CatalogObject). // // To ensure consistency, only one update request is processed at a time per seller account. // While one (batch or non-batch) update request is being processed, other (batched and non-batched) @@ -82,13 +81,13 @@ func (c *Client) Upsert( return response, nil } -// Returns a single [CatalogItem]($m/CatalogItem) as a -// [CatalogObject]($m/CatalogObject) based on the provided ID. The returned -// object includes all of the relevant [CatalogItem]($m/CatalogItem) -// information including: [CatalogItemVariation]($m/CatalogItemVariation) +// Returns a single [CatalogItem](entity:CatalogItem) as a +// [CatalogObject](entity:CatalogObject) based on the provided ID. The returned +// object includes all of the relevant [CatalogItem](entity:CatalogItem) +// information including: [CatalogItemVariation](entity:CatalogItemVariation) // children, references to its -// [CatalogModifierList]($m/CatalogModifierList) objects, and the ids of -// any [CatalogTax]($m/CatalogTax) objects that apply to it. +// [CatalogModifierList](entity:CatalogModifierList) objects, and the ids of +// any [CatalogTax](entity:CatalogTax) objects that apply to it. func (c *Client) Get( ctx context.Context, // The object ID of any type of catalog objects to be retrieved. @@ -136,12 +135,12 @@ func (c *Client) Get( return response, nil } -// Deletes a single [CatalogObject]($m/CatalogObject) based on the +// Deletes a single [CatalogObject](entity:CatalogObject) based on the // provided ID and returns the set of successfully deleted IDs in the response. // Deletion is a cascading event such that all children of the targeted object -// are also deleted. For example, deleting a [CatalogItem]($m/CatalogItem) +// are also deleted. For example, deleting a [CatalogItem](entity:CatalogItem) // will also delete all of its -// [CatalogItemVariation]($m/CatalogItemVariation) children. +// [CatalogItemVariation](entity:CatalogItemVariation) children. // // To ensure consistency, only one delete request is processed at a time per seller account. // While one (batch or non-batch) delete request is being processed, other (batched and non-batched) diff --git a/checkout/client/client.go b/checkout/client/client.go index 89b7f96..d8f2a9b 100644 --- a/checkout/client/client.go +++ b/checkout/client/client.go @@ -4,13 +4,12 @@ package client import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + paymentlinks "github.com/square/square-go-sdk/checkout/paymentlinks" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - paymentlinks "github.com/fern-demo/square-go-sdk/checkout/paymentlinks" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { diff --git a/checkout/payment_links.go b/checkout/payment_links.go index 0f95b91..06a37a5 100644 --- a/checkout/payment_links.go +++ b/checkout/payment_links.go @@ -3,7 +3,7 @@ package checkout import ( - squaregosdk "github.com/fern-demo/square-go-sdk" + squaregosdk "github.com/square/square-go-sdk" ) type CreatePaymentLinkRequest struct { diff --git a/checkout/paymentlinks/client.go b/checkout/paymentlinks/client.go index e34ac54..c69f6f9 100644 --- a/checkout/paymentlinks/client.go +++ b/checkout/paymentlinks/client.go @@ -5,13 +5,12 @@ package paymentlinks import ( context "context" fmt "fmt" + squaregosdk "github.com/square/square-go-sdk" + checkout "github.com/square/square-go-sdk/checkout" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - checkout "github.com/fern-demo/square-go-sdk/checkout" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { diff --git a/client/client.go b/client/client.go index bfcaafd..3804fb2 100644 --- a/client/client.go +++ b/client/client.go @@ -3,52 +3,51 @@ package client import ( + applepay "github.com/square/square-go-sdk/applepay" + bankaccounts "github.com/square/square-go-sdk/bankaccounts" + bookingcustomattributes "github.com/square/square-go-sdk/bookingcustomattributes" + bookingsclient "github.com/square/square-go-sdk/bookings/client" + cards "github.com/square/square-go-sdk/cards" + cashdrawersclient "github.com/square/square-go-sdk/cashdrawers/client" + catalogclient "github.com/square/square-go-sdk/catalog/client" + checkoutclient "github.com/square/square-go-sdk/checkout/client" + core "github.com/square/square-go-sdk/core" + customerclient "github.com/square/square-go-sdk/customer/client" + customerattributedefinitions "github.com/square/square-go-sdk/customerattributedefinitions" + customersclient "github.com/square/square-go-sdk/customers/client" + devicesclient "github.com/square/square-go-sdk/devices/client" + disputesclient "github.com/square/square-go-sdk/disputes/client" + employees "github.com/square/square-go-sdk/employees" + events "github.com/square/square-go-sdk/events" + giftcardsclient "github.com/square/square-go-sdk/giftcards/client" + inventory "github.com/square/square-go-sdk/inventory" + invoices "github.com/square/square-go-sdk/invoices" + laborclient "github.com/square/square-go-sdk/labor/client" + locationcustomattributes "github.com/square/square-go-sdk/locationcustomattributes" + locationsclient "github.com/square/square-go-sdk/locations/client" + loyaltyclient "github.com/square/square-go-sdk/loyalty/client" + merchantcustomattributes "github.com/square/square-go-sdk/merchantcustomattributes" + merchants "github.com/square/square-go-sdk/merchants" + mobile "github.com/square/square-go-sdk/mobile" + oauth "github.com/square/square-go-sdk/oauth" + option "github.com/square/square-go-sdk/option" + ordercustomattributes "github.com/square/square-go-sdk/ordercustomattributes" + orders "github.com/square/square-go-sdk/orders" + payments "github.com/square/square-go-sdk/payments" + payouts "github.com/square/square-go-sdk/payouts" + refunds "github.com/square/square-go-sdk/refunds" + sites "github.com/square/square-go-sdk/sites" + snippets "github.com/square/square-go-sdk/snippets" + subscriptions "github.com/square/square-go-sdk/subscriptions" + teamclient "github.com/square/square-go-sdk/team/client" + teammembers "github.com/square/square-go-sdk/teammembers" + terminalclient "github.com/square/square-go-sdk/terminal/client" + v1client "github.com/square/square-go-sdk/v1/client" + v1locations "github.com/square/square-go-sdk/v1locations" + vendors "github.com/square/square-go-sdk/vendors" + webhooksclient "github.com/square/square-go-sdk/webhooks/client" http "net/http" os "os" - - applepay "github.com/fern-demo/square-go-sdk/applepay" - bankaccounts "github.com/fern-demo/square-go-sdk/bankaccounts" - bookingcustomattributes "github.com/fern-demo/square-go-sdk/bookingcustomattributes" - bookingsclient "github.com/fern-demo/square-go-sdk/bookings/client" - cards "github.com/fern-demo/square-go-sdk/cards" - cashdrawersclient "github.com/fern-demo/square-go-sdk/cashdrawers/client" - catalogclient "github.com/fern-demo/square-go-sdk/catalog/client" - checkoutclient "github.com/fern-demo/square-go-sdk/checkout/client" - core "github.com/fern-demo/square-go-sdk/core" - customerclient "github.com/fern-demo/square-go-sdk/customer/client" - customerattributedefinitions "github.com/fern-demo/square-go-sdk/customerattributedefinitions" - customersclient "github.com/fern-demo/square-go-sdk/customers/client" - devicesclient "github.com/fern-demo/square-go-sdk/devices/client" - disputesclient "github.com/fern-demo/square-go-sdk/disputes/client" - employees "github.com/fern-demo/square-go-sdk/employees" - events "github.com/fern-demo/square-go-sdk/events" - giftcardsclient "github.com/fern-demo/square-go-sdk/giftcards/client" - inventory "github.com/fern-demo/square-go-sdk/inventory" - invoices "github.com/fern-demo/square-go-sdk/invoices" - laborclient "github.com/fern-demo/square-go-sdk/labor/client" - locationcustomattributes "github.com/fern-demo/square-go-sdk/locationcustomattributes" - locationsclient "github.com/fern-demo/square-go-sdk/locations/client" - loyaltyclient "github.com/fern-demo/square-go-sdk/loyalty/client" - merchantcustomattributes "github.com/fern-demo/square-go-sdk/merchantcustomattributes" - merchants "github.com/fern-demo/square-go-sdk/merchants" - mobile "github.com/fern-demo/square-go-sdk/mobile" - oauth "github.com/fern-demo/square-go-sdk/oauth" - option "github.com/fern-demo/square-go-sdk/option" - ordercustomattributes "github.com/fern-demo/square-go-sdk/ordercustomattributes" - orders "github.com/fern-demo/square-go-sdk/orders" - payments "github.com/fern-demo/square-go-sdk/payments" - payouts "github.com/fern-demo/square-go-sdk/payouts" - refunds "github.com/fern-demo/square-go-sdk/refunds" - sites "github.com/fern-demo/square-go-sdk/sites" - snippets "github.com/fern-demo/square-go-sdk/snippets" - subscriptions "github.com/fern-demo/square-go-sdk/subscriptions" - teamclient "github.com/fern-demo/square-go-sdk/team/client" - teammembers "github.com/fern-demo/square-go-sdk/teammembers" - terminalclient "github.com/fern-demo/square-go-sdk/terminal/client" - v1client "github.com/fern-demo/square-go-sdk/v1/client" - v1transactions "github.com/fern-demo/square-go-sdk/v1transactions" - vendors "github.com/fern-demo/square-go-sdk/vendors" - webhooksclient "github.com/fern-demo/square-go-sdk/webhooks/client" ) type Client struct { @@ -58,7 +57,7 @@ type Client struct { Mobile *mobile.Client OAuth *oauth.Client - V1Transactions *v1transactions.Client + V1Locations *v1locations.Client ApplePay *applepay.Client BankAccounts *bankaccounts.Client Bookings *bookingsclient.Client @@ -118,7 +117,7 @@ func NewClient(opts ...option.RequestOption) *Client { header: options.ToHeader(), Mobile: mobile.NewClient(opts...), OAuth: oauth.NewClient(opts...), - V1Transactions: v1transactions.NewClient(opts...), + V1Locations: v1locations.NewClient(opts...), ApplePay: applepay.NewClient(opts...), BankAccounts: bankaccounts.NewClient(opts...), Bookings: bookingsclient.NewClient(opts...), diff --git a/client/client_test.go b/client/client_test.go index 0098345..367679a 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -3,12 +3,11 @@ package client import ( + option "github.com/square/square-go-sdk/option" + assert "github.com/stretchr/testify/assert" http "net/http" testing "testing" time "time" - - option "github.com/fern-demo/square-go-sdk/option" - assert "github.com/stretchr/testify/assert" ) func TestNewClient(t *testing.T) { diff --git a/core/request_option.go b/core/request_option.go index 2f478b6..969bc3c 100644 --- a/core/request_option.go +++ b/core/request_option.go @@ -63,8 +63,8 @@ func (r *RequestOptions) ToHeader() http.Header { func (r *RequestOptions) cloneHeader() http.Header { headers := r.HTTPHeader.Clone() headers.Set("X-Fern-Language", "Go") - headers.Set("X-Fern-SDK-Name", "github.com/fern-demo/square-go-sdk") - headers.Set("X-Fern-SDK-Version", "v0.0.94") + headers.Set("X-Fern-SDK-Name", "github.com/square/square-go-sdk") + headers.Set("X-Fern-SDK-Version", "v0.0.130") return headers } diff --git a/customer/client/client.go b/customer/client/client.go index 5e564ec..e465caf 100644 --- a/customer/client/client.go +++ b/customer/client/client.go @@ -3,12 +3,11 @@ package client import ( + core "github.com/square/square-go-sdk/core" + segments "github.com/square/square-go-sdk/customer/segments" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - core "github.com/fern-demo/square-go-sdk/core" - segments "github.com/fern-demo/square-go-sdk/customer/segments" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { diff --git a/customer/segments/client.go b/customer/segments/client.go index 55f8913..e84b884 100644 --- a/customer/segments/client.go +++ b/customer/segments/client.go @@ -5,13 +5,12 @@ package segments import ( context "context" fmt "fmt" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + customer "github.com/square/square-go-sdk/customer" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - customer "github.com/fern-demo/square-go-sdk/customer" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { diff --git a/customerattributedefinitions/client.go b/customerattributedefinitions/client.go index 8cad4f8..b1c2e0b 100644 --- a/customerattributedefinitions/client.go +++ b/customerattributedefinitions/client.go @@ -5,12 +5,11 @@ package customerattributedefinitions import ( context "context" fmt "fmt" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { @@ -39,7 +38,7 @@ func NewClient(opts ...option.RequestOption) *Client { } } -// Lists the customer-related [custom attribute definitions]($m/CustomAttributeDefinition) that belong to a Square seller account. +// Lists the customer-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account. // // When all response pages are retrieved, the results include all custom attribute definitions // that are visible to the requesting application, including those that are created by other @@ -103,13 +102,13 @@ func (c *Client) List( return pager.GetPage(ctx, request.Cursor) } -// Creates a customer-related [custom attribute definition]($m/CustomAttributeDefinition) for a Square seller account. +// Creates a customer-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account. // Use this endpoint to define a custom attribute that can be associated with customer profiles. // // A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties // for a custom attribute. After the definition is created, you can call -// [UpsertCustomerCustomAttribute]($e/CustomerCustomAttributes/UpsertCustomerCustomAttribute) or -// [BulkUpsertCustomerCustomAttributes]($e/CustomerCustomAttributes/BulkUpsertCustomerCustomAttributes) +// [UpsertCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-UpsertCustomerCustomAttribute) or +// [BulkUpsertCustomerCustomAttributes](api-endpoint:CustomerCustomAttributes-BulkUpsertCustomerCustomAttributes) // to set the custom attribute for customer profiles in the seller's Customer Directory. // // Sellers can view all custom attributes in exported customer data, including those set to @@ -152,7 +151,7 @@ func (c *Client) Create( return response, nil } -// Retrieves a customer-related [custom attribute definition]($m/CustomAttributeDefinition) from a Square seller account. +// Retrieves a customer-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account. // // To retrieve a custom attribute definition created by another application, the `visibility` // setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes @@ -205,7 +204,7 @@ func (c *Client) Get( return response, nil } -// Updates a customer-related [custom attribute definition]($m/CustomAttributeDefinition) for a Square seller account. +// Updates a customer-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account. // // Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the // `schema` for a `Selection` data type. @@ -252,7 +251,7 @@ func (c *Client) Update( return response, nil } -// Deletes a customer-related [custom attribute definition]($m/CustomAttributeDefinition) from a Square seller account. +// Deletes a customer-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account. // // Deleting a custom attribute definition also deletes the corresponding custom attribute from // all customer profiles in the seller's Customer Directory. diff --git a/customers/cards.go b/customers/cards.go index 7c54b4e..88614ab 100644 --- a/customers/cards.go +++ b/customers/cards.go @@ -3,7 +3,7 @@ package customers import ( - squaregosdk "github.com/fern-demo/square-go-sdk" + squaregosdk "github.com/square/square-go-sdk" ) type CreateCustomerCardRequest struct { diff --git a/customers/cards/client.go b/customers/cards/client.go index 7b7db6b..d28ea3e 100644 --- a/customers/cards/client.go +++ b/customers/cards/client.go @@ -4,13 +4,12 @@ package cards import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + customers "github.com/square/square-go-sdk/customers" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - customers "github.com/fern-demo/square-go-sdk/customers" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { diff --git a/customers/client/client.go b/customers/client/client.go index f2743b6..9fbe6d7 100644 --- a/customers/client/client.go +++ b/customers/client/client.go @@ -5,15 +5,14 @@ package client import ( context "context" fmt "fmt" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + cards "github.com/square/square-go-sdk/customers/cards" + customattributes "github.com/square/square-go-sdk/customers/customattributes" + groups "github.com/square/square-go-sdk/customers/groups" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - cards "github.com/fern-demo/square-go-sdk/customers/cards" - customattributes "github.com/fern-demo/square-go-sdk/customers/customattributes" - groups "github.com/fern-demo/square-go-sdk/customers/groups" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { @@ -160,7 +159,7 @@ func (c *Client) Create( return response, nil } -// Creates multiple [customer profiles]($m/Customer) for a business. +// Creates multiple [customer profiles](entity:Customer) for a business. // // This endpoint takes a map of individual create requests and returns a map of responses. // @@ -295,7 +294,7 @@ func (c *Client) BulkRetrieveCustomers( // // This endpoint takes a map of individual update requests and returns a map of responses. // -// You cannot use this endpoint to change cards on file. To make changes, use the [Cards API]($e/Cards) or [Gift Cards API]($e/GiftCards). +// You cannot use this endpoint to change cards on file. To make changes, use the [Cards API](api:Cards) or [Gift Cards API](api:GiftCards). func (c *Client) BulkUpdateCustomers( ctx context.Context, request *squaregosdk.BulkUpdateCustomersRequest, @@ -334,11 +333,11 @@ func (c *Client) BulkUpdateCustomers( return response, nil } -// Creates or updates [custom attributes]($m/CustomAttribute) for customer profiles as a bulk operation. +// Creates or updates [custom attributes](entity:CustomAttribute) for customer profiles as a bulk operation. // // Use this endpoint to set the value of one or more custom attributes for one or more customer profiles. // A custom attribute is based on a custom attribute definition in a Square seller account, which is -// created using the [CreateCustomerCustomAttributeDefinition]($e/CustomerCustomAttributes/CreateCustomerCustomAttributeDefinition) endpoint. +// created using the [CreateCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-CreateCustomerCustomAttributeDefinition) endpoint. // // This `BulkUpsertCustomerCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert // requests and returns a map of individual upsert responses. Each upsert request has a unique ID @@ -477,7 +476,7 @@ func (c *Client) Get( // // To update a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile. // -// You cannot use this endpoint to change cards on file. To make changes, use the [Cards API]($e/Cards) or [Gift Cards API]($e/GiftCards). +// You cannot use this endpoint to change cards on file. To make changes, use the [Cards API](api:Cards) or [Gift Cards API](api:GiftCards). func (c *Client) Update( ctx context.Context, // The ID of the customer to update. diff --git a/customers/custom_attributes.go b/customers/custom_attributes.go index 480bfcb..3b81e91 100644 --- a/customers/custom_attributes.go +++ b/customers/custom_attributes.go @@ -3,7 +3,7 @@ package customers import ( - squaregosdk "github.com/fern-demo/square-go-sdk" + squaregosdk "github.com/square/square-go-sdk" ) type CustomAttributesGetRequest struct { diff --git a/customers/customattributes/client.go b/customers/customattributes/client.go index a350d84..d154a58 100644 --- a/customers/customattributes/client.go +++ b/customers/customattributes/client.go @@ -5,13 +5,12 @@ package customattributes import ( context "context" fmt "fmt" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + customers "github.com/square/square-go-sdk/customers" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - customers "github.com/fern-demo/square-go-sdk/customers" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { @@ -40,7 +39,7 @@ func NewClient(opts ...option.RequestOption) *Client { } } -// Lists the [custom attributes]($m/CustomAttribute) associated with a customer profile. +// Lists the [custom attributes](entity:CustomAttribute) associated with a customer profile. // // You can use the `with_definitions` query parameter to also retrieve custom attribute definitions // in the same call. @@ -108,7 +107,7 @@ func (c *Client) List( return pager.GetPage(ctx, request.Cursor) } -// Retrieves a [custom attribute]($m/CustomAttribute) associated with a customer profile. +// Retrieves a [custom attribute](entity:CustomAttribute) associated with a customer profile. // // You can use the `with_definition` query parameter to also retrieve the custom attribute definition // in the same call. @@ -171,11 +170,11 @@ func (c *Client) Get( return response, nil } -// Creates or updates a [custom attribute]($m/CustomAttribute) for a customer profile. +// Creates or updates a [custom attribute](entity:CustomAttribute) for a customer profile. // // Use this endpoint to set the value of a custom attribute for a specified customer profile. // A custom attribute is based on a custom attribute definition in a Square seller account, which -// is created using the [CreateCustomerCustomAttributeDefinition]($e/CustomerCustomAttributes/CreateCustomerCustomAttributeDefinition) endpoint. +// is created using the [CreateCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-CreateCustomerCustomAttributeDefinition) endpoint. // // To create or update a custom attribute owned by another application, the `visibility` setting // must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes @@ -228,7 +227,7 @@ func (c *Client) Upsert( return response, nil } -// Deletes a [custom attribute]($m/CustomAttribute) associated with a customer profile. +// Deletes a [custom attribute](entity:CustomAttribute) associated with a customer profile. // // To delete a custom attribute owned by another application, the `visibility` setting must be // `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes diff --git a/customers/groups.go b/customers/groups.go index 8fda332..dcd6d9b 100644 --- a/customers/groups.go +++ b/customers/groups.go @@ -3,7 +3,7 @@ package customers import ( - squaregosdk "github.com/fern-demo/square-go-sdk" + squaregosdk "github.com/square/square-go-sdk" ) type CreateCustomerGroupRequest struct { diff --git a/customers/groups/client.go b/customers/groups/client.go index 3c284b9..cb4a7f8 100644 --- a/customers/groups/client.go +++ b/customers/groups/client.go @@ -5,13 +5,12 @@ package groups import ( context "context" fmt "fmt" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + customers "github.com/square/square-go-sdk/customers" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - customers "github.com/fern-demo/square-go-sdk/customers" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { diff --git a/devices/client/client.go b/devices/client/client.go index 6dab17e..584cda7 100644 --- a/devices/client/client.go +++ b/devices/client/client.go @@ -4,13 +4,12 @@ package client import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + codes "github.com/square/square-go-sdk/devices/codes" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - codes "github.com/fern-demo/square-go-sdk/devices/codes" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { diff --git a/devices/codes.go b/devices/codes.go index d2c4d05..c9a698b 100644 --- a/devices/codes.go +++ b/devices/codes.go @@ -3,7 +3,7 @@ package devices import ( - squaregosdk "github.com/fern-demo/square-go-sdk" + squaregosdk "github.com/square/square-go-sdk" ) type CreateDeviceCodeRequest struct { diff --git a/devices/codes/client.go b/devices/codes/client.go index 22896f3..7253fce 100644 --- a/devices/codes/client.go +++ b/devices/codes/client.go @@ -5,13 +5,12 @@ package codes import ( context "context" fmt "fmt" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + devices "github.com/square/square-go-sdk/devices" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - devices "github.com/fern-demo/square-go-sdk/devices" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { diff --git a/disputes/client/client.go b/disputes/client/client.go index edbbccc..be20ceb 100644 --- a/disputes/client/client.go +++ b/disputes/client/client.go @@ -6,15 +6,14 @@ import ( bytes "bytes" context "context" fmt "fmt" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + evidence "github.com/square/square-go-sdk/disputes/evidence" + option "github.com/square/square-go-sdk/option" io "io" multipart "mime/multipart" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - evidence "github.com/fern-demo/square-go-sdk/disputes/evidence" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { @@ -299,8 +298,8 @@ func (c *Client) CreateEvidenceText( // Submits evidence to the cardholder's bank. // // The evidence submitted by this endpoint includes evidence uploaded -// using the [CreateDisputeEvidenceFile]($e/Disputes/CreateDisputeEvidenceFile) and -// [CreateDisputeEvidenceText]($e/Disputes/CreateDisputeEvidenceText) endpoints and +// using the [CreateDisputeEvidenceFile](api-endpoint:Disputes-CreateDisputeEvidenceFile) and +// [CreateDisputeEvidenceText](api-endpoint:Disputes-CreateDisputeEvidenceText) endpoints and // evidence automatically provided by Square, when available. Evidence cannot be removed from // a dispute after submission. func (c *Client) SubmitEvidence( diff --git a/disputes/evidence/client.go b/disputes/evidence/client.go index 9b90f07..4c00968 100644 --- a/disputes/evidence/client.go +++ b/disputes/evidence/client.go @@ -5,13 +5,12 @@ package evidence import ( context "context" fmt "fmt" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + disputes "github.com/square/square-go-sdk/disputes" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - disputes "github.com/fern-demo/square-go-sdk/disputes" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { diff --git a/employees/client.go b/employees/client.go index 668179d..739bee0 100644 --- a/employees/client.go +++ b/employees/client.go @@ -5,12 +5,11 @@ package employees import ( context "context" fmt "fmt" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { diff --git a/events/client.go b/events/client.go index 3913edc..4bcf2f0 100644 --- a/events/client.go +++ b/events/client.go @@ -4,12 +4,11 @@ package events import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { diff --git a/giftcards/activities.go b/giftcards/activities.go index 0760b14..0853b9d 100644 --- a/giftcards/activities.go +++ b/giftcards/activities.go @@ -3,7 +3,7 @@ package giftcards import ( - squaregosdk "github.com/fern-demo/square-go-sdk" + squaregosdk "github.com/square/square-go-sdk" ) type CreateGiftCardActivityRequest struct { diff --git a/giftcards/activities/client.go b/giftcards/activities/client.go index d4e0d23..1897f87 100644 --- a/giftcards/activities/client.go +++ b/giftcards/activities/client.go @@ -5,13 +5,12 @@ package activities import ( context "context" fmt "fmt" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + giftcards "github.com/square/square-go-sdk/giftcards" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - giftcards "github.com/fern-demo/square-go-sdk/giftcards" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { @@ -102,7 +101,7 @@ func (c *Client) List( return pager.GetPage(ctx, request.Cursor) } -// Creates a gift card activity to manage the balance or state of a [gift card]($m/GiftCard). +// Creates a gift card activity to manage the balance or state of a [gift card](entity:GiftCard). // For example, create an `ACTIVATE` activity to activate a gift card with an initial balance before first use. func (c *Client) Create( ctx context.Context, diff --git a/giftcards/client/client.go b/giftcards/client/client.go index becee34..f1b9914 100644 --- a/giftcards/client/client.go +++ b/giftcards/client/client.go @@ -5,13 +5,12 @@ package client import ( context "context" fmt "fmt" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + activities "github.com/square/square-go-sdk/giftcards/activities" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - activities "github.com/fern-demo/square-go-sdk/giftcards/activities" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { @@ -105,8 +104,8 @@ func (c *Client) List( // Creates a digital gift card or registers a physical (plastic) gift card. The resulting gift card // has a `PENDING` state. To activate a gift card so that it can be redeemed for purchases, call -// [CreateGiftCardActivity]($e/GiftCardActivities/CreateGiftCardActivity) and create an `ACTIVATE` -// activity with the initial balance. Alternatively, you can use [RefundPayment]($e/Refunds/RefundPayment) +// [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) and create an `ACTIVATE` +// activity with the initial balance. Alternatively, you can use [RefundPayment](api-endpoint:Refunds-RefundPayment) // to refund a payment to the new gift card. func (c *Client) Create( ctx context.Context, diff --git a/go.mod b/go.mod index 8a5c8c6..786198b 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/fern-demo/square-go-sdk +module github.com/square/square-go-sdk go 1.18 diff --git a/integration_tests/catalog_test.go b/integration_tests/catalog_test.go deleted file mode 100644 index 2a2bf1c..0000000 --- a/integration_tests/catalog_test.go +++ /dev/null @@ -1,175 +0,0 @@ -package integration_tests - -import ( - "context" - "fmt" - "net/http" - "os" - "testing" - - "github.com/fern-demo/square-go-sdk" - "github.com/fern-demo/square-go-sdk/catalog" - "github.com/fern-demo/square-go-sdk/option" - "github.com/google/uuid" -) - -func TestCatalogItemLifecycle(t *testing.T) { - squareClient := initSquareClient() - - // Step 1: Create a catalog item with two variations - catalogItemName := "test-catalog-item-name" - variation1Name := "test-catalog-variation-name-1" - variation2Name := "test-catalog-variation-name-2" - - itemID := fmt.Sprintf("#%s", uuid.New().String()) - variation1ID := fmt.Sprintf("#%s", uuid.New().String()) - variation2ID := fmt.Sprintf("#%s", uuid.New().String()) - imageId := fmt.Sprintf("#%s", uuid.New().String()) - - createCatalogItemResp, err := squareClient.Catalog.BatchUpsert(context.TODO(), &square.BatchUpsertCatalogObjectsRequest{ - IdempotencyKey: uuid.New().String(), - Batches: []*square.CatalogObjectBatch{ - { - Objects: []*square.CatalogObject{ - { - Type: string(square.CatalogObjectTypeItem), - Item: &square.CatalogObjectItem{ - ID: itemID, - ItemData: &square.CatalogItem{ - Name: square.String(catalogItemName), - Variations: []*square.CatalogObject{ - { - Type: string(square.CatalogObjectTypeItemVariation), - ItemVariation: &square.CatalogObjectItemVariation{ - ID: variation1ID, - ItemVariationData: &square.CatalogItemVariation{ - Name: square.String(variation1Name), - PriceMoney: &square.Money{ - Amount: square.Int64(1000), - Currency: square.CurrencyUsd.Ptr(), - }, - }, - }, - }, - { - Type: string(square.CatalogObjectTypeItemVariation), - ItemVariation: &square.CatalogObjectItemVariation{ - ID: variation2ID, - ItemVariationData: &square.CatalogItemVariation{ - Name: square.String(variation2Name), - PriceMoney: &square.Money{ - Amount: square.Int64(2000), - Currency: square.CurrencyUsd.Ptr(), - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }) - if err != nil { - t.Fatalf("failed to create catalog item and variations: %v", err) - } - fmt.Println(createCatalogItemResp.String()) - - // Step 2: Search for the created catalog item - searchCatalogResp, err := squareClient.Catalog.Search(context.TODO(), &square.SearchCatalogObjectsRequest{ - ObjectTypes: []square.CatalogObjectType{square.CatalogObjectTypeItem}, - Query: &square.CatalogQuery{ - ExactQuery: &square.CatalogQueryExact{ - AttributeName: "name", - AttributeValue: catalogItemName, - }, - }, - }) - if err != nil { - t.Fatalf("failed to search catalog item: %v", err) - } - if len(searchCatalogResp.Objects) == 0 { - t.Fatalf("catalog item not found") - } - - itemToUpdate := searchCatalogResp.Objects[0] - // update item name - itemToUpdate.Item.ItemData.Name = square.String(fmt.Sprintf("%s-updated", catalogItemName)) - - // Step 3: Update the catalog item - updateCatalogItemResp, err := squareClient.Catalog.BatchUpsert(context.TODO(), &square.BatchUpsertCatalogObjectsRequest{ - IdempotencyKey: uuid.New().String(), - Batches: []*square.CatalogObjectBatch{ - { - Objects: []*square.CatalogObject{ - itemToUpdate, - }, - }, - }, - }) - if err != nil { - t.Fatalf("failed to update catalog item: %v", err) - } - - fmt.Println(updateCatalogItemResp.String()) - - // Step 4: Create a catalog image - file, err := os.Open("./test.jpeg") - if err != nil { - t.Fatalf("failed to open file: %v", err) - } - - createCatalogImageResp, err := squareClient.Catalog.Images.Create(context.TODO(), file, &catalog.ImagesCreateRequest{ - Request: &square.CreateCatalogImageRequest{ - IdempotencyKey: uuid.New().String(), - ObjectID: &itemToUpdate.Item.ID, - Image: &square.CatalogObject{ - Image: &square.CatalogObjectImage{ - ID: imageId, - ImageData: &square.CatalogImage{ - Name: square.String("test-image"), - }, - }, - }, - }, - }, option.WithHTTPHeader(http.Header{ - "Content-Type": []string{"image/jpeg"}, - })) - - if err != nil { - t.Fatalf("failed to create catalog image: %v", err) - } - fmt.Println(createCatalogImageResp.String()) - - // Step 5: Delete the catalog item and attached variations - deleteCatalogItemResp, err := squareClient.Catalog.BatchDelete(context.TODO(), &square.BatchDeleteCatalogObjectsRequest{ - ObjectIDs: []string{createCatalogItemResp.Objects[0].Item.ID}, - }) - if err != nil { - t.Fatalf("failed to delete catalog objects: %v", err) - } - - // validate the deleted object ids - if len(deleteCatalogItemResp.DeletedObjectIDs) != 3 { - t.Fatalf("expected %d deleted objects, got %d", 3, len(deleteCatalogItemResp.DeletedObjectIDs)) - } - - // Step 6: Validate the catalog item is deleted - searchCatalogResp, err = squareClient.Catalog.Search(context.TODO(), &square.SearchCatalogObjectsRequest{ - ObjectTypes: []square.CatalogObjectType{square.CatalogObjectTypeItem}, - Query: &square.CatalogQuery{ - ExactQuery: &square.CatalogQueryExact{ - AttributeName: "name", - AttributeValue: catalogItemName, - }, - }, - }) - if err != nil { - t.Fatalf("failed to search catalog item: %v", err) - } - if len(searchCatalogResp.Objects) != 0 { - t.Fatalf("catalog item was not deleted") - } -} diff --git a/integration_tests/locations_test.go b/integration_tests/locations_test.go deleted file mode 100644 index 6e245bf..0000000 --- a/integration_tests/locations_test.go +++ /dev/null @@ -1,68 +0,0 @@ -package integration_tests - -import ( - "context" - "fmt" - "testing" - - "github.com/fern-demo/square-go-sdk" - "github.com/google/uuid" -) - -func TestLocationLifecycle(t *testing.T) { - squareClient := initSquareClient() - - locationID := "" - randomUUID, err := uuid.NewRandom() - if err != nil { - t.Fatalf("failed to generate random uuid: %v", err) - } - - // find the location in a list - listLocationsResp, err := squareClient.Locations.List(context.TODO()) - if err != nil { - t.Fatalf("failed to list locations: %v", err) - } - - // iterate through until we find it - foundLocation := false - for _, location := range listLocationsResp.Locations { - if *location.Name == LOCATION_NAME { - foundLocation = true - locationID = *location.ID - break - } - } - - if !foundLocation { - t.Fatalf("failed to find location in list. resp: %v", listLocationsResp.String()) - } - - // retrieve the location - getLocationResp, err := squareClient.Locations.Get(context.TODO(), locationID) - if err != nil { - t.Fatalf("failed to get location: %v", err) - } - - // validate name matches what we expect - if *getLocationResp.Location.Name != LOCATION_NAME { - t.Fatalf("expected location name %s, got %v", LOCATION_NAME, getLocationResp.Location.Name) - } - - // update the location description - updateLocationResp, err := squareClient.Locations.Update(context.TODO(), locationID, &square.UpdateLocationRequest{ - Location: &square.Location{ - ID: &locationID, - Name: square.String(LOCATION_NAME), - Description: square.String(fmt.Sprintf("updated-location-description-%s", randomUUID.String())), - }, - }) - if err != nil { - t.Fatalf("failed to update location: %v", err) - } - - // validate the description was updated - if *updateLocationResp.Location.Description == *getLocationResp.Location.Description { - t.Fatalf("expected location description to be updated, got %v", updateLocationResp.Location.Description) - } -} diff --git a/integration_tests/oauth_test.go b/integration_tests/oauth_test.go deleted file mode 100644 index 1ac136f..0000000 --- a/integration_tests/oauth_test.go +++ /dev/null @@ -1,24 +0,0 @@ -package integration_tests - -//func TestRetrieveTokenStatus(t *testing.T) { -// squareClient := initSquareClient() -// -// // Step 1: Retrieve the status of the OAuth token -// retrieveTokenStatusResp, err := squareClient.OAuth.RetrieveTokenStatus(context.TODO()) -// if err != nil { -// t.Fatalf("failed to retrieve token status: %v", err) -// } -// -// //squareClient.OAuth.Authorize() -// -// squareClient.OAuth.RenewToken(context.TODO(), -// *retrieveTokenStatusResp.ClientID, -// option.WithHTTPHeader( -// http.Header{ -// "Authorization": []string{fmt.Sprintf("Bearer %s", os.Getenv("SQUARE_SANDBOX_TOKEN"))}, -// }, -// ) -// ) -// -// //fmt.Printf("Retrieved token status: %v\n", retrieveTokenStatusResp) -//} diff --git a/integration_tests/orders_payments_test.go b/integration_tests/orders_payments_test.go deleted file mode 100644 index 3b3765f..0000000 --- a/integration_tests/orders_payments_test.go +++ /dev/null @@ -1,257 +0,0 @@ -package integration_tests - -import ( - "context" - "fmt" - "testing" - "time" - - "github.com/fern-demo/square-go-sdk" - "github.com/google/uuid" -) - -func TestOrderPaymentLifecycle(t *testing.T) { - squareClient := initSquareClient() - - // Grab necessary information - // Location ID - listLocationsResp, err := squareClient.Locations.List(context.TODO()) - if err != nil { - t.Fatalf("failed to list locations: %v", err) - } - locationID := *listLocationsResp.Locations[0].ID - - // Step 1: Create an order with a line item. not attached to a catalog item - createOrderResp, err := squareClient.Orders.Create(context.TODO(), &square.CreateOrderRequest{ - IdempotencyKey: square.String(uuid.New().String()), - Order: &square.Order{ - LocationID: locationID, - LineItems: []*square.OrderLineItem{ - { - Quantity: "1", - BasePriceMoney: &square.Money{ - Amount: square.Int64(1000), - Currency: square.CurrencyUsd.Ptr(), - }, - CatalogObjectID: nil, // not attached to a catalog item - Name: square.String("test-line-item-name"), - }, - }, - Fulfillments: []*square.Fulfillment{ - { - Type: square.FulfillmentTypePickup.Ptr(), - PickupDetails: &square.FulfillmentPickupDetails{ - Recipient: &square.FulfillmentRecipient{ - DisplayName: square.String("test-recipient-name"), - }, - PickupAt: square.String(time.Now().Add(time.Hour).Format(time.RFC3339)), - }, - }, - }, - }, - }) - if err != nil { - t.Fatalf("failed to create order: %v", err) - } - - fmt.Printf("Created order: %v\n", createOrderResp.Order) - - // Step 2: Pay for the order - createPaymentResp, err := squareClient.Payments.Create(context.TODO(), &square.CreatePaymentRequest{ - LocationID: &locationID, - IdempotencyKey: uuid.New().String(), - AmountMoney: &square.Money{ - Amount: square.Int64(1000), - Currency: square.CurrencyUsd.Ptr(), - }, - SourceID: "cnon:card-nonce-ok", - OrderID: createOrderResp.Order.ID, - }) - if err != nil { - t.Fatalf("failed to create payment: %v", err) - } - - fmt.Printf("Created payment: %v\n", createPaymentResp.Payment) - - // Step 3: Fulfill the order - getOrderResp, err := squareClient.Orders.Get(context.TODO(), *createOrderResp.Order.ID) - if err != nil { - t.Fatalf("failed to get order: %v", err) - } - orderToFulfill := getOrderResp.Order - - orderToFulfill.Fulfillments[0].State = square.FulfillmentStateCompleted.Ptr() - orderToFulfill.State = square.OrderStateCompleted.Ptr() - - updateOrderResp, err := squareClient.Orders.Update(context.TODO(), *orderToFulfill.ID, &square.UpdateOrderRequest{ - Order: orderToFulfill, - IdempotencyKey: square.String(uuid.New().String()), - }) - if err != nil { - t.Fatalf("failed to update order: %v", err) - } - - fmt.Printf("Updated order: %v\n", updateOrderResp.Order) - - // Step 4: Refund the payment - createRefundResp, err := squareClient.Refunds.RefundPayment(context.TODO(), &square.RefundPaymentRequest{ - AmountMoney: &square.Money{ - Amount: square.Int64(1000), - Currency: square.CurrencyUsd.Ptr(), - }, - PaymentID: createPaymentResp.Payment.ID, - IdempotencyKey: uuid.New().String(), - }) - if err != nil { - t.Fatalf("failed to refund payment: %v", err) - } - - fmt.Printf("Refunded payment: %v\n", createRefundResp.Refund) - - // Step 5: Search for the completed order. should be the latest one - searchOrdersResp, err := squareClient.Orders.Search(context.TODO(), &square.SearchOrdersRequest{ - LocationIDs: []string{locationID}, - Query: &square.SearchOrdersQuery{ - Filter: &square.SearchOrdersFilter{ - StateFilter: &square.SearchOrdersStateFilter{ - States: []square.OrderState{square.OrderStateCompleted}, - }, - }, - Sort: &square.SearchOrdersSort{ - SortField: square.SearchOrdersSortFieldClosedAt, - SortOrder: square.SortOrderDesc.Ptr(), - }, - }, - }) - if err != nil { - t.Fatalf("failed to search orders: %v", err) - } - - if len(searchOrdersResp.Orders) == 0 { - t.Fatalf("no completed orders found") - } - - fmt.Printf("Found completed order: %v\n", searchOrdersResp.Orders[0]) - - // validate id matches - if *searchOrdersResp.Orders[0].ID != *createOrderResp.Order.ID { - t.Fatalf("expected order id %s, got %v", *createOrderResp.Order.ID, *searchOrdersResp.Orders[0].ID) - } -} - -func TestOrderCustomAttributesLifecycle(t *testing.T) { - squareClient := initSquareClient() - - // Grab necessary information - // Location ID - listLocationsResp, err := squareClient.Locations.List(context.TODO()) - if err != nil { - t.Fatalf("failed to list locations: %v", err) - } - locationID := *listLocationsResp.Locations[0].ID - - // Step 1: Create an order custom attribute definition - createOrderCustomAttributeDefinitionResp, err := squareClient.OrderCustomAttributes.CreateOrderCustomAttributeDefinition(context.TODO(), &square.CreateOrderCustomAttributeDefinitionRequest{ - IdempotencyKey: square.String(uuid.New().String()), - CustomAttributeDefinition: &square.CustomAttributeDefinition{ - Key: square.String("test-address"), - Name: square.String("Test address attribute"), - Schema: map[string]interface{}{ - "$ref": "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.Address", - }, - }, - }) - - if err != nil { - t.Fatalf("failed to create order custom attribute definition: %v", err) - } - - fmt.Printf("Created order custom attribute definition: %v\n", createOrderCustomAttributeDefinitionResp.CustomAttributeDefinition) - - // Step 2: Retrieve the custom attribute definition - getOrderCustomAttributeDefinitionResp, err := squareClient.OrderCustomAttributes.RetrieveOrderCustomAttributeDefinition(context.TODO(), *createOrderCustomAttributeDefinitionResp.CustomAttributeDefinition.Key, nil) - if err != nil { - t.Fatalf("failed to get order custom attribute definition: %v", err) - } - - fmt.Printf("Retrieved order custom attribute definition: %v\n", getOrderCustomAttributeDefinitionResp.CustomAttributeDefinition) - - // Step 3: Update the custom attribute definition - customAttributeDefinitionToUpdate := getOrderCustomAttributeDefinitionResp.CustomAttributeDefinition - customAttributeDefinitionToUpdate.Description = square.String("Updated description") - updateOrderCustomAttributeDefinitionResp, err := squareClient.OrderCustomAttributes.UpdateOrderCustomAttributeDefinition(context.TODO(), *createOrderCustomAttributeDefinitionResp.CustomAttributeDefinition.Key, &square.UpdateOrderCustomAttributeDefinitionRequest{ - CustomAttributeDefinition: customAttributeDefinitionToUpdate, - IdempotencyKey: square.String(uuid.New().String()), - }) - if err != nil { - t.Fatalf("failed to update order custom attribute definition: %v", err) - } - - fmt.Printf("Updated order custom attribute definition: %v\n", updateOrderCustomAttributeDefinitionResp.CustomAttributeDefinition) - - // Step 4: Create an order with the custom attribute - createOrderResp, err := squareClient.Orders.Create(context.TODO(), &square.CreateOrderRequest{ - IdempotencyKey: square.String(uuid.New().String()), - Order: &square.Order{ - LocationID: locationID, - LineItems: []*square.OrderLineItem{ - { - Quantity: "1", - BasePriceMoney: &square.Money{ - Amount: square.Int64(1000), - Currency: square.CurrencyUsd.Ptr(), - }, - CatalogObjectID: nil, // not attached to a catalog item - Name: square.String("test-line-item-name"), - }, - }, - }, - }) - - // Step 5: Add the custom attribute to the order - createOrderCustomAttributeResp, err := squareClient.OrderCustomAttributes.UpsertOrderCustomAttribute( - context.TODO(), - *createOrderResp.Order.ID, - *createOrderCustomAttributeDefinitionResp.CustomAttributeDefinition.Key, - &square.UpsertOrderCustomAttributeRequest{ - CustomAttribute: &square.CustomAttribute{ - Value: map[string]string{ - "address_line_1": "1455 Market Street", - "postal_code": "94103", - "country": "US", - "administrative_district_level_1": "California", - "locality": "San Francisco", - }, - Key: createOrderCustomAttributeDefinitionResp.CustomAttributeDefinition.Key, - }, - }) - if err != nil { - t.Fatalf("failed to attach order custom attribute: %v", err) - } - - fmt.Printf("Created order custom attribute: %v\n", createOrderCustomAttributeResp.CustomAttribute) - - // Step 6: List the custom attribute attached to the order - listOrderCustomAttributesResp, err := squareClient.OrderCustomAttributes.ListOrderCustomAttributes(context.TODO(), *createOrderResp.Order.ID, nil) - if err != nil { - t.Fatalf("failed to get order custom attribute: %v", err) - } - - fmt.Printf("Retrieved order custom attributes: %v\n", listOrderCustomAttributesResp.CustomAttributes) - - // Validate we have the correct custom attribute - if len(listOrderCustomAttributesResp.CustomAttributes) != 1 { - t.Fatalf("expected 1 custom attribute, got %d", len(listOrderCustomAttributesResp.CustomAttributes)) - } - if *listOrderCustomAttributesResp.CustomAttributes[0].Key != *createOrderCustomAttributeDefinitionResp.CustomAttributeDefinition.Key { - t.Fatalf("expected custom attribute key %s, got %v", *createOrderCustomAttributeDefinitionResp.CustomAttributeDefinition.Key, *listOrderCustomAttributesResp.CustomAttributes[0].Key) - } - - // Delete the custom attribute definition - deleteOrderCustomAttributeDefinitionResp, err := squareClient.OrderCustomAttributes.DeleteOrderCustomAttributeDefinition(context.TODO(), *createOrderCustomAttributeDefinitionResp.CustomAttributeDefinition.Key) - if err != nil { - t.Fatalf("failed to delete order custom attribute definition: %v", err) - } - - fmt.Printf("Deleted order custom attribute definition: %v\n", deleteOrderCustomAttributeDefinitionResp) -} diff --git a/integration_tests/test.jpeg b/integration_tests/test.jpeg deleted file mode 100644 index bb7bca3..0000000 Binary files a/integration_tests/test.jpeg and /dev/null differ diff --git a/integration_tests/test_init.go b/integration_tests/test_init.go deleted file mode 100644 index 3777072..0000000 --- a/integration_tests/test_init.go +++ /dev/null @@ -1,54 +0,0 @@ -package integration_tests - -import ( - "context" - "fmt" - "os" - "testing" - - square "github.com/fern-demo/square-go-sdk" - client "github.com/fern-demo/square-go-sdk/client" - "github.com/fern-demo/square-go-sdk/option" -) - -const LOCATION_NAME = "test-location-name" - -func initSquareClient() *client.Client { - return client.NewClient( - option.WithToken(os.Getenv("SQUARE_SANDBOX_TOKEN")), - option.WithBaseURL("https://connect.squareupsandbox.com")) -} - -// Run me to insert necessary objects into the test account -func InitTestAccount(t *testing.T) { - squareClient := initSquareClient() - - // check that location exists - listLocationsResp, err := squareClient.Locations.List(context.TODO()) - if err != nil { - t.Fatalf("failed to list locations: %v", err) - } - // iterate through, looking for location with LOCATION_NAME - foundLocation := false - for _, location := range listLocationsResp.Locations { - if *location.Name == LOCATION_NAME { - foundLocation = true - break - } - } - - if !foundLocation { - fmt.Println("Location does not exist. Creating it...") - // create location that we modify - createLocationResp, err := squareClient.Locations.Create(context.TODO(), &square.CreateLocationRequest{ - Location: &square.Location{ - Name: square.String(LOCATION_NAME), - }, - }) - if err != nil { - t.Fatalf("failed to create location: %v. square error: %v", err, createLocationResp.Errors) - } - } else { - fmt.Println("Location already exists. Skipping create") - } -} diff --git a/inventory/client.go b/inventory/client.go index ba7cca8..bca669e 100644 --- a/inventory/client.go +++ b/inventory/client.go @@ -4,12 +4,11 @@ package inventory import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { @@ -78,7 +77,7 @@ func (c *Client) DeprecatedGetAdjustment( return response, nil } -// Returns the [InventoryAdjustment]($m/InventoryAdjustment) object +// Returns the [InventoryAdjustment](entity:InventoryAdjustment) object // with the provided `adjustment_id`. func (c *Client) GetAdjustment( ctx context.Context, @@ -328,8 +327,8 @@ func (c *Client) BatchGetChanges( } // Returns current counts for the provided -// [CatalogObject]($m/CatalogObject)s at the requested -// [Location]($m/Location)s. +// [CatalogObject](entity:CatalogObject)s at the requested +// [Location](entity:Location)s. // // Results are paginated and sorted in descending order according to their // `calculated_at` timestamp (newest first). @@ -417,7 +416,7 @@ func (c *Client) DeprecatedGetPhysicalCount( return response, nil } -// Returns the [InventoryPhysicalCount]($m/InventoryPhysicalCount) +// Returns the [InventoryPhysicalCount](entity:InventoryPhysicalCount) // object with the provided `physical_count_id`. func (c *Client) GetPhysicalCount( ctx context.Context, @@ -458,7 +457,7 @@ func (c *Client) GetPhysicalCount( return response, nil } -// Returns the [InventoryTransfer]($m/InventoryTransfer) object +// Returns the [InventoryTransfer](entity:InventoryTransfer) object // with the provided `transfer_id`. func (c *Client) GetTransfer( ctx context.Context, @@ -499,8 +498,8 @@ func (c *Client) GetTransfer( } // Retrieves the current calculated stock count for a given -// [CatalogObject]($m/CatalogObject) at a given set of -// [Location]($m/Location)s. Responses are paginated and unsorted. +// [CatalogObject](entity:CatalogObject) at a given set of +// [Location](entity:Location)s. Responses are paginated and unsorted. // For more sophisticated queries, use a batch endpoint. func (c *Client) Get( ctx context.Context, diff --git a/invoices/client.go b/invoices/client.go index 24ebcbc..5a4f897 100644 --- a/invoices/client.go +++ b/invoices/client.go @@ -6,14 +6,13 @@ import ( bytes "bytes" context "context" fmt "fmt" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" io "io" multipart "mime/multipart" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { @@ -103,7 +102,7 @@ func (c *Client) List( return pager.GetPage(ctx, request.Cursor) } -// Creates a draft [invoice]($m/Invoice) +// Creates a draft [invoice](entity:Invoice) // for an order created using the Orders API. // // A draft invoice remains in your account and no action is taken. diff --git a/labor/break_types.go b/labor/break_types.go index 555938f..23470cd 100644 --- a/labor/break_types.go +++ b/labor/break_types.go @@ -3,7 +3,7 @@ package labor import ( - squaregosdk "github.com/fern-demo/square-go-sdk" + squaregosdk "github.com/square/square-go-sdk" ) type UpdateBreakTypeRequest struct { diff --git a/labor/breaktypes/client.go b/labor/breaktypes/client.go index b9d6fb7..ff2843f 100644 --- a/labor/breaktypes/client.go +++ b/labor/breaktypes/client.go @@ -4,13 +4,12 @@ package breaktypes import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + labor "github.com/square/square-go-sdk/labor" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - labor "github.com/fern-demo/square-go-sdk/labor" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { diff --git a/labor/client/client.go b/labor/client/client.go index e11fb3a..0f6d464 100644 --- a/labor/client/client.go +++ b/labor/client/client.go @@ -5,17 +5,16 @@ package client import ( context "context" fmt "fmt" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + breaktypes "github.com/square/square-go-sdk/labor/breaktypes" + employeewages "github.com/square/square-go-sdk/labor/employeewages" + shifts "github.com/square/square-go-sdk/labor/shifts" + teammemberwages "github.com/square/square-go-sdk/labor/teammemberwages" + workweekconfigs "github.com/square/square-go-sdk/labor/workweekconfigs" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - breaktypes "github.com/fern-demo/square-go-sdk/labor/breaktypes" - employeewages "github.com/fern-demo/square-go-sdk/labor/employeewages" - shifts "github.com/fern-demo/square-go-sdk/labor/shifts" - teammemberwages "github.com/fern-demo/square-go-sdk/labor/teammemberwages" - workweekconfigs "github.com/fern-demo/square-go-sdk/labor/workweekconfigs" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { diff --git a/labor/employeewages/client.go b/labor/employeewages/client.go index 29d5282..6413cd0 100644 --- a/labor/employeewages/client.go +++ b/labor/employeewages/client.go @@ -5,13 +5,12 @@ package employeewages import ( context "context" fmt "fmt" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + labor "github.com/square/square-go-sdk/labor" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - labor "github.com/fern-demo/square-go-sdk/labor" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { diff --git a/labor/shifts.go b/labor/shifts.go index cddb93f..c77adf3 100644 --- a/labor/shifts.go +++ b/labor/shifts.go @@ -3,7 +3,7 @@ package labor import ( - squaregosdk "github.com/fern-demo/square-go-sdk" + squaregosdk "github.com/square/square-go-sdk" ) type CreateShiftRequest struct { diff --git a/labor/shifts/client.go b/labor/shifts/client.go index 981b17d..3354dc2 100644 --- a/labor/shifts/client.go +++ b/labor/shifts/client.go @@ -4,13 +4,12 @@ package shifts import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + labor "github.com/square/square-go-sdk/labor" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - labor "github.com/fern-demo/square-go-sdk/labor" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { diff --git a/labor/teammemberwages/client.go b/labor/teammemberwages/client.go index 7f960d6..7b653ed 100644 --- a/labor/teammemberwages/client.go +++ b/labor/teammemberwages/client.go @@ -5,13 +5,12 @@ package teammemberwages import ( context "context" fmt "fmt" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + labor "github.com/square/square-go-sdk/labor" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - labor "github.com/fern-demo/square-go-sdk/labor" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { diff --git a/labor/workweek_configs.go b/labor/workweek_configs.go index 054ce5b..8a3cec6 100644 --- a/labor/workweek_configs.go +++ b/labor/workweek_configs.go @@ -3,7 +3,7 @@ package labor import ( - squaregosdk "github.com/fern-demo/square-go-sdk" + squaregosdk "github.com/square/square-go-sdk" ) type UpdateWorkweekConfigRequest struct { diff --git a/labor/workweekconfigs/client.go b/labor/workweekconfigs/client.go index 822f43e..cf7c03a 100644 --- a/labor/workweekconfigs/client.go +++ b/labor/workweekconfigs/client.go @@ -5,13 +5,12 @@ package workweekconfigs import ( context "context" fmt "fmt" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + labor "github.com/square/square-go-sdk/labor" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - labor "github.com/fern-demo/square-go-sdk/labor" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { diff --git a/locationcustomattributes/client.go b/locationcustomattributes/client.go index 0729639..d59bbb5 100644 --- a/locationcustomattributes/client.go +++ b/locationcustomattributes/client.go @@ -4,12 +4,11 @@ package locationcustomattributes import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { @@ -38,7 +37,7 @@ func NewClient(opts ...option.RequestOption) *Client { } } -// Lists the location-related [custom attribute definitions]($m/CustomAttributeDefinition) that belong to a Square seller account. +// Lists the location-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account. // When all response pages are retrieved, the results include all custom attribute definitions // that are visible to the requesting application, including those that are created by other // applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. @@ -87,12 +86,12 @@ func (c *Client) ListLocationCustomAttributeDefinitions( return response, nil } -// Creates a location-related [custom attribute definition]($m/CustomAttributeDefinition) for a Square seller account. +// Creates a location-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account. // Use this endpoint to define a custom attribute that can be associated with locations. // A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties // for a custom attribute. After the definition is created, you can call -// [UpsertLocationCustomAttribute]($e/LocationCustomAttributes/UpsertLocationCustomAttribute) or -// [BulkUpsertLocationCustomAttributes]($e/LocationCustomAttributes/BulkUpsertLocationCustomAttributes) +// [UpsertLocationCustomAttribute](api-endpoint:LocationCustomAttributes-UpsertLocationCustomAttribute) or +// [BulkUpsertLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkUpsertLocationCustomAttributes) // to set the custom attribute for locations. func (c *Client) CreateLocationCustomAttributeDefinition( ctx context.Context, @@ -132,7 +131,7 @@ func (c *Client) CreateLocationCustomAttributeDefinition( return response, nil } -// Retrieves a location-related [custom attribute definition]($m/CustomAttributeDefinition) from a Square seller account. +// Retrieves a location-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account. // To retrieve a custom attribute definition created by another application, the `visibility` // setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. func (c *Client) RetrieveLocationCustomAttributeDefinition( @@ -183,7 +182,7 @@ func (c *Client) RetrieveLocationCustomAttributeDefinition( return response, nil } -// Updates a location-related [custom attribute definition]($m/CustomAttributeDefinition) for a Square seller account. +// Updates a location-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account. // Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the // `schema` for a `Selection` data type. // Only the definition owner can update a custom attribute definition. @@ -227,7 +226,7 @@ func (c *Client) UpdateLocationCustomAttributeDefinition( return response, nil } -// Deletes a location-related [custom attribute definition]($m/CustomAttributeDefinition) from a Square seller account. +// Deletes a location-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account. // Deleting a custom attribute definition also deletes the corresponding custom attribute from // all locations. // Only the definition owner can delete a custom attribute definition. @@ -269,7 +268,7 @@ func (c *Client) DeleteLocationCustomAttributeDefinition( return response, nil } -// Deletes [custom attributes]($m/CustomAttribute) for locations as a bulk operation. +// Deletes [custom attributes](entity:CustomAttribute) for locations as a bulk operation. // To delete a custom attribute owned by another application, the `visibility` setting must be // `VISIBILITY_READ_WRITE_VALUES`. func (c *Client) BulkDeleteLocationCustomAttributes( @@ -310,10 +309,10 @@ func (c *Client) BulkDeleteLocationCustomAttributes( return response, nil } -// Creates or updates [custom attributes]($m/CustomAttribute) for locations as a bulk operation. +// Creates or updates [custom attributes](entity:CustomAttribute) for locations as a bulk operation. // Use this endpoint to set the value of one or more custom attributes for one or more locations. // A custom attribute is based on a custom attribute definition in a Square seller account, which is -// created using the [CreateLocationCustomAttributeDefinition]($e/LocationCustomAttributes/CreateLocationCustomAttributeDefinition) endpoint. +// created using the [CreateLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-CreateLocationCustomAttributeDefinition) endpoint. // This `BulkUpsertLocationCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert // requests and returns a map of individual upsert responses. Each upsert request has a unique ID // and provides a location ID and custom attribute. Each upsert response is returned with the ID @@ -358,7 +357,7 @@ func (c *Client) BulkUpsertLocationCustomAttributes( return response, nil } -// Lists the [custom attributes]($m/CustomAttribute) associated with a location. +// Lists the [custom attributes](entity:CustomAttribute) associated with a location. // You can use the `with_definitions` query parameter to also retrieve custom attribute definitions // in the same call. // When all response pages are retrieved, the results include all custom attributes that are @@ -411,7 +410,7 @@ func (c *Client) ListLocationCustomAttributes( return response, nil } -// Retrieves a [custom attribute]($m/CustomAttribute) associated with a location. +// Retrieves a [custom attribute](entity:CustomAttribute) associated with a location. // You can use the `with_definition` query parameter to also retrieve the custom attribute definition // in the same call. // To retrieve a custom attribute owned by another application, the `visibility` setting must be @@ -471,10 +470,10 @@ func (c *Client) RetrieveLocationCustomAttribute( return response, nil } -// Creates or updates a [custom attribute]($m/CustomAttribute) for a location. +// Creates or updates a [custom attribute](entity:CustomAttribute) for a location. // Use this endpoint to set the value of a custom attribute for a specified location. // A custom attribute is based on a custom attribute definition in a Square seller account, which -// is created using the [CreateLocationCustomAttributeDefinition]($e/LocationCustomAttributes/CreateLocationCustomAttributeDefinition) endpoint. +// is created using the [CreateLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-CreateLocationCustomAttributeDefinition) endpoint. // To create or update a custom attribute owned by another application, the `visibility` setting // must be `VISIBILITY_READ_WRITE_VALUES`. func (c *Client) UpsertLocationCustomAttribute( @@ -525,7 +524,7 @@ func (c *Client) UpsertLocationCustomAttribute( return response, nil } -// Deletes a [custom attribute]($m/CustomAttribute) associated with a location. +// Deletes a [custom attribute](entity:CustomAttribute) associated with a location. // To delete a custom attribute owned by another application, the `visibility` setting must be // `VISIBILITY_READ_WRITE_VALUES`. func (c *Client) DeleteLocationCustomAttribute( diff --git a/locations/client/client.go b/locations/client/client.go index 6a223fa..3bbd954 100644 --- a/locations/client/client.go +++ b/locations/client/client.go @@ -4,13 +4,12 @@ package client import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + transactions "github.com/square/square-go-sdk/locations/transactions" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - transactions "github.com/fern-demo/square-go-sdk/locations/transactions" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { diff --git a/locations/transactions.go b/locations/transactions.go index 55e5842..25c5b38 100644 --- a/locations/transactions.go +++ b/locations/transactions.go @@ -3,7 +3,7 @@ package locations import ( - squaregosdk "github.com/fern-demo/square-go-sdk" + squaregosdk "github.com/square/square-go-sdk" ) type TransactionsListRequest struct { diff --git a/locations/transactions/client.go b/locations/transactions/client.go index eaaef68..3462f57 100644 --- a/locations/transactions/client.go +++ b/locations/transactions/client.go @@ -4,13 +4,12 @@ package transactions import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + locations "github.com/square/square-go-sdk/locations" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - locations "github.com/fern-demo/square-go-sdk/locations" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { diff --git a/loyalty/accounts.go b/loyalty/accounts.go index 54f0239..96db969 100644 --- a/loyalty/accounts.go +++ b/loyalty/accounts.go @@ -3,7 +3,7 @@ package loyalty import ( - squaregosdk "github.com/fern-demo/square-go-sdk" + squaregosdk "github.com/square/square-go-sdk" ) type AccumulateLoyaltyPointsRequest struct { diff --git a/loyalty/accounts/client.go b/loyalty/accounts/client.go index c9776ad..af99136 100644 --- a/loyalty/accounts/client.go +++ b/loyalty/accounts/client.go @@ -4,13 +4,12 @@ package accounts import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + loyalty "github.com/square/square-go-sdk/loyalty" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - loyalty "github.com/fern-demo/square-go-sdk/loyalty" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { @@ -160,18 +159,18 @@ func (c *Client) Get( return response, nil } -// Adds points earned from a purchase to a [loyalty account]($m/LoyaltyAccount). +// Adds points earned from a purchase to a [loyalty account](entity:LoyaltyAccount). // // - If you are using the Orders API to manage orders, provide the `order_id`. Square reads the order // to compute the points earned from both the base loyalty program and an associated -// [loyalty promotion]($m/LoyaltyPromotion). For purchases that qualify for multiple accrual +// [loyalty promotion](entity:LoyaltyPromotion). For purchases that qualify for multiple accrual // rules, Square computes points based on the accrual rule that grants the most points. // For purchases that qualify for multiple promotions, Square computes points based on the most // recently created promotion. A purchase must first qualify for program points to be eligible for promotion points. // // - If you are not using the Orders API to manage orders, provide `points` with the number of points to add. // You must first perform a client-side computation of the points earned from the loyalty program and -// loyalty promotion. For spend-based and visit-based programs, you can call [CalculateLoyaltyPoints]($e/Loyalty/CalculateLoyaltyPoints) +// loyalty promotion. For spend-based and visit-based programs, you can call [CalculateLoyaltyPoints](api-endpoint:Loyalty-CalculateLoyaltyPoints) // to compute the points earned from the base loyalty program. For information about computing points earned from a loyalty promotion, see // [Calculating promotion points](https://developer.squareup.com/docs/loyalty-api/loyalty-promotions#calculate-promotion-points). func (c *Client) AccumulatePoints( @@ -217,7 +216,7 @@ func (c *Client) AccumulatePoints( // Adds points to or subtracts points from a buyer's account. // // Use this endpoint only when you need to manually adjust points. Otherwise, in your application flow, you call -// [AccumulateLoyaltyPoints]($e/Loyalty/AccumulateLoyaltyPoints) +// [AccumulateLoyaltyPoints](api-endpoint:Loyalty-AccumulateLoyaltyPoints) // to add points when a buyer pays for the purchase. func (c *Client) Adjust( ctx context.Context, diff --git a/loyalty/client/client.go b/loyalty/client/client.go index 3a35dad..28b3873 100644 --- a/loyalty/client/client.go +++ b/loyalty/client/client.go @@ -4,15 +4,14 @@ package client import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + accounts "github.com/square/square-go-sdk/loyalty/accounts" + programsclient "github.com/square/square-go-sdk/loyalty/programs/client" + rewards "github.com/square/square-go-sdk/loyalty/rewards" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - accounts "github.com/fern-demo/square-go-sdk/loyalty/accounts" - programsclient "github.com/fern-demo/square-go-sdk/loyalty/programs/client" - rewards "github.com/fern-demo/square-go-sdk/loyalty/rewards" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { diff --git a/loyalty/programs.go b/loyalty/programs.go index b67784c..8d02ca3 100644 --- a/loyalty/programs.go +++ b/loyalty/programs.go @@ -3,7 +3,7 @@ package loyalty import ( - squaregosdk "github.com/fern-demo/square-go-sdk" + squaregosdk "github.com/square/square-go-sdk" ) type CalculateLoyaltyPointsRequest struct { diff --git a/loyalty/programs/client/client.go b/loyalty/programs/client/client.go index 91eb6fc..c01f97c 100644 --- a/loyalty/programs/client/client.go +++ b/loyalty/programs/client/client.go @@ -4,14 +4,13 @@ package client import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + loyalty "github.com/square/square-go-sdk/loyalty" + promotions "github.com/square/square-go-sdk/loyalty/programs/promotions" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - loyalty "github.com/fern-demo/square-go-sdk/loyalty" - promotions "github.com/fern-demo/square-go-sdk/loyalty/programs/promotions" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { @@ -129,14 +128,14 @@ func (c *Client) Get( // // - If you are using the Orders API to manage orders, provide the `order_id` and (optional) `loyalty_account_id`. // Square reads the order to compute the points earned from the base loyalty program and an associated -// [loyalty promotion]($m/LoyaltyPromotion). +// [loyalty promotion](entity:LoyaltyPromotion). // // - If you are not using the Orders API to manage orders, provide `transaction_amount_money` with the // purchase amount. Square uses this amount to calculate the points earned from the base loyalty program, // but not points earned from a loyalty promotion. For spend-based and visit-based programs, the `tax_mode` // setting of the accrual rule indicates how taxes should be treated for loyalty points accrual. // If the purchase qualifies for program points, call -// [ListLoyaltyPromotions]($e/Loyalty/ListLoyaltyPromotions) and perform a client-side computation +// [ListLoyaltyPromotions](api-endpoint:Loyalty-ListLoyaltyPromotions) and perform a client-side computation // to calculate whether the purchase also qualifies for promotion points. For more information, see // [Calculating promotion points](https://developer.squareup.com/docs/loyalty-api/loyalty-promotions#calculate-promotion-points). func (c *Client) Calculate( diff --git a/loyalty/programs/promotions.go b/loyalty/programs/promotions.go index 0105301..617b99b 100644 --- a/loyalty/programs/promotions.go +++ b/loyalty/programs/promotions.go @@ -3,7 +3,7 @@ package programs import ( - squaregosdk "github.com/fern-demo/square-go-sdk" + squaregosdk "github.com/square/square-go-sdk" ) type CreateLoyaltyPromotionRequest struct { diff --git a/loyalty/programs/promotions/client.go b/loyalty/programs/promotions/client.go index 2a30cc1..54c8c40 100644 --- a/loyalty/programs/promotions/client.go +++ b/loyalty/programs/promotions/client.go @@ -5,13 +5,12 @@ package promotions import ( context "context" fmt "fmt" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + programs "github.com/square/square-go-sdk/loyalty/programs" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - programs "github.com/fern-demo/square-go-sdk/loyalty/programs" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { @@ -40,7 +39,7 @@ func NewClient(opts ...option.RequestOption) *Client { } } -// Lists the loyalty promotions associated with a [loyalty program]($m/LoyaltyProgram). +// Lists the loyalty promotions associated with a [loyalty program](entity:LoyaltyProgram). // Results are sorted by the `created_at` date in descending order (newest to oldest). func (c *Client) List( ctx context.Context, @@ -103,7 +102,7 @@ func (c *Client) List( return pager.GetPage(ctx, request.Cursor) } -// Creates a loyalty promotion for a [loyalty program]($m/LoyaltyProgram). A loyalty promotion +// Creates a loyalty promotion for a [loyalty program](entity:LoyaltyProgram). A loyalty promotion // enables buyers to earn points in addition to those earned from the base loyalty program. // // This endpoint sets the loyalty promotion to the `ACTIVE` or `SCHEDULED` status, depending on the diff --git a/loyalty/rewards.go b/loyalty/rewards.go index 5fb5767..abda69a 100644 --- a/loyalty/rewards.go +++ b/loyalty/rewards.go @@ -3,7 +3,7 @@ package loyalty import ( - squaregosdk "github.com/fern-demo/square-go-sdk" + squaregosdk "github.com/square/square-go-sdk" ) type CreateLoyaltyRewardRequest struct { diff --git a/loyalty/rewards/client.go b/loyalty/rewards/client.go index 62c40a1..3b401a3 100644 --- a/loyalty/rewards/client.go +++ b/loyalty/rewards/client.go @@ -4,13 +4,12 @@ package rewards import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + loyalty "github.com/square/square-go-sdk/loyalty" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - loyalty "github.com/fern-demo/square-go-sdk/loyalty" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { @@ -89,7 +88,7 @@ func (c *Client) Create( // If you include a `query` object, `loyalty_account_id` is required and `status` is optional. // // If you know a reward ID, use the -// [RetrieveLoyaltyReward]($e/Loyalty/RetrieveLoyaltyReward) endpoint. +// [RetrieveLoyaltyReward](api-endpoint:Loyalty-RetrieveLoyaltyReward) endpoint. // // Search results are sorted by `updated_at` in descending order. func (c *Client) Search( @@ -173,7 +172,7 @@ func (c *Client) Get( // // - Returns the loyalty points back to the loyalty account. // - If an order ID was specified when the reward was created -// (see [CreateLoyaltyReward]($e/Loyalty/CreateLoyaltyReward)), +// (see [CreateLoyaltyReward](api-endpoint:Loyalty-CreateLoyaltyReward)), // it updates the order by removing the reward and related // discounts. // diff --git a/merchantcustomattributes/client.go b/merchantcustomattributes/client.go index 9e756f4..0bbf848 100644 --- a/merchantcustomattributes/client.go +++ b/merchantcustomattributes/client.go @@ -4,12 +4,11 @@ package merchantcustomattributes import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { @@ -38,7 +37,7 @@ func NewClient(opts ...option.RequestOption) *Client { } } -// Lists the merchant-related [custom attribute definitions]($m/CustomAttributeDefinition) that belong to a Square seller account. +// Lists the merchant-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account. // When all response pages are retrieved, the results include all custom attribute definitions // that are visible to the requesting application, including those that are created by other // applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. @@ -87,12 +86,12 @@ func (c *Client) ListMerchantCustomAttributeDefinitions( return response, nil } -// Creates a merchant-related [custom attribute definition]($m/CustomAttributeDefinition) for a Square seller account. +// Creates a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account. // Use this endpoint to define a custom attribute that can be associated with a merchant connecting to your application. // A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties // for a custom attribute. After the definition is created, you can call -// [UpsertMerchantCustomAttribute]($e/MerchantCustomAttributes/UpsertMerchantCustomAttribute) or -// [BulkUpsertMerchantCustomAttributes]($e/MerchantCustomAttributes/BulkUpsertMerchantCustomAttributes) +// [UpsertMerchantCustomAttribute](api-endpoint:MerchantCustomAttributes-UpsertMerchantCustomAttribute) or +// [BulkUpsertMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkUpsertMerchantCustomAttributes) // to set the custom attribute for a merchant. func (c *Client) CreateMerchantCustomAttributeDefinition( ctx context.Context, @@ -132,7 +131,7 @@ func (c *Client) CreateMerchantCustomAttributeDefinition( return response, nil } -// Retrieves a merchant-related [custom attribute definition]($m/CustomAttributeDefinition) from a Square seller account. +// Retrieves a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account. // To retrieve a custom attribute definition created by another application, the `visibility` // setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. func (c *Client) RetrieveMerchantCustomAttributeDefinition( @@ -183,7 +182,7 @@ func (c *Client) RetrieveMerchantCustomAttributeDefinition( return response, nil } -// Updates a merchant-related [custom attribute definition]($m/CustomAttributeDefinition) for a Square seller account. +// Updates a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account. // Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the // `schema` for a `Selection` data type. // Only the definition owner can update a custom attribute definition. @@ -227,7 +226,7 @@ func (c *Client) UpdateMerchantCustomAttributeDefinition( return response, nil } -// Deletes a merchant-related [custom attribute definition]($m/CustomAttributeDefinition) from a Square seller account. +// Deletes a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account. // Deleting a custom attribute definition also deletes the corresponding custom attribute from // the merchant. // Only the definition owner can delete a custom attribute definition. @@ -269,7 +268,7 @@ func (c *Client) DeleteMerchantCustomAttributeDefinition( return response, nil } -// Deletes [custom attributes]($m/CustomAttribute) for a merchant as a bulk operation. +// Deletes [custom attributes](entity:CustomAttribute) for a merchant as a bulk operation. // To delete a custom attribute owned by another application, the `visibility` setting must be // `VISIBILITY_READ_WRITE_VALUES`. func (c *Client) BulkDeleteMerchantCustomAttributes( @@ -310,10 +309,10 @@ func (c *Client) BulkDeleteMerchantCustomAttributes( return response, nil } -// Creates or updates [custom attributes]($m/CustomAttribute) for a merchant as a bulk operation. +// Creates or updates [custom attributes](entity:CustomAttribute) for a merchant as a bulk operation. // Use this endpoint to set the value of one or more custom attributes for a merchant. // A custom attribute is based on a custom attribute definition in a Square seller account, which is -// created using the [CreateMerchantCustomAttributeDefinition]($e/MerchantCustomAttributes/CreateMerchantCustomAttributeDefinition) endpoint. +// created using the [CreateMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-CreateMerchantCustomAttributeDefinition) endpoint. // This `BulkUpsertMerchantCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert // requests and returns a map of individual upsert responses. Each upsert request has a unique ID // and provides a merchant ID and custom attribute. Each upsert response is returned with the ID @@ -358,7 +357,7 @@ func (c *Client) BulkUpsertMerchantCustomAttributes( return response, nil } -// Lists the [custom attributes]($m/CustomAttribute) associated with a merchant. +// Lists the [custom attributes](entity:CustomAttribute) associated with a merchant. // You can use the `with_definitions` query parameter to also retrieve custom attribute definitions // in the same call. // When all response pages are retrieved, the results include all custom attributes that are @@ -411,7 +410,7 @@ func (c *Client) ListMerchantCustomAttributes( return response, nil } -// Retrieves a [custom attribute]($m/CustomAttribute) associated with a merchant. +// Retrieves a [custom attribute](entity:CustomAttribute) associated with a merchant. // You can use the `with_definition` query parameter to also retrieve the custom attribute definition // in the same call. // To retrieve a custom attribute owned by another application, the `visibility` setting must be @@ -471,10 +470,10 @@ func (c *Client) RetrieveMerchantCustomAttribute( return response, nil } -// Creates or updates a [custom attribute]($m/CustomAttribute) for a merchant. +// Creates or updates a [custom attribute](entity:CustomAttribute) for a merchant. // Use this endpoint to set the value of a custom attribute for a specified merchant. // A custom attribute is based on a custom attribute definition in a Square seller account, which -// is created using the [CreateMerchantCustomAttributeDefinition]($e/MerchantCustomAttributes/CreateMerchantCustomAttributeDefinition) endpoint. +// is created using the [CreateMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-CreateMerchantCustomAttributeDefinition) endpoint. // To create or update a custom attribute owned by another application, the `visibility` setting // must be `VISIBILITY_READ_WRITE_VALUES`. func (c *Client) UpsertMerchantCustomAttribute( @@ -525,7 +524,7 @@ func (c *Client) UpsertMerchantCustomAttribute( return response, nil } -// Deletes a [custom attribute]($m/CustomAttribute) associated with a merchant. +// Deletes a [custom attribute](entity:CustomAttribute) associated with a merchant. // To delete a custom attribute owned by another application, the `visibility` setting must be // `VISIBILITY_READ_WRITE_VALUES`. func (c *Client) DeleteMerchantCustomAttribute( diff --git a/merchants/client.go b/merchants/client.go index 71fa291..bba9ab3 100644 --- a/merchants/client.go +++ b/merchants/client.go @@ -5,12 +5,11 @@ package merchants import ( context "context" fmt "fmt" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { @@ -47,7 +46,7 @@ func NewClient(opts ...option.RequestOption) *Client { // to get your own merchant information or specify an OAuth token to get the // information for the merchant that granted your application access. // -// If you know the merchant ID, you can also use the [RetrieveMerchant]($e/Merchants/RetrieveMerchant) +// If you know the merchant ID, you can also use the [RetrieveMerchant](api-endpoint:Merchants-RetrieveMerchant) // endpoint to retrieve the merchant information. func (c *Client) List( ctx context.Context, diff --git a/mobile/client.go b/mobile/client.go index 92b973b..aa5df35 100644 --- a/mobile/client.go +++ b/mobile/client.go @@ -4,12 +4,11 @@ package mobile import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { diff --git a/o_auth.go b/o_auth.go index 1f93f14..91d2cdd 100644 --- a/o_auth.go +++ b/o_auth.go @@ -2,6 +2,40 @@ package square +type OAuthAuthorizeRequest struct { + // The Square-issued ID for your application, which is available on + // the **OAuth** page for your application in the [Developer Dashboard](https://developer.squareup.com/apps). + ClientID string `json:"-" url:"client_id"` + // A space-separated list of the permissions that the application is requesting. + // Default: "`MERCHANT_PROFILE_READ PAYMENTS_READ SETTLEMENTS_READ BANK_ACCOUNTS_READ`" + Scope *OAuthPermission `json:"-" url:"scope,omitempty"` + // The locale to present the permission request form in. Square detects + // the appropriate locale automatically. Only provide this value if the + // application can definitively determine the preferred locale. + // + // Currently supported values: `en-IE`, `en-US`, `en-CA`, `es-US`, `fr-CA`, and + // `ja-JP`. + Locale *string `json:"-" url:"locale,omitempty"` + // If `false`, the user must log in to their Square account to + // view the Permission Request form, even if they already have a valid user + // session. This value has no effect in the Square Sandbox. + // Default: `true` + Session *bool `json:"-" url:"session,omitempty"` + // When provided, `state` is passed to the configured redirect URL after + // the Permission Request form is submitted. You can include `state` and verify + // its value to help protect against cross-site request forgery. + State *string `json:"-" url:"state,omitempty"` + // When provided, the OAuth flow uses PKCE to authorize. The `code_challenge` will be associated + // with the authorization_code and a `code_verifier` will need to passed in to obtain the access token. + CodeChallenge *string `json:"-" url:"code_challenge,omitempty"` + // The redirect URL assigned on the **OAuth** page for your application in the [Developer Dashboard](https://developer.squareup.com/apps). + // This field is required to use a dynamic port at runtime (PKCE only). To use a dynamic port, use the literal "<port>" + // as a placeholder for a port in the **Redirect URL** box in the [Developer Dashboard](https://developer.squareup.com/apps), + // for example, "http://localhost:<port>". When you call the `Authorize` endpoint from an application, pass in the actual + // port in this field. For example: `https://connect.squareup.com/oauth2/authorize?client_id={YOUR_APP_ID}&scope=MERCHANT_PROFILE_READ&redirect_uri=http://localhost:8000` + RedirectURI *string `json:"-" url:"redirect_uri,omitempty"` +} + type ObtainTokenRequest struct { // The Square-issued ID of your application, which is available on the **OAuth** page in the // [Developer Dashboard](https://developer.squareup.com/apps). @@ -49,6 +83,11 @@ type ObtainTokenRequest struct { CodeVerifier *string `json:"code_verifier,omitempty" url:"-"` } +type RenewTokenRequest struct { + // The token you want to renew. + AccessToken *string `json:"access_token,omitempty" url:"-"` +} + type RevokeTokenRequest struct { // The Square-issued ID for your application, which is available on the **OAuth** page in the // [Developer Dashboard](https://developer.squareup.com/apps). diff --git a/oauth/client.go b/oauth/client.go index 9e40ca3..530affd 100644 --- a/oauth/client.go +++ b/oauth/client.go @@ -4,12 +4,11 @@ package oauth import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { @@ -38,25 +37,31 @@ func NewClient(opts ...option.RequestOption) *Client { } } -// Revokes an access token generated with the OAuth flow. +// As part of a URL sent to a seller to authorize permissions for +// the developer, `Authorize` displays an authorization page and a +// list of requested permissions. // -// If an account has more than one OAuth access token for your application, this -// endpoint revokes all of them, regardless of which token you specify. +// The completed URL looks similar to the following example: +// https://connect.squareup.com/oauth2/authorize?client_id={YOUR_APP_ID}&scope=CUSTOMERS_WRITE+CUSTOMERS_READ&session=False&state=82201dd8d83d23cc8a48caf52b // -// **Important:** The `Authorization` header for this endpoint must have the -// following format: +// The seller can approve or deny the permissions. If approved,` Authorize` +// returns an `AuthorizeResponse` that is sent to the redirect URL and includes +// a state string and an authorization code. The code is used in the `ObtainToken` +// call to obtain an access token and a refresh token that the developer uses +// to manage resources on behalf of the seller. // -// ``` -// Authorization: Client APPLICATION_SECRET -// ``` +// **Important:** The `AuthorizeResponse` is sent to the redirect URL that you set on +// the **OAuth** page of your application in the Developer Dashboard. // -// Replace `APPLICATION_SECRET` with the application secret on the **OAuth** -// page for your application in the Developer Dashboard. -func (c *Client) RevokeToken( +// If an error occurs or the seller denies the request, `Authorize` returns an +// error response that includes `error` and `error_description` values. If the +// error is due to the seller denying the request, the error value is `access_denied` +// and the `error_description` is `user_denied`. +func (c *Client) Authorize( ctx context.Context, - request *squaregosdk.RevokeTokenRequest, + request *squaregosdk.OAuthAuthorizeRequest, opts ...option.RequestOption, -) (*squaregosdk.RevokeTokenResponse, error) { +) (*squaregosdk.AuthorizeResponse, error) { options := core.NewRequestOptions(opts...) baseURL := "https://connect.squareupsandbox.com" @@ -66,22 +71,29 @@ func (c *Client) RevokeToken( if options.BaseURL != "" { baseURL = options.BaseURL } - endpointURL := baseURL + "/oauth2/revoke" + endpointURL := baseURL + "/oauth2/authorize" + + queryParams, err := core.QueryValues(request) + if err != nil { + return nil, err + } + if len(queryParams) > 0 { + endpointURL += "?" + queryParams.Encode() + } headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - var response *squaregosdk.RevokeTokenResponse + var response *squaregosdk.AuthorizeResponse if err := c.caller.Call( ctx, &core.CallParams{ URL: endpointURL, - Method: http.MethodPost, + Method: http.MethodGet, MaxAttempts: options.MaxAttempts, Headers: headers, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, - Request: request, Response: &response, }, ); err != nil { @@ -90,28 +102,32 @@ func (c *Client) RevokeToken( return response, nil } -// Returns an OAuth access token and a refresh token unless the -// `short_lived` parameter is set to `true`, in which case the endpoint -// returns only an access token. +// `RenewToken` is deprecated. For information about refreshing OAuth access tokens, see +// [Migrate from Renew to Refresh OAuth Tokens](https://developer.squareup.com/docs/oauth-api/migrate-to-refresh-tokens). // -// The `grant_type` parameter specifies the type of OAuth request. If -// `grant_type` is `authorization_code`, you must include the authorization -// code you received when a seller granted you authorization. If `grant_type` -// is `refresh_token`, you must provide a valid refresh token. If you're using -// an old version of the Square APIs (prior to March 13, 2019), `grant_type` -// can be `migration_token` and you must provide a valid migration token. +// Renews an OAuth access token before it expires. // -// You can use the `scopes` parameter to limit the set of permissions granted -// to the access token and refresh token. You can use the `short_lived` parameter -// to create an access token that expires in 24 hours. +// OAuth access tokens besides your application's personal access token expire after 30 days. +// You can also renew expired tokens within 15 days of their expiration. +// You cannot renew an access token that has been expired for more than 15 days. +// Instead, the associated user must recomplete the OAuth flow from the beginning. // -// **Note:** OAuth tokens should be encrypted and stored on a secure server. -// Application clients should never interact directly with OAuth tokens. -func (c *Client) ObtainToken( +// **Important:** The `Authorization` header for this endpoint must have the +// following format: +// +// ``` +// Authorization: Client APPLICATION_SECRET +// ``` +// +// Replace `APPLICATION_SECRET` with the application secret on the **Credentials** +// page in the [Developer Dashboard](https://developer.squareup.com/apps). +func (c *Client) RenewToken( ctx context.Context, - request *squaregosdk.ObtainTokenRequest, + // Your application ID, which is available on the **OAuth** page in the [Developer Dashboard](https://developer.squareup.com/apps). + clientID string, + request *squaregosdk.RenewTokenRequest, opts ...option.RequestOption, -) (*squaregosdk.ObtainTokenResponse, error) { +) (*squaregosdk.RenewTokenResponse, error) { options := core.NewRequestOptions(opts...) baseURL := "https://connect.squareupsandbox.com" @@ -121,11 +137,11 @@ func (c *Client) ObtainToken( if options.BaseURL != "" { baseURL = options.BaseURL } - endpointURL := baseURL + "/oauth2/token" + endpointURL := core.EncodeURL(baseURL+"/oauth2/clients/%v/access-token/renew", clientID) headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - var response *squaregosdk.ObtainTokenResponse + var response *squaregosdk.RenewTokenResponse if err := c.caller.Call( ctx, &core.CallParams{ @@ -145,24 +161,25 @@ func (c *Client) ObtainToken( return response, nil } -// Returns information about an [OAuth access token](https://developer.squareup.com/docs/build-basics/access-tokens#get-an-oauth-access-token) or an application’s [personal access token](https://developer.squareup.com/docs/build-basics/access-tokens#get-a-personal-access-token). +// Revokes an access token generated with the OAuth flow. // -// Add the access token to the Authorization header of the request. +// If an account has more than one OAuth access token for your application, this +// endpoint revokes all of them, regardless of which token you specify. // -// **Important:** The `Authorization` header you provide to this endpoint must have the following format: +// **Important:** The `Authorization` header for this endpoint must have the +// following format: // // ``` -// Authorization: Bearer ACCESS_TOKEN +// Authorization: Client APPLICATION_SECRET // ``` // -// where `ACCESS_TOKEN` is a -// [valid production authorization credential](https://developer.squareup.com/docs/build-basics/access-tokens). -// -// If the access token is expired or not a valid access token, the endpoint returns an `UNAUTHORIZED` error. -func (c *Client) RetrieveTokenStatus( +// Replace `APPLICATION_SECRET` with the application secret on the **OAuth** +// page for your application in the Developer Dashboard. +func (c *Client) RevokeToken( ctx context.Context, + request *squaregosdk.RevokeTokenRequest, opts ...option.RequestOption, -) (*squaregosdk.RetrieveTokenStatusResponse, error) { +) (*squaregosdk.RevokeTokenResponse, error) { options := core.NewRequestOptions(opts...) baseURL := "https://connect.squareupsandbox.com" @@ -172,11 +189,11 @@ func (c *Client) RetrieveTokenStatus( if options.BaseURL != "" { baseURL = options.BaseURL } - endpointURL := baseURL + "/oauth2/token/status" + endpointURL := baseURL + "/oauth2/revoke" headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - var response *squaregosdk.RetrieveTokenStatusResponse + var response *squaregosdk.RevokeTokenResponse if err := c.caller.Call( ctx, &core.CallParams{ @@ -187,6 +204,7 @@ func (c *Client) RetrieveTokenStatus( BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, + Request: request, Response: &response, }, ); err != nil { @@ -195,10 +213,28 @@ func (c *Client) RetrieveTokenStatus( return response, nil } -func (c *Client) Authorize( +// Returns an OAuth access token and a refresh token unless the +// `short_lived` parameter is set to `true`, in which case the endpoint +// returns only an access token. +// +// The `grant_type` parameter specifies the type of OAuth request. If +// `grant_type` is `authorization_code`, you must include the authorization +// code you received when a seller granted you authorization. If `grant_type` +// is `refresh_token`, you must provide a valid refresh token. If you're using +// an old version of the Square APIs (prior to March 13, 2019), `grant_type` +// can be `migration_token` and you must provide a valid migration token. +// +// You can use the `scopes` parameter to limit the set of permissions granted +// to the access token and refresh token. You can use the `short_lived` parameter +// to create an access token that expires in 24 hours. +// +// **Note:** OAuth tokens should be encrypted and stored on a secure server. +// Application clients should never interact directly with OAuth tokens. +func (c *Client) ObtainToken( ctx context.Context, + request *squaregosdk.ObtainTokenRequest, opts ...option.RequestOption, -) error { +) (*squaregosdk.ObtainTokenResponse, error) { options := core.NewRequestOptions(opts...) baseURL := "https://connect.squareupsandbox.com" @@ -208,32 +244,48 @@ func (c *Client) Authorize( if options.BaseURL != "" { baseURL = options.BaseURL } - endpointURL := baseURL + "/oauth2/authorize" + endpointURL := baseURL + "/oauth2/token" headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) + var response *squaregosdk.ObtainTokenResponse if err := c.caller.Call( ctx, &core.CallParams{ URL: endpointURL, - Method: http.MethodGet, + Method: http.MethodPost, MaxAttempts: options.MaxAttempts, Headers: headers, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, + Request: request, + Response: &response, }, ); err != nil { - return err + return nil, err } - return nil + return response, nil } -func (c *Client) RenewToken( +// Returns information about an [OAuth access token](https://developer.squareup.com/docs/build-basics/access-tokens#get-an-oauth-access-token) or an application’s [personal access token](https://developer.squareup.com/docs/build-basics/access-tokens#get-a-personal-access-token). +// +// Add the access token to the Authorization header of the request. +// +// **Important:** The `Authorization` header you provide to this endpoint must have the following format: +// +// ``` +// Authorization: Bearer ACCESS_TOKEN +// ``` +// +// where `ACCESS_TOKEN` is a +// [valid production authorization credential](https://developer.squareup.com/docs/build-basics/access-tokens). +// +// If the access token is expired or not a valid access token, the endpoint returns an `UNAUTHORIZED` error. +func (c *Client) RetrieveTokenStatus( ctx context.Context, - clientID string, opts ...option.RequestOption, -) error { +) (*squaregosdk.RetrieveTokenStatusResponse, error) { options := core.NewRequestOptions(opts...) baseURL := "https://connect.squareupsandbox.com" @@ -243,10 +295,11 @@ func (c *Client) RenewToken( if options.BaseURL != "" { baseURL = options.BaseURL } - endpointURL := core.EncodeURL(baseURL+"/oauth2/clients/%v/access-token/renew", clientID) + endpointURL := baseURL + "/oauth2/token/status" headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) + var response *squaregosdk.RetrieveTokenStatusResponse if err := c.caller.Call( ctx, &core.CallParams{ @@ -257,9 +310,10 @@ func (c *Client) RenewToken( BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, + Response: &response, }, ); err != nil { - return err + return nil, err } - return nil + return response, nil } diff --git a/option/request_option.go b/option/request_option.go index 9ccf772..d975daa 100644 --- a/option/request_option.go +++ b/option/request_option.go @@ -3,10 +3,9 @@ package option import ( + core "github.com/square/square-go-sdk/core" http "net/http" url "net/url" - - core "github.com/fern-demo/square-go-sdk/core" ) // RequestOption adapts the behavior of an indivdual request. diff --git a/ordercustomattributes/client.go b/ordercustomattributes/client.go index 95709b8..ec709ff 100644 --- a/ordercustomattributes/client.go +++ b/ordercustomattributes/client.go @@ -4,12 +4,11 @@ package ordercustomattributes import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { @@ -38,7 +37,7 @@ func NewClient(opts ...option.RequestOption) *Client { } } -// Lists the order-related [custom attribute definitions]($m/CustomAttributeDefinition) that belong to a Square seller account. +// Lists the order-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account. // // When all response pages are retrieved, the results include all custom attribute definitions // that are visible to the requesting application, including those that are created by other @@ -132,7 +131,7 @@ func (c *Client) CreateOrderCustomAttributeDefinition( return response, nil } -// Retrieves an order-related [custom attribute definition]($m/CustomAttributeDefinition) from a Square seller account. +// Retrieves an order-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account. // // To retrieve a custom attribute definition created by another application, the `visibility` // setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes @@ -227,7 +226,7 @@ func (c *Client) UpdateOrderCustomAttributeDefinition( return response, nil } -// Deletes an order-related [custom attribute definition]($m/CustomAttributeDefinition) from a Square seller account. +// Deletes an order-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account. // // Only the definition owner can delete a custom attribute definition. func (c *Client) DeleteOrderCustomAttributeDefinition( @@ -268,11 +267,11 @@ func (c *Client) DeleteOrderCustomAttributeDefinition( return response, nil } -// Deletes order [custom attributes]($m/CustomAttribute) as a bulk operation. +// Deletes order [custom attributes](entity:CustomAttribute) as a bulk operation. // // Use this endpoint to delete one or more custom attributes from one or more orders. // A custom attribute is based on a custom attribute definition in a Square seller account. (To create a -// custom attribute definition, use the [CreateOrderCustomAttributeDefinition]($e/OrderCustomAttributes/CreateOrderCustomAttributeDefinition) endpoint.) +// custom attribute definition, use the [CreateOrderCustomAttributeDefinition](api-endpoint:OrderCustomAttributes-CreateOrderCustomAttributeDefinition) endpoint.) // // This `BulkDeleteOrderCustomAttributes` endpoint accepts a map of 1 to 25 individual delete // requests and returns a map of individual delete responses. Each delete request has a unique ID @@ -320,11 +319,11 @@ func (c *Client) BulkDeleteOrderCustomAttributes( return response, nil } -// Creates or updates order [custom attributes]($m/CustomAttribute) as a bulk operation. +// Creates or updates order [custom attributes](entity:CustomAttribute) as a bulk operation. // // Use this endpoint to delete one or more custom attributes from one or more orders. // A custom attribute is based on a custom attribute definition in a Square seller account. (To create a -// custom attribute definition, use the [CreateOrderCustomAttributeDefinition]($e/OrderCustomAttributes/CreateOrderCustomAttributeDefinition) endpoint.) +// custom attribute definition, use the [CreateOrderCustomAttributeDefinition](api-endpoint:OrderCustomAttributes-CreateOrderCustomAttributeDefinition) endpoint.) // // This `BulkUpsertOrderCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert // requests and returns a map of individual upsert responses. Each upsert request has a unique ID @@ -372,7 +371,7 @@ func (c *Client) BulkUpsertOrderCustomAttributes( return response, nil } -// Lists the [custom attributes]($m/CustomAttribute) associated with an order. +// Lists the [custom attributes](entity:CustomAttribute) associated with an order. // // You can use the `with_definitions` query parameter to also retrieve custom attribute definitions // in the same call. @@ -427,7 +426,7 @@ func (c *Client) ListOrderCustomAttributes( return response, nil } -// Retrieves a [custom attribute]($m/CustomAttribute) associated with an order. +// Retrieves a [custom attribute](entity:CustomAttribute) associated with an order. // // You can use the `with_definition` query parameter to also retrieve the custom attribute definition // in the same call. @@ -489,11 +488,11 @@ func (c *Client) RetrieveOrderCustomAttribute( return response, nil } -// Creates or updates a [custom attribute]($m/CustomAttribute) for an order. +// Creates or updates a [custom attribute](entity:CustomAttribute) for an order. // // Use this endpoint to set the value of a custom attribute for a specific order. // A custom attribute is based on a custom attribute definition in a Square seller account. (To create a -// custom attribute definition, use the [CreateOrderCustomAttributeDefinition]($e/OrderCustomAttributes/CreateOrderCustomAttributeDefinition) endpoint.) +// custom attribute definition, use the [CreateOrderCustomAttributeDefinition](api-endpoint:OrderCustomAttributes-CreateOrderCustomAttributeDefinition) endpoint.) // // To create or update a custom attribute owned by another application, the `visibility` setting // must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes @@ -545,7 +544,7 @@ func (c *Client) UpsertOrderCustomAttribute( return response, nil } -// Deletes a [custom attribute]($m/CustomAttribute) associated with a customer profile. +// Deletes a [custom attribute](entity:CustomAttribute) associated with a customer profile. // // To delete a custom attribute owned by another application, the `visibility` setting must be // `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes diff --git a/orders/client.go b/orders/client.go index 1febd34..d19d5a5 100644 --- a/orders/client.go +++ b/orders/client.go @@ -4,12 +4,11 @@ package orders import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { @@ -38,13 +37,13 @@ func NewClient(opts ...option.RequestOption) *Client { } } -// Creates a new [order]($m/Order) that can include information about products for +// Creates a new [order](entity:Order) that can include information about products for // purchase and settings to apply to the purchase. // // To pay for a created order, see // [Pay for Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders). // -// You can modify open orders using the [UpdateOrder]($e/Orders/UpdateOrder) endpoint. +// You can modify open orders using the [UpdateOrder](api-endpoint:Orders-UpdateOrder) endpoint. func (c *Client) Create( ctx context.Context, request *squaregosdk.CreateOrderRequest, @@ -83,7 +82,7 @@ func (c *Client) Create( return response, nil } -// Retrieves a set of [orders]($m/Order) by their IDs. +// Retrieves a set of [orders](entity:Order) by their IDs. // // If a given order ID does not exist, the ID is ignored instead of generating an error. func (c *Client) BatchGet( @@ -208,13 +207,13 @@ func (c *Client) Clone( // ecosystem (such as Point of Sale, Invoices, and Connect APIs). // // `SearchOrders` requests need to specify which locations to search and define a -// [SearchOrdersQuery]($m/SearchOrdersQuery) object that controls +// [SearchOrdersQuery](entity:SearchOrdersQuery) object that controls // how to sort or filter the results. Your `SearchOrdersQuery` can: // // Set filter criteria. // Set the sort order. // Determine whether to return results as complete `Order` objects or as -// [OrderEntry]($m/OrderEntry) objects. +// [OrderEntry](entity:OrderEntry) objects. // // Note that details for orders processed with Square Point of Sale while in // offline mode might not be transmitted to Square for up to 72 hours. Offline @@ -258,7 +257,7 @@ func (c *Client) Search( return response, nil } -// Retrieves an [Order]($m/Order) by ID. +// Retrieves an [Order](entity:Order) by ID. func (c *Client) Get( ctx context.Context, // The ID of the order to retrieve. @@ -297,7 +296,7 @@ func (c *Client) Get( return response, nil } -// Updates an open [order]($m/Order) by adding, replacing, or deleting +// Updates an open [order](entity:Order) by adding, replacing, or deleting // fields. Orders with a `COMPLETED` or `CANCELED` state cannot be updated. // // An `UpdateOrder` request requires the following: @@ -352,7 +351,7 @@ func (c *Client) Update( return response, nil } -// Pay for an [order]($m/Order) using one or more approved [payments]($m/Payment) +// Pay for an [order](entity:Order) using one or more approved [payments](entity:Payment) // or settle an order with a total of `0`. // // The total of the `payment_ids` listed in the request must be equal to the order @@ -361,7 +360,7 @@ func (c *Client) Update( // // To be used with `PayOrder`, a payment must: // -// - Reference the order by specifying the `order_id` when [creating the payment]($e/Payments/CreatePayment). +// - Reference the order by specifying the `order_id` when [creating the payment](api-endpoint:Payments-CreatePayment). // Any approved payments that reference the same `order_id` not specified in the // `payment_ids` is canceled. // - Be approved with [delayed capture](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture). diff --git a/payments/client.go b/payments/client.go index db37d65..3c30c58 100644 --- a/payments/client.go +++ b/payments/client.go @@ -5,12 +5,11 @@ package payments import ( context "context" fmt "fmt" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { diff --git a/payouts/client.go b/payouts/client.go index 2917062..4fd84ba 100644 --- a/payouts/client.go +++ b/payouts/client.go @@ -5,12 +5,11 @@ package payouts import ( context "context" fmt "fmt" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { diff --git a/refunds.go b/refunds.go index 7a28878..a95d822 100644 --- a/refunds.go +++ b/refunds.go @@ -40,13 +40,11 @@ type RefundPaymentRequest struct { // The unique ID of the payment being refunded. // Required when unlinked=false, otherwise must not be set. PaymentID *string `json:"payment_id,omitempty" url:"-"` - // The ID indicating where funds will be refunded to. Required for unlinked refunds. For more - // information, see [Create an unlinked refund](https://developer.squareup.com/docs/payments-api/refund-payments#create-an-unlinked-refund). - // - // For refunds linked to Square payments, destination_id is usually omitted; in this case, funds - // will be returned to the original payment source. The field may be specified in order to request - // a cross-method refund to a gift card. For more information, - // see [Cross-method refunds to gift cards](https://developer.squareup.com/docs/payments-api/refund-payments#cross-method-refunds-to-gift-cards). + // The ID indicating where funds will be refunded to, if this is an unlinked refund. + // This can be any of the following: A token generated by Web Payments SDK; + // a card-on-file identifier. + // Required for requests specifying unlinked=true. + // Otherwise, if included when `unlinked=false`, will throw an error. DestinationID *string `json:"destination_id,omitempty" url:"-"` // Indicates that the refund is not linked to a Square payment. // If set to true, `destination_id` and `location_id` must be supplied while `payment_id` must not @@ -70,11 +68,6 @@ type RefundPaymentRequest struct { PaymentVersionToken *string `json:"payment_version_token,omitempty" url:"-"` // An optional [TeamMember](entity:TeamMember) ID to associate with this refund. TeamMemberID *string `json:"team_member_id,omitempty" url:"-"` - // Additional details required when recording a cash refund (`destination_id` is CASH). - CashDetails *DestinationDetailsCashRefundDetails `json:"cash_details,omitempty" url:"-"` - // Additional details required when recording an external refund - // (`destination_id` is EXTERNAL). - ExternalDetails *DestinationDetailsExternalRefundDetails `json:"external_details,omitempty" url:"-"` } type RefundsListRequest struct { diff --git a/refunds/client.go b/refunds/client.go index b1974ce..e8546de 100644 --- a/refunds/client.go +++ b/refunds/client.go @@ -5,12 +5,11 @@ package refunds import ( context "context" fmt "fmt" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { diff --git a/sites/client.go b/sites/client.go index f0717b8..6e16785 100644 --- a/sites/client.go +++ b/sites/client.go @@ -4,12 +4,11 @@ package sites import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { diff --git a/snippets/client.go b/snippets/client.go index b8081b2..42dbd64 100644 --- a/snippets/client.go +++ b/snippets/client.go @@ -4,12 +4,11 @@ package snippets import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { @@ -40,7 +39,7 @@ func NewClient(opts ...option.RequestOption) *Client { // Retrieves your snippet from a Square Online site. A site can contain snippets from multiple snippet applications, but you can retrieve only the snippet that was added by your application. // -// You can call [ListSites]($e/Sites/ListSites) to get the IDs of the sites that belong to a seller. +// You can call [ListSites](api-endpoint:Sites-ListSites) to get the IDs of the sites that belong to a seller. // // **Note:** Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis). func (c *Client) Get( @@ -84,7 +83,7 @@ func (c *Client) Get( // Adds a snippet to a Square Online site or updates the existing snippet on the site. // The snippet code is appended to the end of the `head` element on every page of the site, except checkout pages. A snippet application can add one snippet to a given site. // -// You can call [ListSites]($e/Sites/ListSites) to get the IDs of the sites that belong to a seller. +// You can call [ListSites](api-endpoint:Sites-ListSites) to get the IDs of the sites that belong to a seller. // // **Note:** Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis). func (c *Client) Upsert( @@ -129,7 +128,7 @@ func (c *Client) Upsert( // Removes your snippet from a Square Online site. // -// You can call [ListSites]($e/Sites/ListSites) to get the IDs of the sites that belong to a seller. +// You can call [ListSites](api-endpoint:Sites-ListSites) to get the IDs of the sites that belong to a seller. // // **Note:** Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis). func (c *Client) Delete( diff --git a/subscriptions.go b/subscriptions.go index 867561d..726fa8b 100644 --- a/subscriptions.go +++ b/subscriptions.go @@ -27,6 +27,10 @@ type ChangeBillingAnchorDateRequest struct { } type SwapPlanRequest struct { + // The ID of the new subscription plan. + // + // Retired in favour of `new_plan_variation_id`. + NewPlanID *string `json:"new_plan_id,omitempty" url:"-"` // The ID of the new subscription plan variation. // // This field is required. @@ -44,6 +48,14 @@ type CreateSubscriptionRequest struct { IdempotencyKey *string `json:"idempotency_key,omitempty" url:"-"` // The ID of the location the subscription is associated with. LocationID string `json:"location_id" url:"-"` + // The ID of the [subscription plan](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations) created using the Catalog API. + // + // Retired in favour of `plan_variation_id`. + // + // For more information, see + // [Set Up and Manage a Subscription Plan](https://developer.squareup.com/docs/subscriptions-api/setup-plan) and + // [Subscriptions Walkthrough](https://developer.squareup.com/docs/subscriptions-api/walkthrough). + PlanID *string `json:"plan_id,omitempty" url:"-"` // The ID of the [subscription plan variation](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations#plan-variations) created using the Catalog API. PlanVariationID *string `json:"plan_variation_id,omitempty" url:"-"` // The ID of the [customer](entity:Customer) subscribing to the subscription plan variation. diff --git a/subscriptions/client.go b/subscriptions/client.go index 49ed49d..52fe406 100644 --- a/subscriptions/client.go +++ b/subscriptions/client.go @@ -5,12 +5,11 @@ package subscriptions import ( context "context" fmt "fmt" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { diff --git a/team/client/client.go b/team/client/client.go index f9d4da8..d2b92c8 100644 --- a/team/client/client.go +++ b/team/client/client.go @@ -3,12 +3,11 @@ package client import ( + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" + wagesetting "github.com/square/square-go-sdk/team/wagesetting" http "net/http" os "os" - - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" - wagesetting "github.com/fern-demo/square-go-sdk/team/wagesetting" ) type Client struct { diff --git a/team/wage_setting.go b/team/wage_setting.go index 4548e84..8e8863f 100644 --- a/team/wage_setting.go +++ b/team/wage_setting.go @@ -3,7 +3,7 @@ package team import ( - squaregosdk "github.com/fern-demo/square-go-sdk" + squaregosdk "github.com/square/square-go-sdk" ) type UpdateWageSettingRequest struct { diff --git a/team/wagesetting/client.go b/team/wagesetting/client.go index 45b10e5..c6af77d 100644 --- a/team/wagesetting/client.go +++ b/team/wagesetting/client.go @@ -4,13 +4,12 @@ package wagesetting import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" + team "github.com/square/square-go-sdk/team" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" - team "github.com/fern-demo/square-go-sdk/team" ) type Client struct { diff --git a/teammembers/client.go b/teammembers/client.go index 068294a..696c209 100644 --- a/teammembers/client.go +++ b/teammembers/client.go @@ -4,12 +4,11 @@ package teammembers import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { diff --git a/terminal/actions.go b/terminal/actions.go index 6a0a0c3..67b991e 100644 --- a/terminal/actions.go +++ b/terminal/actions.go @@ -3,9 +3,12 @@ package terminal import ( - squaregosdk "github.com/fern-demo/square-go-sdk" + squaregosdk "github.com/square/square-go-sdk" ) +type CancelTerminalActionRequest struct { +} + type CreateTerminalActionRequest struct { // A unique string that identifies this `CreateAction` request. Keys can be any valid string // but must be unique for every `CreateAction` request. diff --git a/terminal/actions/client.go b/terminal/actions/client.go index 06697e9..6b1b196 100644 --- a/terminal/actions/client.go +++ b/terminal/actions/client.go @@ -4,13 +4,12 @@ package actions import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" + terminal "github.com/square/square-go-sdk/terminal" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" - terminal "github.com/fern-demo/square-go-sdk/terminal" ) type Client struct { @@ -161,6 +160,7 @@ func (c *Client) Cancel( ctx context.Context, // Unique ID for the desired `TerminalAction`. actionID string, + request *terminal.CancelTerminalActionRequest, opts ...option.RequestOption, ) (*squaregosdk.CancelTerminalActionResponse, error) { options := core.NewRequestOptions(opts...) @@ -187,6 +187,7 @@ func (c *Client) Cancel( BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, + Request: request, Response: &response, }, ); err != nil { diff --git a/terminal/checkouts.go b/terminal/checkouts.go index 479d09e..f198c88 100644 --- a/terminal/checkouts.go +++ b/terminal/checkouts.go @@ -3,9 +3,12 @@ package terminal import ( - squaregosdk "github.com/fern-demo/square-go-sdk" + squaregosdk "github.com/square/square-go-sdk" ) +type CancelTerminalCheckoutRequest struct { +} + type CreateTerminalCheckoutRequest struct { // A unique string that identifies this `CreateCheckout` request. Keys can be any valid string but // must be unique for every `CreateCheckout` request. diff --git a/terminal/checkouts/client.go b/terminal/checkouts/client.go index 37c0b56..04d1fa2 100644 --- a/terminal/checkouts/client.go +++ b/terminal/checkouts/client.go @@ -4,13 +4,12 @@ package checkouts import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" + terminal "github.com/square/square-go-sdk/terminal" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" - terminal "github.com/fern-demo/square-go-sdk/terminal" ) type Client struct { @@ -162,6 +161,7 @@ func (c *Client) Cancel( ctx context.Context, // The unique ID for the desired `TerminalCheckout`. checkoutID string, + request *terminal.CancelTerminalCheckoutRequest, opts ...option.RequestOption, ) (*squaregosdk.CancelTerminalCheckoutResponse, error) { options := core.NewRequestOptions(opts...) @@ -188,6 +188,7 @@ func (c *Client) Cancel( BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, + Request: request, Response: &response, }, ); err != nil { diff --git a/terminal/client/client.go b/terminal/client/client.go index 7216cfc..274176c 100644 --- a/terminal/client/client.go +++ b/terminal/client/client.go @@ -4,15 +4,14 @@ package client import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" + actions "github.com/square/square-go-sdk/terminal/actions" + checkouts "github.com/square/square-go-sdk/terminal/checkouts" + refunds "github.com/square/square-go-sdk/terminal/refunds" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" - actions "github.com/fern-demo/square-go-sdk/terminal/actions" - checkouts "github.com/fern-demo/square-go-sdk/terminal/checkouts" - refunds "github.com/fern-demo/square-go-sdk/terminal/refunds" ) type Client struct { diff --git a/terminal/refunds.go b/terminal/refunds.go index 1ee4a4d..df6e1a7 100644 --- a/terminal/refunds.go +++ b/terminal/refunds.go @@ -3,9 +3,12 @@ package terminal import ( - squaregosdk "github.com/fern-demo/square-go-sdk" + squaregosdk "github.com/square/square-go-sdk" ) +type CancelTerminalRefundRequest struct { +} + type CreateTerminalRefundRequest struct { // A unique string that identifies this `CreateRefund` request. Keys can be any valid string but // must be unique for every `CreateRefund` request. diff --git a/terminal/refunds/client.go b/terminal/refunds/client.go index fc774c9..83fa713 100644 --- a/terminal/refunds/client.go +++ b/terminal/refunds/client.go @@ -4,13 +4,12 @@ package refunds import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" + terminal "github.com/square/square-go-sdk/terminal" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" - terminal "github.com/fern-demo/square-go-sdk/terminal" ) type Client struct { @@ -39,7 +38,7 @@ func NewClient(opts ...option.RequestOption) *Client { } } -// Creates a request to refund an Interac payment completed on a Square Terminal. Refunds for Interac payments on a Square Terminal are supported only for Interac debit cards in Canada. Other refunds for Terminal payments should use the Refunds API. For more information, see [Refunds API]($e/Refunds). +// Creates a request to refund an Interac payment completed on a Square Terminal. Refunds for Interac payments on a Square Terminal are supported only for Interac debit cards in Canada. Other refunds for Terminal payments should use the Refunds API. For more information, see [Refunds API](api:Refunds). func (c *Client) Create( ctx context.Context, request *terminal.CreateTerminalRefundRequest, @@ -161,6 +160,7 @@ func (c *Client) Cancel( ctx context.Context, // The unique ID for the desired `TerminalRefund`. terminalRefundID string, + request *terminal.CancelTerminalRefundRequest, opts ...option.RequestOption, ) (*squaregosdk.CancelTerminalRefundResponse, error) { options := core.NewRequestOptions(opts...) @@ -187,6 +187,7 @@ func (c *Client) Cancel( BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, + Request: request, Response: &response, }, ); err != nil { diff --git a/types.go b/types.go index 063d5a3..efb9d1c 100644 --- a/types.go +++ b/types.go @@ -5,8 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - - core "github.com/fern-demo/square-go-sdk/core" + core "github.com/square/square-go-sdk/core" ) // Defines the request parameters for the `AcceptDispute` endpoint. @@ -142,7 +141,7 @@ func (a *AcceptedPaymentMethods) String() string { return fmt.Sprintf("%#v", a) } -// Represents an [AccumulateLoyaltyPoints]($e/Loyalty/AccumulateLoyaltyPoints) response. +// Represents an [AccumulateLoyaltyPoints](api-endpoint:Loyalty-AccumulateLoyaltyPoints) response. type AccumulateLoyaltyPointsResponse struct { // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` @@ -242,19 +241,34 @@ func (a *AchDetails) String() string { type ActionCancelReason string const ( - ActionCancelReasonBuyerCanceled ActionCancelReason = "BUYER_CANCELED" - ActionCancelReasonSellerCanceled ActionCancelReason = "SELLER_CANCELED" - ActionCancelReasonTimedOut ActionCancelReason = "TIMED_OUT" + ActionCancelReasonActionCancelReasonDoNotUse ActionCancelReason = "ACTION_CANCEL_REASON_DO_NOT_USE" + ActionCancelReasonBuyerCanceled ActionCancelReason = "BUYER_CANCELED" + ActionCancelReasonSellerCanceled ActionCancelReason = "SELLER_CANCELED" + ActionCancelReasonTimedOut ActionCancelReason = "TIMED_OUT" + ActionCancelReasonUnsupported ActionCancelReason = "UNSUPPORTED" + ActionCancelReasonSellerDismissed ActionCancelReason = "SELLER_DISMISSED" + ActionCancelReasonTerminalTimedOut ActionCancelReason = "TERMINAL_TIMED_OUT" + ActionCancelReasonTerminalError ActionCancelReason = "TERMINAL_ERROR" ) func NewActionCancelReasonFromString(s string) (ActionCancelReason, error) { switch s { + case "ACTION_CANCEL_REASON_DO_NOT_USE": + return ActionCancelReasonActionCancelReasonDoNotUse, nil case "BUYER_CANCELED": return ActionCancelReasonBuyerCanceled, nil case "SELLER_CANCELED": return ActionCancelReasonSellerCanceled, nil case "TIMED_OUT": return ActionCancelReasonTimedOut, nil + case "UNSUPPORTED": + return ActionCancelReasonUnsupported, nil + case "SELLER_DISMISSED": + return ActionCancelReasonSellerDismissed, nil + case "TERMINAL_TIMED_OUT": + return ActionCancelReasonTerminalTimedOut, nil + case "TERMINAL_ERROR": + return ActionCancelReasonTerminalError, nil } var t ActionCancelReason return "", fmt.Errorf("%s is not a valid %T", s, t) @@ -267,6 +281,7 @@ func (a ActionCancelReason) Ptr() *ActionCancelReason { type ActivityType string const ( + ActivityTypeUnknownPayoutEntryTypeDoNotUse ActivityType = "UNKNOWN_PAYOUT_ENTRY_TYPE_DO_NOT_USE" ActivityTypeAdjustment ActivityType = "ADJUSTMENT" ActivityTypeAppFeeRefund ActivityType = "APP_FEE_REFUND" ActivityTypeAppFeeRevenue ActivityType = "APP_FEE_REVENUE" @@ -306,8 +321,14 @@ const ( ActivityTypeAutomaticBitcoinConversionsReversed ActivityType = "AUTOMATIC_BITCOIN_CONVERSIONS_REVERSED" ActivityTypeCreditCardRepayment ActivityType = "CREDIT_CARD_REPAYMENT" ActivityTypeCreditCardRepaymentReversed ActivityType = "CREDIT_CARD_REPAYMENT_REVERSED" + ActivityTypeSquareCardPayout ActivityType = "SQUARE_CARD_PAYOUT" + ActivityTypeReturnedSquareCardPayout ActivityType = "RETURNED_SQUARE_CARD_PAYOUT" + ActivityTypeManualPayout ActivityType = "MANUAL_PAYOUT" + ActivityTypeReturnedManualPayout ActivityType = "RETURNED_MANUAL_PAYOUT" ActivityTypeLocalOffersCashback ActivityType = "LOCAL_OFFERS_CASHBACK" ActivityTypeLocalOffersFee ActivityType = "LOCAL_OFFERS_FEE" + ActivityTypeGiftCardPool ActivityType = "GIFT_CARD_POOL" + ActivityTypeGiftCardPoolReversed ActivityType = "GIFT_CARD_POOL_REVERSED" ActivityTypePercentageProcessingEnrollment ActivityType = "PERCENTAGE_PROCESSING_ENROLLMENT" ActivityTypePercentageProcessingDeactivation ActivityType = "PERCENTAGE_PROCESSING_DEACTIVATION" ActivityTypePercentageProcessingRepayment ActivityType = "PERCENTAGE_PROCESSING_REPAYMENT" @@ -319,6 +340,9 @@ const ( ActivityTypeGiftCardLoadFeeRefund ActivityType = "GIFT_CARD_LOAD_FEE_REFUND" ActivityTypeUndoGiftCardLoadFeeRefund ActivityType = "UNDO_GIFT_CARD_LOAD_FEE_REFUND" ActivityTypeBalanceFoldersTransfer ActivityType = "BALANCE_FOLDERS_TRANSFER" + ActivityTypeCashForBusinessFeeRefund ActivityType = "CASH_FOR_BUSINESS_FEE_REFUND" + ActivityTypeCashForBusinessDisputeOffset ActivityType = "CASH_FOR_BUSINESS_DISPUTE_OFFSET" + ActivityTypeCashForBusinessDisputeOffsetReversed ActivityType = "CASH_FOR_BUSINESS_DISPUTE_OFFSET_REVERSED" ActivityTypeBalanceFoldersTransferReversed ActivityType = "BALANCE_FOLDERS_TRANSFER_REVERSED" ActivityTypeGiftCardPoolTransfer ActivityType = "GIFT_CARD_POOL_TRANSFER" ActivityTypeGiftCardPoolTransferReversed ActivityType = "GIFT_CARD_POOL_TRANSFER_REVERSED" @@ -326,6 +350,8 @@ const ( func NewActivityTypeFromString(s string) (ActivityType, error) { switch s { + case "UNKNOWN_PAYOUT_ENTRY_TYPE_DO_NOT_USE": + return ActivityTypeUnknownPayoutEntryTypeDoNotUse, nil case "ADJUSTMENT": return ActivityTypeAdjustment, nil case "APP_FEE_REFUND": @@ -404,10 +430,22 @@ func NewActivityTypeFromString(s string) (ActivityType, error) { return ActivityTypeCreditCardRepayment, nil case "CREDIT_CARD_REPAYMENT_REVERSED": return ActivityTypeCreditCardRepaymentReversed, nil + case "SQUARE_CARD_PAYOUT": + return ActivityTypeSquareCardPayout, nil + case "RETURNED_SQUARE_CARD_PAYOUT": + return ActivityTypeReturnedSquareCardPayout, nil + case "MANUAL_PAYOUT": + return ActivityTypeManualPayout, nil + case "RETURNED_MANUAL_PAYOUT": + return ActivityTypeReturnedManualPayout, nil case "LOCAL_OFFERS_CASHBACK": return ActivityTypeLocalOffersCashback, nil case "LOCAL_OFFERS_FEE": return ActivityTypeLocalOffersFee, nil + case "GIFT_CARD_POOL": + return ActivityTypeGiftCardPool, nil + case "GIFT_CARD_POOL_REVERSED": + return ActivityTypeGiftCardPoolReversed, nil case "PERCENTAGE_PROCESSING_ENROLLMENT": return ActivityTypePercentageProcessingEnrollment, nil case "PERCENTAGE_PROCESSING_DEACTIVATION": @@ -430,6 +468,12 @@ func NewActivityTypeFromString(s string) (ActivityType, error) { return ActivityTypeUndoGiftCardLoadFeeRefund, nil case "BALANCE_FOLDERS_TRANSFER": return ActivityTypeBalanceFoldersTransfer, nil + case "CASH_FOR_BUSINESS_FEE_REFUND": + return ActivityTypeCashForBusinessFeeRefund, nil + case "CASH_FOR_BUSINESS_DISPUTE_OFFSET": + return ActivityTypeCashForBusinessDisputeOffset, nil + case "CASH_FOR_BUSINESS_DISPUTE_OFFSET_REVERSED": + return ActivityTypeCashForBusinessDisputeOffsetReversed, nil case "BALANCE_FOLDERS_TRANSFER_REVERSED": return ActivityTypeBalanceFoldersTransferReversed, nil case "GIFT_CARD_POOL_TRANSFER": @@ -446,7 +490,7 @@ func (a ActivityType) Ptr() *ActivityType { } // Defines the fields that are included in the request body of -// a request to the [AddGroupToCustomer]($e/Customers/AddGroupToCustomer) endpoint. +// a request to the [AddGroupToCustomer](api-endpoint:Customers-AddGroupToCustomer) endpoint. type AddGroupToCustomerRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage @@ -487,7 +531,7 @@ func (a *AddGroupToCustomerRequest) String() string { } // Defines the fields that are included in the response body of -// a request to the [AddGroupToCustomer]($e/Customers/AddGroupToCustomer) endpoint. +// a request to the [AddGroupToCustomer](api-endpoint:Customers-AddGroupToCustomer) endpoint. type AddGroupToCustomerResponse struct { // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` @@ -658,7 +702,7 @@ func (a *Address) String() string { return fmt.Sprintf("%#v", a) } -// Represents an [AdjustLoyaltyPoints]($e/Loyalty/AdjustLoyaltyPoints) request. +// Represents an [AdjustLoyaltyPoints](api-endpoint:Loyalty-AdjustLoyaltyPoints) request. type AdjustLoyaltyPointsResponse struct { // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` @@ -846,7 +890,51 @@ func (a ApplicationDetailsExternalSquareProduct) Ptr() *ApplicationDetailsExtern return &a } -type ApplicationType = string +type ApplicationType string + +const ( + ApplicationTypeApplicationInvalidType ApplicationType = "APPLICATION_INVALID_TYPE" + ApplicationTypeSquarePos ApplicationType = "SQUARE_POS" + ApplicationTypeRetail ApplicationType = "RETAIL" + ApplicationTypeRestaurant ApplicationType = "RESTAURANT" + ApplicationTypeInvoices ApplicationType = "INVOICES" + ApplicationTypeAppointments ApplicationType = "APPOINTMENTS" + ApplicationTypeKds ApplicationType = "KDS" + ApplicationTypeTerminalAPI ApplicationType = "TERMINAL_API" + ApplicationTypeReaderSdk ApplicationType = "READER_SDK" + ApplicationTypeFnbKiosk ApplicationType = "FNB_KIOSK" +) + +func NewApplicationTypeFromString(s string) (ApplicationType, error) { + switch s { + case "APPLICATION_INVALID_TYPE": + return ApplicationTypeApplicationInvalidType, nil + case "SQUARE_POS": + return ApplicationTypeSquarePos, nil + case "RETAIL": + return ApplicationTypeRetail, nil + case "RESTAURANT": + return ApplicationTypeRestaurant, nil + case "INVOICES": + return ApplicationTypeInvoices, nil + case "APPOINTMENTS": + return ApplicationTypeAppointments, nil + case "KDS": + return ApplicationTypeKds, nil + case "TERMINAL_API": + return ApplicationTypeTerminalAPI, nil + case "READER_SDK": + return ApplicationTypeReaderSdk, nil + case "FNB_KIOSK": + return ApplicationTypeFnbKiosk, nil + } + var t ApplicationType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (a ApplicationType) Ptr() *ApplicationType { + return &a +} // Defines an appointment segment of a booking. type AppointmentSegment struct { @@ -904,11 +992,12 @@ func (a *AppointmentSegment) String() string { } // Defines the values for the `archived_state` query expression -// used in [SearchCatalogItems]($e/Catalog/SearchCatalogItems) +// used in [SearchCatalogItems](api-endpoint:Catalog-SearchCatalogItems) // to return the archived, not archived or either type of catalog items. type ArchivedState string const ( + ArchivedStateArchivedStateDoNotUse ArchivedState = "ARCHIVED_STATE_DO_NOT_USE" ArchivedStateArchivedStateNotArchived ArchivedState = "ARCHIVED_STATE_NOT_ARCHIVED" ArchivedStateArchivedStateArchived ArchivedState = "ARCHIVED_STATE_ARCHIVED" ArchivedStateArchivedStateAll ArchivedState = "ARCHIVED_STATE_ALL" @@ -916,6 +1005,8 @@ const ( func NewArchivedStateFromString(s string) (ArchivedState, error) { switch s { + case "ARCHIVED_STATE_DO_NOT_USE": + return ArchivedStateArchivedStateDoNotUse, nil case "ARCHIVED_STATE_NOT_ARCHIVED": return ArchivedStateArchivedStateNotArchived, nil case "ARCHIVED_STATE_ARCHIVED": @@ -931,6 +1022,123 @@ func (a ArchivedState) Ptr() *ArchivedState { return &a } +type AuthorizeRequest struct { + // The Square-issued ID for your application, which is available on + // the **OAuth** page for your application in the [Developer Dashboard](https://developer.squareup.com/apps). + ClientID string `json:"client_id" url:"client_id"` + // A space-separated list of the permissions that the application is requesting. + // Default: "`MERCHANT_PROFILE_READ PAYMENTS_READ SETTLEMENTS_READ BANK_ACCOUNTS_READ`" + // See [OAuthPermission](#type-oauthpermission) for possible values + Scope []OAuthPermission `json:"scope,omitempty" url:"scope,omitempty"` + // The locale to present the permission request form in. Square detects + // the appropriate locale automatically. Only provide this value if the + // application can definitively determine the preferred locale. + // + // Currently supported values: `en-IE`, `en-US`, `en-CA`, `es-US`, `fr-CA`, and + // `ja-JP`. + Locale *string `json:"locale,omitempty" url:"locale,omitempty"` + // If `false`, the user must log in to their Square account to + // view the Permission Request form, even if they already have a valid user + // session. This value has no effect in the Square Sandbox. + // Default: `true` + Session *bool `json:"session,omitempty" url:"session,omitempty"` + // When provided, `state` is passed to the configured redirect URL after + // the Permission Request form is submitted. You can include `state` and verify + // its value to help protect against cross-site request forgery. + State *string `json:"state,omitempty" url:"state,omitempty"` + // When provided, the OAuth flow uses PKCE to authorize. The `code_challenge` will be associated + // with the authorization_code and a `code_verifier` will need to passed in to obtain the access token. + CodeChallenge *string `json:"code_challenge,omitempty" url:"code_challenge,omitempty"` + // The redirect URL assigned on the **OAuth** page for your application in the [Developer Dashboard](https://developer.squareup.com/apps). + // This field is required to use a dynamic port at runtime (PKCE only). To use a dynamic port, use the literal "<port>" + // as a placeholder for a port in the **Redirect URL** box in the [Developer Dashboard](https://developer.squareup.com/apps), + // for example, "http://localhost:<port>". When you call the `Authorize` endpoint from an application, pass in the actual + // port in this field. For example: `https://connect.squareup.com/oauth2/authorize?client_id={YOUR_APP_ID}&scope=MERCHANT_PROFILE_READ&redirect_uri=http://localhost:8000` + RedirectURI *string `json:"redirect_uri,omitempty" url:"redirect_uri,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (a *AuthorizeRequest) GetExtraProperties() map[string]interface{} { + return a.extraProperties +} + +func (a *AuthorizeRequest) UnmarshalJSON(data []byte) error { + type unmarshaler AuthorizeRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *a = AuthorizeRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *a) + if err != nil { + return err + } + a.extraProperties = extraProperties + + a._rawJSON = json.RawMessage(data) + return nil +} + +func (a *AuthorizeRequest) String() string { + if len(a._rawJSON) > 0 { + if value, err := core.StringifyJSON(a._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(a); err == nil { + return value + } + return fmt.Sprintf("%#v", a) +} + +type AuthorizeResponse struct { + // A valid authorization code. Authorization codes are exchanged + // for OAuth access tokens with the `ObtainToken` endpoint. + Code *string `json:"code,omitempty" url:"code,omitempty"` + // The same value specified in the request. + State *string `json:"state,omitempty" url:"state,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (a *AuthorizeResponse) GetExtraProperties() map[string]interface{} { + return a.extraProperties +} + +func (a *AuthorizeResponse) UnmarshalJSON(data []byte) error { + type unmarshaler AuthorizeResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *a = AuthorizeResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *a) + if err != nil { + return err + } + a.extraProperties = extraProperties + + a._rawJSON = json.RawMessage(data) + return nil +} + +func (a *AuthorizeResponse) String() string { + if len(a._rawJSON) > 0 { + if value, err := core.StringifyJSON(a._rawJSON); err == nil { + return value + } + } + if value, err := core.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. @@ -1070,6 +1278,291 @@ func (b *BankAccount) String() string { return fmt.Sprintf("%#v", b) } +// Published when you link an external bank account to a Square +// account in the Seller Dashboard. Square sets the initial status to +// `VERIFICATION_IN_PROGRESS` and publishes the event. +type BankAccountCreatedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The ID of the target location associated with the event. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The type of event this represents, `"bank_account.created"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *BankAccountCreatedEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (b *BankAccountCreatedEvent) GetExtraProperties() map[string]interface{} { + return b.extraProperties +} + +func (b *BankAccountCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler BankAccountCreatedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BankAccountCreatedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + + b._rawJSON = json.RawMessage(data) + return nil +} + +func (b *BankAccountCreatedEvent) String() string { + if len(b._rawJSON) > 0 { + if value, err := core.StringifyJSON(b._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + +type BankAccountCreatedEventData struct { + // Name of the affected object’s type, `"bank_account"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the affected bank account. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the created bank account. + Object *BankAccountCreatedEventObject `json:"object,omitempty" url:"object,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (b *BankAccountCreatedEventData) GetExtraProperties() map[string]interface{} { + return b.extraProperties +} + +func (b *BankAccountCreatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler BankAccountCreatedEventData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BankAccountCreatedEventData(value) + + extraProperties, err := core.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + + b._rawJSON = json.RawMessage(data) + return nil +} + +func (b *BankAccountCreatedEventData) String() string { + if len(b._rawJSON) > 0 { + if value, err := core.StringifyJSON(b._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + +type BankAccountCreatedEventObject struct { + // The created bank account. + BankAccount *BankAccount `json:"bank_account,omitempty" url:"bank_account,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (b *BankAccountCreatedEventObject) GetExtraProperties() map[string]interface{} { + return b.extraProperties +} + +func (b *BankAccountCreatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler BankAccountCreatedEventObject + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BankAccountCreatedEventObject(value) + + extraProperties, err := core.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + + b._rawJSON = json.RawMessage(data) + return nil +} + +func (b *BankAccountCreatedEventObject) String() string { + if len(b._rawJSON) > 0 { + if value, err := core.StringifyJSON(b._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + +// Published when Square sets the status of a +// [BankAccount](entity:BankAccount) to `DISABLED`. +type BankAccountDisabledEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The ID of the target location associated with the event. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The type of event this represents, `"bank_account.disabled"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was disabled, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *BankAccountDisabledEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (b *BankAccountDisabledEvent) GetExtraProperties() map[string]interface{} { + return b.extraProperties +} + +func (b *BankAccountDisabledEvent) UnmarshalJSON(data []byte) error { + type unmarshaler BankAccountDisabledEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BankAccountDisabledEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + + b._rawJSON = json.RawMessage(data) + return nil +} + +func (b *BankAccountDisabledEvent) String() string { + if len(b._rawJSON) > 0 { + if value, err := core.StringifyJSON(b._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + +type BankAccountDisabledEventData struct { + // Name of the affected object’s type, `"bank_account"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the affected bank account. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the disabled bank account. + Object *BankAccountDisabledEventObject `json:"object,omitempty" url:"object,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (b *BankAccountDisabledEventData) GetExtraProperties() map[string]interface{} { + return b.extraProperties +} + +func (b *BankAccountDisabledEventData) UnmarshalJSON(data []byte) error { + type unmarshaler BankAccountDisabledEventData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BankAccountDisabledEventData(value) + + extraProperties, err := core.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + + b._rawJSON = json.RawMessage(data) + return nil +} + +func (b *BankAccountDisabledEventData) String() string { + if len(b._rawJSON) > 0 { + if value, err := core.StringifyJSON(b._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + +type BankAccountDisabledEventObject struct { + // The disabled bank account. + BankAccount *BankAccount `json:"bank_account,omitempty" url:"bank_account,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (b *BankAccountDisabledEventObject) GetExtraProperties() map[string]interface{} { + return b.extraProperties +} + +func (b *BankAccountDisabledEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler BankAccountDisabledEventObject + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BankAccountDisabledEventObject(value) + + extraProperties, err := core.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + + b._rawJSON = json.RawMessage(data) + return nil +} + +func (b *BankAccountDisabledEventObject) String() string { + if len(b._rawJSON) > 0 { + if value, err := core.StringifyJSON(b._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + // Additional details about BANK_ACCOUNT type payments. type BankAccountPaymentDetails struct { // The name of the bank associated with the bank account. @@ -1160,6 +1653,7 @@ func (b BankAccountStatus) Ptr() *BankAccountStatus { type BankAccountType string const ( + BankAccountTypeUnknown BankAccountType = "UNKNOWN" BankAccountTypeChecking BankAccountType = "CHECKING" BankAccountTypeSavings BankAccountType = "SAVINGS" BankAccountTypeInvestment BankAccountType = "INVESTMENT" @@ -1169,6 +1663,8 @@ const ( func NewBankAccountTypeFromString(s string) (BankAccountType, error) { switch s { + case "UNKNOWN": + return BankAccountTypeUnknown, nil case "CHECKING": return BankAccountTypeChecking, nil case "SAVINGS": @@ -1188,6 +1684,148 @@ func (b BankAccountType) Ptr() *BankAccountType { return &b } +// Published when Square sets the status of a +// [BankAccount](entity:BankAccount) to `VERIFIED`. +type BankAccountVerifiedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The ID of the target location associated with the event. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The type of event this represents, `"bank_account.verified"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was verified, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *BankAccountVerifiedEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (b *BankAccountVerifiedEvent) GetExtraProperties() map[string]interface{} { + return b.extraProperties +} + +func (b *BankAccountVerifiedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler BankAccountVerifiedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BankAccountVerifiedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + + b._rawJSON = json.RawMessage(data) + return nil +} + +func (b *BankAccountVerifiedEvent) String() string { + if len(b._rawJSON) > 0 { + if value, err := core.StringifyJSON(b._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + +type BankAccountVerifiedEventData struct { + // Name of the affected object’s type, `"bank_account"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the affected bank account. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the verified bank account. + Object *BankAccountVerifiedEventObject `json:"object,omitempty" url:"object,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (b *BankAccountVerifiedEventData) GetExtraProperties() map[string]interface{} { + return b.extraProperties +} + +func (b *BankAccountVerifiedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler BankAccountVerifiedEventData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BankAccountVerifiedEventData(value) + + extraProperties, err := core.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + + b._rawJSON = json.RawMessage(data) + return nil +} + +func (b *BankAccountVerifiedEventData) String() string { + if len(b._rawJSON) > 0 { + if value, err := core.StringifyJSON(b._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + +type BankAccountVerifiedEventObject struct { + // The verified bank account. + BankAccount *BankAccount `json:"bank_account,omitempty" url:"bank_account,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (b *BankAccountVerifiedEventObject) GetExtraProperties() map[string]interface{} { + return b.extraProperties +} + +func (b *BankAccountVerifiedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler BankAccountVerifiedEventObject + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BankAccountVerifiedEventObject(value) + + extraProperties, err := core.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + + b._rawJSON = json.RawMessage(data) + return nil +} + +func (b *BankAccountVerifiedEventObject) String() string { + if len(b._rawJSON) > 0 { + if value, err := core.StringifyJSON(b._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + type BatchChangeInventoryRequest struct { // A client-supplied, universally unique identifier (UUID) for the // request. @@ -1333,7 +1971,7 @@ func (b *BatchCreateTeamMembersResponse) String() string { return fmt.Sprintf("%#v", b) } -// Represents an output from a call to [BulkCreateVendors]($e/Vendors/BulkCreateVendors). +// Represents an output from a call to [BulkCreateVendors](api-endpoint:Vendors-BulkCreateVendors). type BatchCreateVendorsResponse struct { // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` @@ -1679,7 +2317,7 @@ func (b *BatchGetOrdersResponse) String() string { return fmt.Sprintf("%#v", b) } -// Represents an output from a call to [BulkRetrieveVendors]($e/Vendors/BulkRetrieveVendors). +// Represents an output from a call to [BulkRetrieveVendors](api-endpoint:Vendors-BulkRetrieveVendors). type BatchGetVendorsResponse struct { // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` @@ -1726,6 +2364,142 @@ func (b *BatchGetVendorsResponse) String() string { return fmt.Sprintf("%#v", b) } +// Represents a batched request included in a call to the **SubmitBatch** +// endpoint. +type BatchRequest struct { + // HTTP method for the API call. + // See [BatchRequestHttpMethod](#type-batchrequesthttpmethod) for possible values + Method BatchRequestHTTPMethod `json:"method" url:"method"` + // Endpoint path for the API call. + RelativePath string `json:"relative_path" url:"relative_path"` + // [Square access token](https://developer.squareup.com/docs/build-basics/access-tokens) for the API + // call. + AccessToken string `json:"access_token" url:"access_token"` + // Request body for the API call. Only used for API calls using POST. + Body map[string]*string `json:"body,omitempty" url:"body,omitempty"` + // Client-provided value to identify the request. + RequestID *string `json:"request_id,omitempty" url:"request_id,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (b *BatchRequest) GetExtraProperties() map[string]interface{} { + return b.extraProperties +} + +func (b *BatchRequest) UnmarshalJSON(data []byte) error { + type unmarshaler BatchRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BatchRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + + b._rawJSON = json.RawMessage(data) + return nil +} + +func (b *BatchRequest) String() string { + if len(b._rawJSON) > 0 { + if value, err := core.StringifyJSON(b._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + +// Indicates the applicable HTTP method. +type BatchRequestHTTPMethod string + +const ( + BatchRequestHTTPMethodGet BatchRequestHTTPMethod = "GET" + BatchRequestHTTPMethodPost BatchRequestHTTPMethod = "POST" + BatchRequestHTTPMethodPut BatchRequestHTTPMethod = "PUT" + BatchRequestHTTPMethodDelete BatchRequestHTTPMethod = "DELETE" +) + +func NewBatchRequestHTTPMethodFromString(s string) (BatchRequestHTTPMethod, error) { + switch s { + case "GET": + return BatchRequestHTTPMethodGet, nil + case "POST": + return BatchRequestHTTPMethodPost, nil + case "PUT": + return BatchRequestHTTPMethodPut, nil + case "DELETE": + return BatchRequestHTTPMethodDelete, nil + } + var t BatchRequestHTTPMethod + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (b BatchRequestHTTPMethod) Ptr() *BatchRequestHTTPMethod { + return &b +} + +// Represents an individual response for a batched request to the +// **SubmitBatch** endpoint. +type BatchResponse struct { + // HTTP status code for the response + StatusCode *int `json:"status_code,omitempty" url:"status_code,omitempty"` + // The body of the response (if any). + Body map[string]string `json:"body,omitempty" url:"body,omitempty"` + // Contains any important headers for the response, indexed by header + // name. For example, if the response includes a pagination header, the header + // value is available from `headers["Link"]`. + Headers map[string]string `json:"headers,omitempty" url:"headers,omitempty"` + // The value provided in a request for `request_id` in the corresponding + // `BatchRequest` (if any). + RequestID *string `json:"request_id,omitempty" url:"request_id,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (b *BatchResponse) GetExtraProperties() map[string]interface{} { + return b.extraProperties +} + +func (b *BatchResponse) UnmarshalJSON(data []byte) error { + type unmarshaler BatchResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BatchResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + + b._rawJSON = json.RawMessage(data) + return nil +} + +func (b *BatchResponse) String() string { + if len(b._rawJSON) > 0 { + if value, err := core.StringifyJSON(b._rawJSON); err == nil { + return value + } + } + if value, err := core.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. @@ -1736,6 +2510,9 @@ type BatchRetrieveInventoryChangesRequest struct { // 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 results by `InventoryState` values. + // Use the `states` filter as its replacement. + Statuses []InventoryState `json:"statuses,omitempty" url:"statuses,omitempty"` // The filter to return `ADJUSTMENT` query results by // `InventoryState`. This filter is only applied when set. // The default value is null. @@ -1839,7 +2616,7 @@ func (b *BatchUpdateTeamMembersResponse) String() string { return fmt.Sprintf("%#v", b) } -// Represents an output from a call to [BulkUpdateVendors]($e/Vendors/BulkUpdateVendors). +// Represents an output from a call to [BulkUpdateVendors](api-endpoint:Vendors-BulkUpdateVendors). type BatchUpdateVendorsResponse struct { // Errors encountered when the request fails. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` @@ -1934,7 +2711,7 @@ func (b *BatchUpsertCatalogObjectsResponse) String() string { return fmt.Sprintf("%#v", b) } -// Represents an individual upsert request in a [BulkUpsertCustomerCustomAttributes]($e/CustomerCustomAttributes/BulkUpsertCustomerCustomAttributes) +// Represents an individual upsert request in a [BulkUpsertCustomerCustomAttributes](api-endpoint:CustomerCustomAttributes-BulkUpsertCustomerCustomAttributes) // request. An individual request contains a customer ID, the custom attribute to create or update, // and an optional idempotency key. type BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest struct { @@ -1994,7 +2771,7 @@ func (b *BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsert return fmt.Sprintf("%#v", b) } -// Represents a [BulkUpsertCustomerCustomAttributes]($e/CustomerCustomAttributes/BulkUpsertCustomerCustomAttributes) response, +// Represents a [BulkUpsertCustomerCustomAttributes](api-endpoint:CustomerCustomAttributes-BulkUpsertCustomerCustomAttributes) response, // which contains a map of responses that each corresponds to an individual upsert request. type BatchUpsertCustomerCustomAttributesResponse struct { // A map of responses that correspond to individual upsert requests. Each response has the @@ -2041,7 +2818,7 @@ func (b *BatchUpsertCustomerCustomAttributesResponse) String() string { return fmt.Sprintf("%#v", b) } -// Represents a response for an individual upsert request in a [BulkUpsertCustomerCustomAttributes]($e/CustomerCustomAttributes/BulkUpsertCustomerCustomAttributes) operation. +// Represents a response for an individual upsert request in a [BulkUpsertCustomerCustomAttributes](api-endpoint:CustomerCustomAttributes-BulkUpsertCustomerCustomAttributes) operation. type BatchUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse struct { // The ID of the customer profile associated with the custom attribute. CustomerID *string `json:"customer_id,omitempty" url:"customer_id,omitempty"` @@ -2199,6 +2976,148 @@ func (b BookingBookingSource) Ptr() *BookingBookingSource { return &b } +// Published when a booking is created. +// +// To receive this event with buyer-level permissions, you must have `APPOINTMENTS_READ` set for the OAuth scope. +// To receive this event with seller-level permissions, you must have `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` set for the OAuth scope. +type BookingCreatedEvent struct { + // The ID of the target seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"booking.created"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *BookingCreatedEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (b *BookingCreatedEvent) GetExtraProperties() map[string]interface{} { + return b.extraProperties +} + +func (b *BookingCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler BookingCreatedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BookingCreatedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + + b._rawJSON = json.RawMessage(data) + return nil +} + +func (b *BookingCreatedEvent) String() string { + if len(b._rawJSON) > 0 { + if value, err := core.StringifyJSON(b._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + +type BookingCreatedEventData struct { + // The type of the event data object. The value is `"booking"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The ID of the event data object. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the created booking. + Object *BookingCreatedEventObject `json:"object,omitempty" url:"object,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (b *BookingCreatedEventData) GetExtraProperties() map[string]interface{} { + return b.extraProperties +} + +func (b *BookingCreatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler BookingCreatedEventData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BookingCreatedEventData(value) + + extraProperties, err := core.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + + b._rawJSON = json.RawMessage(data) + return nil +} + +func (b *BookingCreatedEventData) String() string { + if len(b._rawJSON) > 0 { + if value, err := core.StringifyJSON(b._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + +type BookingCreatedEventObject struct { + // The created booking. + Booking *Booking `json:"booking,omitempty" url:"booking,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (b *BookingCreatedEventObject) GetExtraProperties() map[string]interface{} { + return b.extraProperties +} + +func (b *BookingCreatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler BookingCreatedEventObject + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BookingCreatedEventObject(value) + + extraProperties, err := core.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + + b._rawJSON = json.RawMessage(data) + return nil +} + +func (b *BookingCreatedEventObject) String() string { + if len(b._rawJSON) > 0 { + if value, err := core.StringifyJSON(b._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + // Information about a booking creator. type BookingCreatorDetails struct { // The seller-accessible type of the creator of the booking. @@ -2272,7 +3191,328 @@ func (b BookingCreatorDetailsCreatorType) Ptr() *BookingCreatorDetailsCreatorTyp return &b } -// Represents an individual delete request in a [BulkDeleteBookingCustomAttributes]($e/BookingCustomAttributes/BulkDeleteBookingCustomAttributes) +// Published when a booking [custom attribute definition](entity:CustomAttributeDefinition) +// is created by the subscribing application. Subscribe to this event to be notified +// when your application creates a booking custom attribute definition. +type BookingCustomAttributeDefinitionOwnedCreatedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"booking.custom_attribute_definition.owned.created"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (b *BookingCustomAttributeDefinitionOwnedCreatedEvent) GetExtraProperties() map[string]interface{} { + return b.extraProperties +} + +func (b *BookingCustomAttributeDefinitionOwnedCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler BookingCustomAttributeDefinitionOwnedCreatedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BookingCustomAttributeDefinitionOwnedCreatedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + + b._rawJSON = json.RawMessage(data) + return nil +} + +func (b *BookingCustomAttributeDefinitionOwnedCreatedEvent) String() string { + if len(b._rawJSON) > 0 { + if value, err := core.StringifyJSON(b._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + +// Published when a booking [custom attribute definition](entity:CustomAttributeDefinition) +// is deleted by the subscribing application. Subscribe to this event to be notified +// when your application deletes a booking custom attribute definition. +type BookingCustomAttributeDefinitionOwnedDeletedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"booking.custom_attribute_definition.owned.deleted"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (b *BookingCustomAttributeDefinitionOwnedDeletedEvent) GetExtraProperties() map[string]interface{} { + return b.extraProperties +} + +func (b *BookingCustomAttributeDefinitionOwnedDeletedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler BookingCustomAttributeDefinitionOwnedDeletedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BookingCustomAttributeDefinitionOwnedDeletedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + + b._rawJSON = json.RawMessage(data) + return nil +} + +func (b *BookingCustomAttributeDefinitionOwnedDeletedEvent) String() string { + if len(b._rawJSON) > 0 { + if value, err := core.StringifyJSON(b._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + +// Published when a booking [custom attribute definition](entity:CustomAttributeDefinition) +// is updated by the subscribing application. Subscribe to this event to be notified +// when your application updates a booking custom attribute definition. +type BookingCustomAttributeDefinitionOwnedUpdatedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"booking.custom_attribute_definition.owned.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (b *BookingCustomAttributeDefinitionOwnedUpdatedEvent) GetExtraProperties() map[string]interface{} { + return b.extraProperties +} + +func (b *BookingCustomAttributeDefinitionOwnedUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler BookingCustomAttributeDefinitionOwnedUpdatedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BookingCustomAttributeDefinitionOwnedUpdatedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + + b._rawJSON = json.RawMessage(data) + return nil +} + +func (b *BookingCustomAttributeDefinitionOwnedUpdatedEvent) String() string { + if len(b._rawJSON) > 0 { + if value, err := core.StringifyJSON(b._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + +// Published when a booking [custom attribute definition](entity:CustomAttributeDefinition) +// with the `visibility` field set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES` is created. +// An application that subscribes to this event is notified when a booking custom attribute definition is created +// by any application for which the subscribing application has read access to the booking custom attribute definition. +type BookingCustomAttributeDefinitionVisibleCreatedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"booking.custom_attribute_definition.visible.created"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (b *BookingCustomAttributeDefinitionVisibleCreatedEvent) GetExtraProperties() map[string]interface{} { + return b.extraProperties +} + +func (b *BookingCustomAttributeDefinitionVisibleCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler BookingCustomAttributeDefinitionVisibleCreatedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BookingCustomAttributeDefinitionVisibleCreatedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + + b._rawJSON = json.RawMessage(data) + return nil +} + +func (b *BookingCustomAttributeDefinitionVisibleCreatedEvent) String() string { + if len(b._rawJSON) > 0 { + if value, err := core.StringifyJSON(b._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + +// Published when a booking [custom attribute definition](entity:CustomAttributeDefinition) +// with the `visibility` field set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES` is deleted. +// An application that subscribes to this event is notified when a booking custom attribute definition is deleted +// by any application for which the subscribing application has read access to the booking custom attribute definition. +type BookingCustomAttributeDefinitionVisibleDeletedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"booking.custom_attribute_definition.visible.deleted"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (b *BookingCustomAttributeDefinitionVisibleDeletedEvent) GetExtraProperties() map[string]interface{} { + return b.extraProperties +} + +func (b *BookingCustomAttributeDefinitionVisibleDeletedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler BookingCustomAttributeDefinitionVisibleDeletedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BookingCustomAttributeDefinitionVisibleDeletedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + + b._rawJSON = json.RawMessage(data) + return nil +} + +func (b *BookingCustomAttributeDefinitionVisibleDeletedEvent) String() string { + if len(b._rawJSON) > 0 { + if value, err := core.StringifyJSON(b._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + +// Published when a booking [custom attribute definition](entity:CustomAttributeDefinition) +// with the `visibility` field set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES` is updated. +// An application that subscribes to this event is notified when a booking custom attribute definition is updated +// by any application for which the subscribing application has read access to the booking custom attribute definition. +type BookingCustomAttributeDefinitionVisibleUpdatedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"booking.custom_attribute_definition.visible.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (b *BookingCustomAttributeDefinitionVisibleUpdatedEvent) GetExtraProperties() map[string]interface{} { + return b.extraProperties +} + +func (b *BookingCustomAttributeDefinitionVisibleUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler BookingCustomAttributeDefinitionVisibleUpdatedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BookingCustomAttributeDefinitionVisibleUpdatedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + + b._rawJSON = json.RawMessage(data) + return nil +} + +func (b *BookingCustomAttributeDefinitionVisibleUpdatedEvent) String() string { + if len(b._rawJSON) > 0 { + if value, err := core.StringifyJSON(b._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + +// Represents an individual delete request in a [BulkDeleteBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkDeleteBookingCustomAttributes) // request. An individual request contains a booking ID, the custom attribute to delete, and an optional idempotency key. type BookingCustomAttributeDeleteRequest struct { // The ID of the target [booking](entity:Booking). @@ -2320,7 +3560,7 @@ func (b *BookingCustomAttributeDeleteRequest) String() string { return fmt.Sprintf("%#v", b) } -// Represents a response for an individual upsert request in a [BulkDeleteBookingCustomAttributes]($e/BookingCustomAttributes/BulkDeleteBookingCustomAttributes) operation. +// Represents a response for an individual upsert request in a [BulkDeleteBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkDeleteBookingCustomAttributes) operation. type BookingCustomAttributeDeleteResponse struct { // The ID of the [booking](entity:Booking) associated with the custom attribute. BookingID *string `json:"booking_id,omitempty" url:"booking_id,omitempty"` @@ -2365,7 +3605,115 @@ func (b *BookingCustomAttributeDeleteResponse) String() string { return fmt.Sprintf("%#v", b) } -// Represents an individual upsert request in a [BulkUpsertBookingCustomAttributes]($e/BookingCustomAttributes/BulkUpsertBookingCustomAttributes) +// Published when a booking [custom attribute](entity:CustomAttribute) +// associated with a [custom attribute definition](entity:CustomAttributeDefinition) that is +// owned by the subscribing application is deleted. +// Subscribe to this event to be notified +// when your application deletes a booking custom attribute. +type BookingCustomAttributeOwnedDeletedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"booking.custom_attribute.owned.deleted"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (b *BookingCustomAttributeOwnedDeletedEvent) GetExtraProperties() map[string]interface{} { + return b.extraProperties +} + +func (b *BookingCustomAttributeOwnedDeletedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler BookingCustomAttributeOwnedDeletedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BookingCustomAttributeOwnedDeletedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + + b._rawJSON = json.RawMessage(data) + return nil +} + +func (b *BookingCustomAttributeOwnedDeletedEvent) String() string { + if len(b._rawJSON) > 0 { + if value, err := core.StringifyJSON(b._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + +// Published when a booking [custom attribute](entity:CustomAttribute) +// is updated by the subscribing application. Subscribe to this event to be notified +// when your application updates a booking custom attribute. +type BookingCustomAttributeOwnedUpdatedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"booking.custom_attribute.owned.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (b *BookingCustomAttributeOwnedUpdatedEvent) GetExtraProperties() map[string]interface{} { + return b.extraProperties +} + +func (b *BookingCustomAttributeOwnedUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler BookingCustomAttributeOwnedUpdatedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BookingCustomAttributeOwnedUpdatedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + + b._rawJSON = json.RawMessage(data) + return nil +} + +func (b *BookingCustomAttributeOwnedUpdatedEvent) String() string { + if len(b._rawJSON) > 0 { + if value, err := core.StringifyJSON(b._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + +// Represents an individual upsert request in a [BulkUpsertBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkUpsertBookingCustomAttributes) // request. An individual request contains a booking ID, the custom attribute to create or update, // and an optional idempotency key. type BookingCustomAttributeUpsertRequest struct { @@ -2425,7 +3773,7 @@ func (b *BookingCustomAttributeUpsertRequest) String() string { return fmt.Sprintf("%#v", b) } -// Represents a response for an individual upsert request in a [BulkUpsertBookingCustomAttributes]($e/BookingCustomAttributes/BulkUpsertBookingCustomAttributes) operation. +// Represents a response for an individual upsert request in a [BulkUpsertBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkUpsertBookingCustomAttributes) operation. type BookingCustomAttributeUpsertResponse struct { // The ID of the [booking](entity:Booking) associated with the custom attribute. BookingID *string `json:"booking_id,omitempty" url:"booking_id,omitempty"` @@ -2472,6 +3820,114 @@ func (b *BookingCustomAttributeUpsertResponse) String() string { return fmt.Sprintf("%#v", b) } +// Published when a booking [custom attribute](entity:CustomAttribute) with +// the `visibility` field set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES` is deleted. +// An application that subscribes to this event is notified when a booking custom attribute is deleted +// by any application for which the subscribing application has read access to the booking custom attribute. +type BookingCustomAttributeVisibleDeletedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"booking.custom_attribute.visible.deleted"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (b *BookingCustomAttributeVisibleDeletedEvent) GetExtraProperties() map[string]interface{} { + return b.extraProperties +} + +func (b *BookingCustomAttributeVisibleDeletedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler BookingCustomAttributeVisibleDeletedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BookingCustomAttributeVisibleDeletedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + + b._rawJSON = json.RawMessage(data) + return nil +} + +func (b *BookingCustomAttributeVisibleDeletedEvent) String() string { + if len(b._rawJSON) > 0 { + if value, err := core.StringifyJSON(b._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + +// Published when a booking [custom attribute](entity:CustomAttribute) +// with the `visibility` field set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES` is updated. +// An application that subscribes to this event is notified when a booking custom attribute is updated +// by any application for which the subscribing application has read access to the booking custom attribute. +type BookingCustomAttributeVisibleUpdatedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"booking.custom_attribute.visible.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (b *BookingCustomAttributeVisibleUpdatedEvent) GetExtraProperties() map[string]interface{} { + return b.extraProperties +} + +func (b *BookingCustomAttributeVisibleUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler BookingCustomAttributeVisibleUpdatedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BookingCustomAttributeVisibleUpdatedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + + b._rawJSON = json.RawMessage(data) + return nil +} + +func (b *BookingCustomAttributeVisibleUpdatedEvent) String() string { + if len(b._rawJSON) > 0 { + if value, err := core.StringifyJSON(b._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + // Supported booking statuses. type BookingStatus string @@ -2507,6 +3963,148 @@ func (b BookingStatus) Ptr() *BookingStatus { return &b } +// Published when a booking is updated or cancelled. +// +// To receive this event with buyer-level permissions, you must have `APPOINTMENTS_READ` set for the OAuth scope. +// To receive this event with seller-level permissions, you must have `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` set for the OAuth scope. +type BookingUpdatedEvent struct { + // The ID of the target seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"booking.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *BookingUpdatedEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (b *BookingUpdatedEvent) GetExtraProperties() map[string]interface{} { + return b.extraProperties +} + +func (b *BookingUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler BookingUpdatedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BookingUpdatedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + + b._rawJSON = json.RawMessage(data) + return nil +} + +func (b *BookingUpdatedEvent) String() string { + if len(b._rawJSON) > 0 { + if value, err := core.StringifyJSON(b._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + +type BookingUpdatedEventData struct { + // The type of the event data object. The value is `"booking"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The ID of the event data object. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the updated booking. + Object *BookingUpdatedEventObject `json:"object,omitempty" url:"object,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (b *BookingUpdatedEventData) GetExtraProperties() map[string]interface{} { + return b.extraProperties +} + +func (b *BookingUpdatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler BookingUpdatedEventData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BookingUpdatedEventData(value) + + extraProperties, err := core.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + + b._rawJSON = json.RawMessage(data) + return nil +} + +func (b *BookingUpdatedEventData) String() string { + if len(b._rawJSON) > 0 { + if value, err := core.StringifyJSON(b._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + +type BookingUpdatedEventObject struct { + // The updated booking. + Booking *Booking `json:"booking,omitempty" url:"booking,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (b *BookingUpdatedEventObject) GetExtraProperties() map[string]interface{} { + return b.extraProperties +} + +func (b *BookingUpdatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler BookingUpdatedEventObject + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BookingUpdatedEventObject(value) + + extraProperties, err := core.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + + b._rawJSON = json.RawMessage(data) + return nil +} + +func (b *BookingUpdatedEventObject) String() string { + if len(b._rawJSON) > 0 { + if value, err := core.StringifyJSON(b._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + // A record of an employee's break during a shift. type Break struct { // The UUID for this object. @@ -2633,7 +4231,7 @@ func (b *BreakType) String() string { } // Defines the customer data provided in individual create requests for a -// [BulkCreateCustomers]($e/Customers/BulkCreateCustomers) operation. +// [BulkCreateCustomers](api-endpoint:Customers-BulkCreateCustomers) operation. type BulkCreateCustomerData struct { // The given name (that is, the first name) associated with the customer profile. GivenName *string `json:"given_name,omitempty" url:"given_name,omitempty"` @@ -2707,7 +4305,7 @@ func (b *BulkCreateCustomerData) String() string { } // Defines the fields included in the response body from the -// [BulkCreateCustomers]($e/Customers/BulkCreateCustomers) endpoint. +// [BulkCreateCustomers](api-endpoint:Customers-BulkCreateCustomers) endpoint. type BulkCreateCustomersResponse struct { // A map of responses that correspond to individual create requests, represented by // key-value pairs. @@ -2758,7 +4356,7 @@ func (b *BulkCreateCustomersResponse) String() string { return fmt.Sprintf("%#v", b) } -// Represents a [BulkDeleteBookingCustomAttributes]($e/BookingCustomAttributes/BulkDeleteBookingCustomAttributes) response, +// Represents a [BulkDeleteBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkDeleteBookingCustomAttributes) response, // which contains a map of responses that each corresponds to an individual delete request. type BulkDeleteBookingCustomAttributesResponse struct { // A map of responses that correspond to individual delete requests. Each response has the @@ -2806,7 +4404,7 @@ func (b *BulkDeleteBookingCustomAttributesResponse) String() string { } // Defines the fields included in the response body from the -// [BulkDeleteCustomers]($e/Customers/BulkDeleteCustomers) endpoint. +// [BulkDeleteCustomers](api-endpoint:Customers-BulkDeleteCustomers) endpoint. type BulkDeleteCustomersResponse struct { // A map of responses that correspond to individual delete requests, represented by // key-value pairs. @@ -2857,7 +4455,7 @@ func (b *BulkDeleteCustomersResponse) String() string { return fmt.Sprintf("%#v", b) } -// Represents an individual delete request in a [BulkDeleteLocationCustomAttributes]($e/LocationCustomAttributes/BulkDeleteLocationCustomAttributes) +// Represents an individual delete request in a [BulkDeleteLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkDeleteLocationCustomAttributes) // request. An individual request contains an optional ID of the associated custom attribute definition // and optional key of the associated custom attribute definition. type BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest struct { @@ -2903,7 +4501,7 @@ func (b *BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteR return fmt.Sprintf("%#v", b) } -// Represents a [BulkDeleteLocationCustomAttributes]($e/LocationCustomAttributes/BulkDeleteLocationCustomAttributes) response, +// Represents a [BulkDeleteLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkDeleteLocationCustomAttributes) response, // which contains a map of responses that each corresponds to an individual delete request. type BulkDeleteLocationCustomAttributesResponse struct { // A map of responses that correspond to individual delete requests. Each response has the @@ -2950,7 +4548,7 @@ func (b *BulkDeleteLocationCustomAttributesResponse) String() string { return fmt.Sprintf("%#v", b) } -// Represents an individual delete response in a [BulkDeleteLocationCustomAttributes]($e/LocationCustomAttributes/BulkDeleteLocationCustomAttributes) +// Represents an individual delete response in a [BulkDeleteLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkDeleteLocationCustomAttributes) // request. type BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse struct { // The ID of the location associated with the custom attribute. @@ -2996,7 +4594,7 @@ func (b *BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDelete return fmt.Sprintf("%#v", b) } -// Represents an individual delete request in a [BulkDeleteMerchantCustomAttributes]($e/MerchantCustomAttributes/BulkDeleteMerchantCustomAttributes) +// Represents an individual delete request in a [BulkDeleteMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkDeleteMerchantCustomAttributes) // request. An individual request contains an optional ID of the associated custom attribute definition // and optional key of the associated custom attribute definition. type BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest struct { @@ -3042,7 +4640,7 @@ func (b *BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteR return fmt.Sprintf("%#v", b) } -// Represents a [BulkDeleteMerchantCustomAttributes]($e/MerchantCustomAttributes/BulkDeleteMerchantCustomAttributes) response, +// Represents a [BulkDeleteMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkDeleteMerchantCustomAttributes) response, // which contains a map of responses that each corresponds to an individual delete request. type BulkDeleteMerchantCustomAttributesResponse struct { // A map of responses that correspond to individual delete requests. Each response has the @@ -3089,7 +4687,7 @@ func (b *BulkDeleteMerchantCustomAttributesResponse) String() string { return fmt.Sprintf("%#v", b) } -// Represents an individual delete response in a [BulkDeleteMerchantCustomAttributes]($e/MerchantCustomAttributes/BulkDeleteMerchantCustomAttributes) +// Represents an individual delete response in a [BulkDeleteMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkDeleteMerchantCustomAttributes) // request. type BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse struct { // Errors that occurred while processing the individual MerchantCustomAttributeDeleteRequest request @@ -3271,7 +4869,7 @@ func (b *BulkRetrieveBookingsResponse) String() string { } // Defines the fields included in the response body from the -// [BulkRetrieveCustomers]($e/Customers/BulkRetrieveCustomers) endpoint. +// [BulkRetrieveCustomers](api-endpoint:Customers-BulkRetrieveCustomers) endpoint. type BulkRetrieveCustomersResponse struct { // A map of responses that correspond to individual retrieve requests, represented by // key-value pairs. @@ -3322,7 +4920,7 @@ func (b *BulkRetrieveCustomersResponse) String() string { return fmt.Sprintf("%#v", b) } -// Response payload for the [BulkRetrieveTeamMemberBookingProfiles]($e/Bookings/BulkRetrieveTeamMemberBookingProfiles) endpoint. +// 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"` @@ -3368,7 +4966,7 @@ func (b *BulkRetrieveTeamMemberBookingProfilesResponse) String() string { } // Defines output parameters in a response of the -// [BulkSwapPlan]($e/Subscriptions/BulkSwapPlan) endpoint. +// [BulkSwapPlan](api-endpoint:Subscriptions-BulkSwapPlan) endpoint. type BulkSwapPlanResponse struct { // Errors encountered during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` @@ -3414,7 +5012,7 @@ func (b *BulkSwapPlanResponse) String() string { } // Defines the customer data provided in individual update requests for a -// [BulkUpdateCustomers]($e/Customers/BulkUpdateCustomers) operation. +// [BulkUpdateCustomers](api-endpoint:Customers-BulkUpdateCustomers) operation. type BulkUpdateCustomerData struct { // The given name (that is, the first name) associated with the customer profile. GivenName *string `json:"given_name,omitempty" url:"given_name,omitempty"` @@ -3494,7 +5092,7 @@ func (b *BulkUpdateCustomerData) String() string { } // Defines the fields included in the response body from the -// [BulkUpdateCustomers]($e/Customers/BulkUpdateCustomers) endpoint. +// [BulkUpdateCustomers](api-endpoint:Customers-BulkUpdateCustomers) endpoint. type BulkUpdateCustomersResponse struct { // A map of responses that correspond to individual update requests, represented by // key-value pairs. @@ -3545,7 +5143,7 @@ func (b *BulkUpdateCustomersResponse) String() string { return fmt.Sprintf("%#v", b) } -// Represents a [BulkUpsertBookingCustomAttributes]($e/BookingCustomAttributes/BulkUpsertBookingCustomAttributes) response, +// Represents a [BulkUpsertBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkUpsertBookingCustomAttributes) response, // which contains a map of responses that each corresponds to an individual upsert request. type BulkUpsertBookingCustomAttributesResponse struct { // A map of responses that correspond to individual upsert requests. Each response has the @@ -3592,7 +5190,7 @@ func (b *BulkUpsertBookingCustomAttributesResponse) String() string { return fmt.Sprintf("%#v", b) } -// Represents an individual upsert request in a [BulkUpsertLocationCustomAttributes]($e/LocationCustomAttributes/BulkUpsertLocationCustomAttributes) +// Represents an individual upsert request in a [BulkUpsertLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkUpsertLocationCustomAttributes) // request. An individual request contains a location ID, the custom attribute to create or update, // and an optional idempotency key. type BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest struct { @@ -3650,7 +5248,7 @@ func (b *BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertR return fmt.Sprintf("%#v", b) } -// Represents a [BulkUpsertLocationCustomAttributes]($e/LocationCustomAttributes/BulkUpsertLocationCustomAttributes) response, +// Represents a [BulkUpsertLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkUpsertLocationCustomAttributes) response, // which contains a map of responses that each corresponds to an individual upsert request. type BulkUpsertLocationCustomAttributesResponse struct { // A map of responses that correspond to individual upsert requests. Each response has the @@ -3697,7 +5295,7 @@ func (b *BulkUpsertLocationCustomAttributesResponse) String() string { return fmt.Sprintf("%#v", b) } -// Represents a response for an individual upsert request in a [BulkUpsertLocationCustomAttributes]($e/LocationCustomAttributes/BulkUpsertLocationCustomAttributes) operation. +// Represents a response for an individual upsert request in a [BulkUpsertLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkUpsertLocationCustomAttributes) operation. type BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse struct { // The ID of the location associated with the custom attribute. LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` @@ -3744,7 +5342,7 @@ func (b *BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsert return fmt.Sprintf("%#v", b) } -// Represents an individual upsert request in a [BulkUpsertMerchantCustomAttributes]($e/MerchantCustomAttributes/BulkUpsertMerchantCustomAttributes) +// Represents an individual upsert request in a [BulkUpsertMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkUpsertMerchantCustomAttributes) // request. An individual request contains a merchant ID, the custom attribute to create or update, // and an optional idempotency key. type BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest struct { @@ -3802,7 +5400,7 @@ func (b *BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertR return fmt.Sprintf("%#v", b) } -// Represents a [BulkUpsertMerchantCustomAttributes]($e/MerchantCustomAttributes/BulkUpsertMerchantCustomAttributes) response, +// Represents a [BulkUpsertMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkUpsertMerchantCustomAttributes) response, // which contains a map of responses that each corresponds to an individual upsert request. type BulkUpsertMerchantCustomAttributesResponse struct { // A map of responses that correspond to individual upsert requests. Each response has the @@ -3849,7 +5447,7 @@ func (b *BulkUpsertMerchantCustomAttributesResponse) String() string { return fmt.Sprintf("%#v", b) } -// Represents a response for an individual upsert request in a [BulkUpsertMerchantCustomAttributes]($e/MerchantCustomAttributes/BulkUpsertMerchantCustomAttributes) operation. +// Represents a response for an individual upsert request in a [BulkUpsertMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkUpsertMerchantCustomAttributes) operation. type BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse struct { // The ID of the merchant associated with the custom attribute. MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` @@ -4421,7 +6019,7 @@ func (b *BuyNowPayLaterDetails) String() string { return fmt.Sprintf("%#v", b) } -// Represents a [CalculateLoyaltyPoints]($e/Loyalty/CalculateLoyaltyPoints) response. +// Represents a [CalculateLoyaltyPoints](api-endpoint:Loyalty-CalculateLoyaltyPoints) response. type CalculateLoyaltyPointsResponse struct { // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` @@ -4603,7 +6201,7 @@ func (c *CancelInvoiceResponse) String() string { return fmt.Sprintf("%#v", c) } -// Represents a [CancelLoyaltyPromotion]($e/Loyalty/CancelLoyaltyPromotion) request. +// Represents a [CancelLoyaltyPromotion](api-endpoint:Loyalty-CancelLoyaltyPromotion) request. type CancelLoyaltyPromotionRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage @@ -4643,7 +6241,7 @@ func (c *CancelLoyaltyPromotionRequest) String() string { return fmt.Sprintf("%#v", c) } -// Represents a [CancelLoyaltyPromotion]($e/Loyalty/CancelLoyaltyPromotion) response. +// Represents a [CancelLoyaltyPromotion](api-endpoint:Loyalty-CancelLoyaltyPromotion) response. // Either `loyalty_promotion` or `errors` is present in the response. type CancelLoyaltyPromotionResponse struct { // Any errors that occurred during the request. @@ -4690,7 +6288,7 @@ func (c *CancelLoyaltyPromotionResponse) String() string { } // Defines the response returned by -// [CancelPaymentByIdempotencyKey]($e/Payments/CancelPaymentByIdempotencyKey). +// [CancelPaymentByIdempotencyKey](api-endpoint:Payments-CancelPaymentByIdempotencyKey). // On success, `errors` is empty. type CancelPaymentByIdempotencyKeyResponse struct { // Any errors that occurred during the request. @@ -4735,7 +6333,7 @@ func (c *CancelPaymentByIdempotencyKeyResponse) String() string { } // Describes the request to cancel (void) a payment using -// [CancelPayment]($e/Payments/CancelPayment). +// [CancelPayment](api-endpoint:Payments-CancelPayment). // You can only cancel a payment that is approved (not completed). // For more information, see // [Delayed capture of a payment](https://developer.squareup.com/docs/payments-api/take-payments/card-payments#delayed-capture-of-a-card-payment). @@ -4778,7 +6376,7 @@ func (c *CancelPaymentRequest) String() string { return fmt.Sprintf("%#v", c) } -// Defines the response returned by [CancelPayment]($e/Payments/CancelPayment). +// Defines the response returned by [CancelPayment](api-endpoint:Payments-CancelPayment). type CancelPaymentResponse struct { // Information about errors encountered during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` @@ -4824,7 +6422,7 @@ func (c *CancelPaymentResponse) String() string { } // Defines input parameters in a request to the -// [CancelSubscription]($e/Subscriptions/CancelSubscription) endpoint. +// [CancelSubscription](api-endpoint:Subscriptions-CancelSubscription) endpoint. type CancelSubscriptionRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage @@ -4865,7 +6463,7 @@ func (c *CancelSubscriptionRequest) String() string { } // Defines output parameters in a response from the -// [CancelSubscription]($e/Subscriptions/CancelSubscription) endpoint. +// [CancelSubscription](api-endpoint:Subscriptions-CancelSubscription) endpoint. type CancelSubscriptionResponse struct { // Errors encountered during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` @@ -4912,45 +6510,6 @@ func (c *CancelSubscriptionResponse) String() string { return fmt.Sprintf("%#v", c) } -type CancelTerminalActionRequest struct { - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (c *CancelTerminalActionRequest) GetExtraProperties() map[string]interface{} { - return c.extraProperties -} - -func (c *CancelTerminalActionRequest) UnmarshalJSON(data []byte) error { - type unmarshaler CancelTerminalActionRequest - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *c = CancelTerminalActionRequest(value) - - extraProperties, err := core.ExtractExtraProperties(data, *c) - if err != nil { - return err - } - c.extraProperties = extraProperties - - c._rawJSON = json.RawMessage(data) - return nil -} - -func (c *CancelTerminalActionRequest) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(c); err == nil { - return value - } - return fmt.Sprintf("%#v", c) -} - type CancelTerminalActionResponse struct { // Information on errors encountered during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` @@ -4995,45 +6554,6 @@ func (c *CancelTerminalActionResponse) String() string { return fmt.Sprintf("%#v", c) } -type CancelTerminalCheckoutRequest struct { - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (c *CancelTerminalCheckoutRequest) GetExtraProperties() map[string]interface{} { - return c.extraProperties -} - -func (c *CancelTerminalCheckoutRequest) UnmarshalJSON(data []byte) error { - type unmarshaler CancelTerminalCheckoutRequest - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *c = CancelTerminalCheckoutRequest(value) - - extraProperties, err := core.ExtractExtraProperties(data, *c) - if err != nil { - return err - } - c.extraProperties = extraProperties - - c._rawJSON = json.RawMessage(data) - return nil -} - -func (c *CancelTerminalCheckoutRequest) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(c); err == nil { - return value - } - return fmt.Sprintf("%#v", c) -} - type CancelTerminalCheckoutResponse struct { // Information about errors encountered during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` @@ -5078,45 +6598,6 @@ func (c *CancelTerminalCheckoutResponse) String() string { return fmt.Sprintf("%#v", c) } -type CancelTerminalRefundRequest struct { - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (c *CancelTerminalRefundRequest) GetExtraProperties() map[string]interface{} { - return c.extraProperties -} - -func (c *CancelTerminalRefundRequest) UnmarshalJSON(data []byte) error { - type unmarshaler CancelTerminalRefundRequest - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *c = CancelTerminalRefundRequest(value) - - extraProperties, err := core.ExtractExtraProperties(data, *c) - if err != nil { - return err - } - c.extraProperties = extraProperties - - c._rawJSON = json.RawMessage(data) - return nil -} - -func (c *CancelTerminalRefundRequest) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(c); err == nil { - return value - } - return fmt.Sprintf("%#v", c) -} - type CancelTerminalRefundResponse struct { // Information about errors encountered during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` @@ -5334,6 +6815,145 @@ func (c *Card) String() string { return fmt.Sprintf("%#v", c) } +// Published when a Card's expiration information or pan is automatically updated. +type CardAutomaticallyUpdatedEvent struct { + // The ID of the target seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"card.automatically_updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *CardAutomaticallyUpdatedEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CardAutomaticallyUpdatedEvent) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CardAutomaticallyUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler CardAutomaticallyUpdatedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CardAutomaticallyUpdatedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CardAutomaticallyUpdatedEvent) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +type CardAutomaticallyUpdatedEventData struct { + // The type of the event data object. The value is `"card"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The ID of the event data object. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the automatically updated card. + Object *CardAutomaticallyUpdatedEventObject `json:"object,omitempty" url:"object,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CardAutomaticallyUpdatedEventData) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CardAutomaticallyUpdatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler CardAutomaticallyUpdatedEventData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CardAutomaticallyUpdatedEventData(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CardAutomaticallyUpdatedEventData) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +type CardAutomaticallyUpdatedEventObject struct { + // The automatically updated card. + Card *Card `json:"card,omitempty" url:"card,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CardAutomaticallyUpdatedEventObject) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CardAutomaticallyUpdatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler CardAutomaticallyUpdatedEventObject + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CardAutomaticallyUpdatedEventObject(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CardAutomaticallyUpdatedEventObject) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + // Indicates a card's brand, such as `VISA` or `MASTERCARD`. type CardBrand string @@ -5419,69 +7039,34 @@ func (c CardCoBrand) Ptr() *CardCoBrand { return &c } -// Reflects the current status of a card payment. Contains only non-confidential information. -type CardPaymentDetails struct { - // The card payment's current state. The state can be AUTHORIZED, CAPTURED, VOIDED, or - // FAILED. - Status *string `json:"status,omitempty" url:"status,omitempty"` - // The credit card's non-confidential details. - Card *Card `json:"card,omitempty" url:"card,omitempty"` - // The method used to enter the card's details for the payment. The method can be - // `KEYED`, `SWIPED`, `EMV`, `ON_FILE`, or `CONTACTLESS`. - EntryMethod *string `json:"entry_method,omitempty" url:"entry_method,omitempty"` - // The status code returned from the Card Verification Value (CVV) check. The code can be - // `CVV_ACCEPTED`, `CVV_REJECTED`, or `CVV_NOT_CHECKED`. - CvvStatus *string `json:"cvv_status,omitempty" url:"cvv_status,omitempty"` - // The status code returned from the Address Verification System (AVS) check. The code can be - // `AVS_ACCEPTED`, `AVS_REJECTED`, or `AVS_NOT_CHECKED`. - AvsStatus *string `json:"avs_status,omitempty" url:"avs_status,omitempty"` - // The status code returned by the card issuer that describes the payment's - // authorization status. - AuthResultCode *string `json:"auth_result_code,omitempty" url:"auth_result_code,omitempty"` - // For EMV payments, the application ID identifies the EMV application used for the payment. - ApplicationIdentifier *string `json:"application_identifier,omitempty" url:"application_identifier,omitempty"` - // For EMV payments, the human-readable name of the EMV application used for the payment. - ApplicationName *string `json:"application_name,omitempty" url:"application_name,omitempty"` - // For EMV payments, the cryptogram generated for the payment. - ApplicationCryptogram *string `json:"application_cryptogram,omitempty" url:"application_cryptogram,omitempty"` - // For EMV payments, the method used to verify the cardholder's identity. The method can be - // `PIN`, `SIGNATURE`, `PIN_AND_SIGNATURE`, `ON_DEVICE`, or `NONE`. - VerificationMethod *string `json:"verification_method,omitempty" url:"verification_method,omitempty"` - // For EMV payments, the results of the cardholder verification. The result can be - // `SUCCESS`, `FAILURE`, or `UNKNOWN`. - VerificationResults *string `json:"verification_results,omitempty" url:"verification_results,omitempty"` - // The statement description sent to the card networks. - // - // Note: The actual statement description varies and is likely to be truncated and appended with - // additional information on a per issuer basis. - StatementDescription *string `json:"statement_description,omitempty" url:"statement_description,omitempty"` - // **Deprecated**: Use `Payment.device_details` instead. - // - // Details about the device that took the payment. - DeviceDetails *DeviceDetails `json:"device_details,omitempty" url:"device_details,omitempty"` - // The timeline for card payments. - CardPaymentTimeline *CardPaymentTimeline `json:"card_payment_timeline,omitempty" url:"card_payment_timeline,omitempty"` - // Whether the card must be physically present for the payment to - // be refunded. If set to `true`, the card must be present. - RefundRequiresCardPresence *bool `json:"refund_requires_card_presence,omitempty" url:"refund_requires_card_presence,omitempty"` - // Information about errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Published when a Card is created or imported. +type CardCreatedEvent struct { + // The ID of the target seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"card.created"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *CardCreatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CardPaymentDetails) GetExtraProperties() map[string]interface{} { +func (c *CardCreatedEvent) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CardPaymentDetails) UnmarshalJSON(data []byte) error { - type unmarshaler CardPaymentDetails +func (c *CardCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler CardCreatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CardPaymentDetails(value) + *c = CardCreatedEvent(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -5493,7 +7078,7 @@ func (c *CardPaymentDetails) UnmarshalJSON(data []byte) error { return nil } -func (c *CardPaymentDetails) String() string { +func (c *CardCreatedEvent) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -5505,30 +7090,29 @@ func (c *CardPaymentDetails) String() string { return fmt.Sprintf("%#v", c) } -// The timeline for card payments. -type CardPaymentTimeline struct { - // The timestamp when the payment was authorized, in RFC 3339 format. - AuthorizedAt *string `json:"authorized_at,omitempty" url:"authorized_at,omitempty"` - // The timestamp when the payment was captured, in RFC 3339 format. - CapturedAt *string `json:"captured_at,omitempty" url:"captured_at,omitempty"` - // The timestamp when the payment was voided, in RFC 3339 format. - VoidedAt *string `json:"voided_at,omitempty" url:"voided_at,omitempty"` +type CardCreatedEventData struct { + // The type of the event data object. The value is `"card"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The ID of the event data object. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the created card. + Object *CardCreatedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CardPaymentTimeline) GetExtraProperties() map[string]interface{} { +func (c *CardCreatedEventData) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CardPaymentTimeline) UnmarshalJSON(data []byte) error { - type unmarshaler CardPaymentTimeline +func (c *CardCreatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler CardCreatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CardPaymentTimeline(value) + *c = CardCreatedEventData(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -5540,7 +7124,7 @@ func (c *CardPaymentTimeline) UnmarshalJSON(data []byte) error { return nil } -func (c *CardPaymentTimeline) String() string { +func (c *CardCreatedEventData) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -5552,84 +7136,25 @@ func (c *CardPaymentTimeline) String() string { return fmt.Sprintf("%#v", c) } -// Indicates a card's prepaid type, such as `NOT_PREPAID` or `PREPAID`. -type CardPrepaidType string - -const ( - CardPrepaidTypeUnknownPrepaidType CardPrepaidType = "UNKNOWN_PREPAID_TYPE" - CardPrepaidTypeNotPrepaid CardPrepaidType = "NOT_PREPAID" - CardPrepaidTypePrepaid CardPrepaidType = "PREPAID" -) - -func NewCardPrepaidTypeFromString(s string) (CardPrepaidType, error) { - switch s { - case "UNKNOWN_PREPAID_TYPE": - return CardPrepaidTypeUnknownPrepaidType, nil - case "NOT_PREPAID": - return CardPrepaidTypeNotPrepaid, nil - case "PREPAID": - return CardPrepaidTypePrepaid, nil - } - var t CardPrepaidType - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (c CardPrepaidType) Ptr() *CardPrepaidType { - return &c -} - -// Indicates a card's type, such as `CREDIT` or `DEBIT`. -type CardType string - -const ( - CardTypeUnknownCardType CardType = "UNKNOWN_CARD_TYPE" - CardTypeCredit CardType = "CREDIT" - CardTypeDebit CardType = "DEBIT" -) - -func NewCardTypeFromString(s string) (CardType, error) { - switch s { - case "UNKNOWN_CARD_TYPE": - return CardTypeUnknownCardType, nil - case "CREDIT": - return CardTypeCredit, nil - case "DEBIT": - return CardTypeDebit, nil - } - var t CardType - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (c CardType) Ptr() *CardType { - return &c -} - -// Additional details about `WALLET` type payments with the `brand` of `CASH_APP`. -type CashAppDetails struct { - // The name of the Cash App account holder. - BuyerFullName *string `json:"buyer_full_name,omitempty" url:"buyer_full_name,omitempty"` - // The country of the Cash App account holder, in ISO 3166-1-alpha-2 format. - // - // For possible values, see [Country](entity:Country). - BuyerCountryCode *string `json:"buyer_country_code,omitempty" url:"buyer_country_code,omitempty"` - // $Cashtag of the Cash App account holder. - BuyerCashtag *string `json:"buyer_cashtag,omitempty" url:"buyer_cashtag,omitempty"` +type CardCreatedEventObject struct { + // The created card. + Card *Card `json:"card,omitempty" url:"card,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CashAppDetails) GetExtraProperties() map[string]interface{} { +func (c *CardCreatedEventObject) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CashAppDetails) UnmarshalJSON(data []byte) error { - type unmarshaler CashAppDetails +func (c *CardCreatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler CardCreatedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CashAppDetails(value) + *c = CardCreatedEventObject(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -5641,7 +7166,7 @@ func (c *CashAppDetails) UnmarshalJSON(data []byte) error { return nil } -func (c *CashAppDetails) String() string { +func (c *CardCreatedEventObject) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -5653,27 +7178,34 @@ func (c *CashAppDetails) String() string { return fmt.Sprintf("%#v", c) } -type CashDrawerDevice struct { - // The device Square-issued ID - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The device merchant-specified name. - Name *string `json:"name,omitempty" url:"name,omitempty"` +// Published when a Card is disabled. +type CardDisabledEvent struct { + // The ID of the target seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"card.disabled"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *CardDisabledEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CashDrawerDevice) GetExtraProperties() map[string]interface{} { +func (c *CardDisabledEvent) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CashDrawerDevice) UnmarshalJSON(data []byte) error { - type unmarshaler CashDrawerDevice +func (c *CardDisabledEvent) UnmarshalJSON(data []byte) error { + type unmarshaler CardDisabledEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CashDrawerDevice(value) + *c = CardDisabledEvent(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -5685,7 +7217,7 @@ func (c *CashDrawerDevice) UnmarshalJSON(data []byte) error { return nil } -func (c *CashDrawerDevice) String() string { +func (c *CardDisabledEvent) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -5697,135 +7229,29 @@ func (c *CashDrawerDevice) String() string { return fmt.Sprintf("%#v", c) } -// The types of events on a CashDrawerShift. -// Each event type represents an employee action on the actual cash drawer -// represented by a CashDrawerShift. -type CashDrawerEventType string - -const ( - CashDrawerEventTypeNoSale CashDrawerEventType = "NO_SALE" - CashDrawerEventTypeCashTenderPayment CashDrawerEventType = "CASH_TENDER_PAYMENT" - CashDrawerEventTypeOtherTenderPayment CashDrawerEventType = "OTHER_TENDER_PAYMENT" - CashDrawerEventTypeCashTenderCancelledPayment CashDrawerEventType = "CASH_TENDER_CANCELLED_PAYMENT" - CashDrawerEventTypeOtherTenderCancelledPayment CashDrawerEventType = "OTHER_TENDER_CANCELLED_PAYMENT" - CashDrawerEventTypeCashTenderRefund CashDrawerEventType = "CASH_TENDER_REFUND" - CashDrawerEventTypeOtherTenderRefund CashDrawerEventType = "OTHER_TENDER_REFUND" - CashDrawerEventTypePaidIn CashDrawerEventType = "PAID_IN" - CashDrawerEventTypePaidOut CashDrawerEventType = "PAID_OUT" -) - -func NewCashDrawerEventTypeFromString(s string) (CashDrawerEventType, error) { - switch s { - case "NO_SALE": - return CashDrawerEventTypeNoSale, nil - case "CASH_TENDER_PAYMENT": - return CashDrawerEventTypeCashTenderPayment, nil - case "OTHER_TENDER_PAYMENT": - return CashDrawerEventTypeOtherTenderPayment, nil - case "CASH_TENDER_CANCELLED_PAYMENT": - return CashDrawerEventTypeCashTenderCancelledPayment, nil - case "OTHER_TENDER_CANCELLED_PAYMENT": - return CashDrawerEventTypeOtherTenderCancelledPayment, nil - case "CASH_TENDER_REFUND": - return CashDrawerEventTypeCashTenderRefund, nil - case "OTHER_TENDER_REFUND": - return CashDrawerEventTypeOtherTenderRefund, nil - case "PAID_IN": - return CashDrawerEventTypePaidIn, nil - case "PAID_OUT": - return CashDrawerEventTypePaidOut, nil - } - var t CashDrawerEventType - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (c CashDrawerEventType) Ptr() *CashDrawerEventType { - return &c -} - -// This model gives the details of a cash drawer shift. -// The cash_payment_money, cash_refund_money, cash_paid_in_money, -// and cash_paid_out_money fields are all computed by summing their respective -// event types. -type CashDrawerShift struct { - // The shift unique ID. +type CardDisabledEventData struct { + // The type of the event data object. The value is `"card"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The ID of the event data object. ID *string `json:"id,omitempty" url:"id,omitempty"` - // The shift current state. - // See [CashDrawerShiftState](#type-cashdrawershiftstate) for possible values - State *CashDrawerShiftState `json:"state,omitempty" url:"state,omitempty"` - // The time when the shift began, in ISO 8601 format. - OpenedAt *string `json:"opened_at,omitempty" url:"opened_at,omitempty"` - // The time when the shift ended, in ISO 8601 format. - EndedAt *string `json:"ended_at,omitempty" url:"ended_at,omitempty"` - // The time when the shift was closed, in ISO 8601 format. - ClosedAt *string `json:"closed_at,omitempty" url:"closed_at,omitempty"` - // The free-form text description of a cash drawer by an employee. - Description *string `json:"description,omitempty" url:"description,omitempty"` - // The amount of money in the cash drawer at the start of the shift. - // The amount must be greater than or equal to zero. - OpenedCashMoney *Money `json:"opened_cash_money,omitempty" url:"opened_cash_money,omitempty"` - // The amount of money added to the cash drawer from cash payments. - // This is computed by summing all events with the types CASH_TENDER_PAYMENT and - // CASH_TENDER_CANCELED_PAYMENT. The amount is always greater than or equal to - // zero. - CashPaymentMoney *Money `json:"cash_payment_money,omitempty" url:"cash_payment_money,omitempty"` - // The amount of money removed from the cash drawer from cash refunds. - // It is computed by summing the events of type CASH_TENDER_REFUND. The amount - // is always greater than or equal to zero. - CashRefundsMoney *Money `json:"cash_refunds_money,omitempty" url:"cash_refunds_money,omitempty"` - // The amount of money added to the cash drawer for reasons other than cash - // payments. It is computed by summing the events of type PAID_IN. The amount is - // always greater than or equal to zero. - CashPaidInMoney *Money `json:"cash_paid_in_money,omitempty" url:"cash_paid_in_money,omitempty"` - // The amount of money removed from the cash drawer for reasons other than - // cash refunds. It is computed by summing the events of type PAID_OUT. The amount - // is always greater than or equal to zero. - CashPaidOutMoney *Money `json:"cash_paid_out_money,omitempty" url:"cash_paid_out_money,omitempty"` - // The amount of money that should be in the cash drawer at the end of the - // shift, based on the shift's other money amounts. - // This can be negative if employees have not correctly recorded all the events - // on the cash drawer. - // cash_paid_out_money is a summation of amounts from cash_payment_money (zero - // or positive), cash_refunds_money (zero or negative), cash_paid_in_money (zero - // or positive), and cash_paid_out_money (zero or negative) event types. - ExpectedCashMoney *Money `json:"expected_cash_money,omitempty" url:"expected_cash_money,omitempty"` - // The amount of money found in the cash drawer at the end of the shift - // by an auditing employee. The amount should be positive. - ClosedCashMoney *Money `json:"closed_cash_money,omitempty" url:"closed_cash_money,omitempty"` - // The device running Square Point of Sale that was connected to the cash drawer. - Device *CashDrawerDevice `json:"device,omitempty" url:"device,omitempty"` - // The shift start time in RFC 3339 format. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The shift updated at time in RFC 3339 format. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` - // The ID of the location the cash drawer shift belongs to. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` - // The IDs of all team members that were logged into Square Point of Sale at any - // point while the cash drawer shift was open. - TeamMemberIDs []string `json:"team_member_ids,omitempty" url:"team_member_ids,omitempty"` - // The ID of the team member that started the cash drawer shift. - OpeningTeamMemberID *string `json:"opening_team_member_id,omitempty" url:"opening_team_member_id,omitempty"` - // The ID of the team member that ended the cash drawer shift. - EndingTeamMemberID *string `json:"ending_team_member_id,omitempty" url:"ending_team_member_id,omitempty"` - // The ID of the team member that closed the cash drawer shift by auditing - // the cash drawer contents. - ClosingTeamMemberID *string `json:"closing_team_member_id,omitempty" url:"closing_team_member_id,omitempty"` + // An object containing the disabled card. + Object *CardDisabledEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CashDrawerShift) GetExtraProperties() map[string]interface{} { +func (c *CardDisabledEventData) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CashDrawerShift) UnmarshalJSON(data []byte) error { - type unmarshaler CashDrawerShift +func (c *CardDisabledEventData) UnmarshalJSON(data []byte) error { + type unmarshaler CardDisabledEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CashDrawerShift(value) + *c = CardDisabledEventData(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -5837,7 +7263,7 @@ func (c *CashDrawerShift) UnmarshalJSON(data []byte) error { return nil } -func (c *CashDrawerShift) String() string { +func (c *CardDisabledEventData) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -5849,40 +7275,25 @@ func (c *CashDrawerShift) String() string { return fmt.Sprintf("%#v", c) } -type CashDrawerShiftEvent struct { - // The unique ID of the event. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The type of cash drawer shift event. - // See [CashDrawerEventType](#type-cashdrawereventtype) for possible values - EventType *CashDrawerEventType `json:"event_type,omitempty" url:"event_type,omitempty"` - // The amount of money that was added to or removed from the cash drawer - // in the event. The amount can be positive (for added money) - // or zero (for other tender type payments). The addition or removal of money can be determined by - // by the event type. - EventMoney *Money `json:"event_money,omitempty" url:"event_money,omitempty"` - // The event time in RFC 3339 format. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // An optional description of the event, entered by the employee that - // created the event. - Description *string `json:"description,omitempty" url:"description,omitempty"` - // The ID of the team member that created the event. - TeamMemberID *string `json:"team_member_id,omitempty" url:"team_member_id,omitempty"` +type CardDisabledEventObject struct { + // The disabled card. + Card *Card `json:"card,omitempty" url:"card,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CashDrawerShiftEvent) GetExtraProperties() map[string]interface{} { +func (c *CardDisabledEventObject) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CashDrawerShiftEvent) UnmarshalJSON(data []byte) error { - type unmarshaler CashDrawerShiftEvent +func (c *CardDisabledEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler CardDisabledEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CashDrawerShiftEvent(value) + *c = CardDisabledEventObject(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -5894,7 +7305,7 @@ func (c *CashDrawerShiftEvent) UnmarshalJSON(data []byte) error { return nil } -func (c *CashDrawerShiftEvent) String() string { +func (c *CardDisabledEventObject) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -5906,84 +7317,34 @@ func (c *CashDrawerShiftEvent) String() string { return fmt.Sprintf("%#v", c) } -// The current state of a cash drawer shift. -type CashDrawerShiftState string - -const ( - CashDrawerShiftStateOpen CashDrawerShiftState = "OPEN" - CashDrawerShiftStateEnded CashDrawerShiftState = "ENDED" - CashDrawerShiftStateClosed CashDrawerShiftState = "CLOSED" -) - -func NewCashDrawerShiftStateFromString(s string) (CashDrawerShiftState, error) { - switch s { - case "OPEN": - return CashDrawerShiftStateOpen, nil - case "ENDED": - return CashDrawerShiftStateEnded, nil - case "CLOSED": - return CashDrawerShiftStateClosed, nil - } - var t CashDrawerShiftState - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (c CashDrawerShiftState) Ptr() *CashDrawerShiftState { - return &c -} - -// The summary of a closed cash drawer shift. -// This model contains only the money counted to start a cash drawer shift, counted -// at the end of the shift, and the amount that should be in the drawer at shift -// end based on summing all cash drawer shift events. -type CashDrawerShiftSummary struct { - // The shift unique ID. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The shift current state. - // See [CashDrawerShiftState](#type-cashdrawershiftstate) for possible values - State *CashDrawerShiftState `json:"state,omitempty" url:"state,omitempty"` - // The shift start time in ISO 8601 format. - OpenedAt *string `json:"opened_at,omitempty" url:"opened_at,omitempty"` - // The shift end time in ISO 8601 format. - EndedAt *string `json:"ended_at,omitempty" url:"ended_at,omitempty"` - // The shift close time in ISO 8601 format. - ClosedAt *string `json:"closed_at,omitempty" url:"closed_at,omitempty"` - // An employee free-text description of a cash drawer shift. - Description *string `json:"description,omitempty" url:"description,omitempty"` - // The amount of money in the cash drawer at the start of the shift. This - // must be a positive amount. - OpenedCashMoney *Money `json:"opened_cash_money,omitempty" url:"opened_cash_money,omitempty"` - // The amount of money that should be in the cash drawer at the end of the - // shift, based on the cash drawer events on the shift. - // The amount is correct if all shift employees accurately recorded their - // cash drawer shift events. Unrecorded events and events with the wrong amount - // result in an incorrect expected_cash_money amount that can be negative. - ExpectedCashMoney *Money `json:"expected_cash_money,omitempty" url:"expected_cash_money,omitempty"` - // The amount of money found in the cash drawer at the end of the shift by - // an auditing employee. The amount must be greater than or equal to zero. - ClosedCashMoney *Money `json:"closed_cash_money,omitempty" url:"closed_cash_money,omitempty"` - // The shift start time in RFC 3339 format. +// Published when a Card is GDPR forgotten/vaulted. +type CardForgottenEvent struct { + // The ID of the target seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"card.forgotten"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The shift updated at time in RFC 3339 format. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` - // The ID of the location the cash drawer shift belongs to. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The data associated with the event. + Data *CardForgottenEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CashDrawerShiftSummary) GetExtraProperties() map[string]interface{} { +func (c *CardForgottenEvent) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CashDrawerShiftSummary) UnmarshalJSON(data []byte) error { - type unmarshaler CashDrawerShiftSummary +func (c *CardForgottenEvent) UnmarshalJSON(data []byte) error { + type unmarshaler CardForgottenEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CashDrawerShiftSummary(value) + *c = CardForgottenEvent(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -5995,7 +7356,7 @@ func (c *CashDrawerShiftSummary) UnmarshalJSON(data []byte) error { return nil } -func (c *CashDrawerShiftSummary) String() string { +func (c *CardForgottenEvent) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -6007,31 +7368,39 @@ func (c *CashDrawerShiftSummary) String() string { return fmt.Sprintf("%#v", c) } -// Stores details about a cash payment. Contains only non-confidential information. For more information, see -// [Take Cash Payments](https://developer.squareup.com/docs/payments-api/take-payments/cash-payments). -type CashPaymentDetails struct { - // The amount and currency of the money supplied by the buyer. - BuyerSuppliedMoney *Money `json:"buyer_supplied_money,omitempty" url:"buyer_supplied_money,omitempty"` - // The amount of change due back to the buyer. - // This read-only field is calculated - // from the `amount_money` and `buyer_supplied_money` fields. - ChangeBackMoney *Money `json:"change_back_money,omitempty" url:"change_back_money,omitempty"` +type CardForgottenEventCard struct { + // Unique ID for this card. Generated by Square. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The ID of a customer created using the Customers API associated with the card. + CustomerID *string `json:"customer_id,omitempty" url:"customer_id,omitempty"` + // Indicates whether or not a card can be used for payments. + Enabled *bool `json:"enabled,omitempty" url:"enabled,omitempty"` + // An optional user-defined reference ID that associates this card with + // another entity in an external system. For example, a customer ID from an + // external customer management system. + ReferenceID *string `json:"reference_id,omitempty" url:"reference_id,omitempty"` + // Current version number of the card. Increments with each card update. Requests to update an + // existing Card object will be rejected unless the version in the request matches the current + // version for the Card. + Version *int64 `json:"version,omitempty" url:"version,omitempty"` + // The ID of the merchant associated with the card. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CashPaymentDetails) GetExtraProperties() map[string]interface{} { +func (c *CardForgottenEventCard) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CashPaymentDetails) UnmarshalJSON(data []byte) error { - type unmarshaler CashPaymentDetails +func (c *CardForgottenEventCard) UnmarshalJSON(data []byte) error { + type unmarshaler CardForgottenEventCard var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CashPaymentDetails(value) + *c = CardForgottenEventCard(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -6043,7 +7412,7 @@ func (c *CashPaymentDetails) UnmarshalJSON(data []byte) error { return nil } -func (c *CashPaymentDetails) String() string { +func (c *CardForgottenEventCard) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -6055,35 +7424,29 @@ func (c *CashPaymentDetails) String() string { return fmt.Sprintf("%#v", c) } -// Represents a time period of availability. -type CatalogAvailabilityPeriod struct { - // The start time of an availability period, specified in local time using partial-time - // RFC 3339 format. For example, `8:30:00` for a period starting at 8:30 in the morning. - // Note that the seconds value is always :00, but it is appended for conformance to the RFC. - StartLocalTime *string `json:"start_local_time,omitempty" url:"start_local_time,omitempty"` - // The end time of an availability period, specified in local time using partial-time - // RFC 3339 format. For example, `21:00:00` for a period ending at 9:00 in the evening. - // Note that the seconds value is always :00, but it is appended for conformance to the RFC. - EndLocalTime *string `json:"end_local_time,omitempty" url:"end_local_time,omitempty"` - // The day of the week for this availability period. - // See [DayOfWeek](#type-dayofweek) for possible values - DayOfWeek *DayOfWeek `json:"day_of_week,omitempty" url:"day_of_week,omitempty"` +type CardForgottenEventData struct { + // The type of the event data object. The value is `"card"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The ID of the event data object. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the forgotten card. + Object *CardForgottenEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogAvailabilityPeriod) GetExtraProperties() map[string]interface{} { +func (c *CardForgottenEventData) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogAvailabilityPeriod) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogAvailabilityPeriod +func (c *CardForgottenEventData) UnmarshalJSON(data []byte) error { + type unmarshaler CardForgottenEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogAvailabilityPeriod(value) + *c = CardForgottenEventData(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -6095,7 +7458,7 @@ func (c *CatalogAvailabilityPeriod) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogAvailabilityPeriod) String() string { +func (c *CardForgottenEventData) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -6107,49 +7470,25 @@ func (c *CatalogAvailabilityPeriod) String() string { return fmt.Sprintf("%#v", c) } -// A category to which a `CatalogItem` instance belongs. -type CatalogCategory struct { - // The category name. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points. - Name *string `json:"name,omitempty" url:"name,omitempty"` - // The IDs of images associated with this `CatalogCategory` instance. - // Currently these images are not displayed by Square, but are free to be displayed in 3rd party applications. - ImageIDs []string `json:"image_ids,omitempty" url:"image_ids,omitempty"` - // The type of the category. - // See [CatalogCategoryType](#type-catalogcategorytype) for possible values - CategoryType *CatalogCategoryType `json:"category_type,omitempty" url:"category_type,omitempty"` - // The ID of the parent category of this category instance. - ParentCategory *CatalogObjectCategory `json:"parent_category,omitempty" url:"parent_category,omitempty"` - // Indicates whether a category is a top level category, which does not have any parent_category. - IsTopLevel *bool `json:"is_top_level,omitempty" url:"is_top_level,omitempty"` - // A list of IDs representing channels, such as a Square Online site, where the category can be made visible. - Channels []string `json:"channels,omitempty" url:"channels,omitempty"` - // The IDs of the `CatalogAvailabilityPeriod` objects associated with the category. - AvailabilityPeriodIDs []string `json:"availability_period_ids,omitempty" url:"availability_period_ids,omitempty"` - // Indicates whether the category is visible (`true`) or hidden (`false`) on all of the seller's Square Online sites. - OnlineVisibility *bool `json:"online_visibility,omitempty" url:"online_visibility,omitempty"` - // The top-level category in a category hierarchy. - RootCategory *string `json:"root_category,omitempty" url:"root_category,omitempty"` - // The SEO data for a seller's Square Online store. - EcomSeoData *CatalogEcomSeoData `json:"ecom_seo_data,omitempty" url:"ecom_seo_data,omitempty"` - // The path from the category to its root category. The first node of the path is the parent of the category - // and the last is the root category. The path is empty if the category is a root category. - PathToRoot []*CategoryPathToRootNode `json:"path_to_root,omitempty" url:"path_to_root,omitempty"` +type CardForgottenEventObject struct { + // The forgotten card. + Card *CardForgottenEventCard `json:"card,omitempty" url:"card,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogCategory) GetExtraProperties() map[string]interface{} { +func (c *CardForgottenEventObject) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogCategory) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogCategory +func (c *CardForgottenEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler CardForgottenEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogCategory(value) + *c = CardForgottenEventObject(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -6161,7 +7500,7 @@ func (c *CatalogCategory) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogCategory) String() string { +func (c *CardForgottenEventObject) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -6173,96 +7512,116 @@ func (c *CatalogCategory) String() string { return fmt.Sprintf("%#v", c) } -// Indicates the type of a category. -type CatalogCategoryType string +// Reflects the current status of a card payment. Contains only non-confidential information. +type CardPaymentDetails struct { + // The card payment's current state. The state can be AUTHORIZED, CAPTURED, VOIDED, or + // FAILED. + Status *string `json:"status,omitempty" url:"status,omitempty"` + // The credit card's non-confidential details. + Card *Card `json:"card,omitempty" url:"card,omitempty"` + // The method used to enter the card's details for the payment. The method can be + // `KEYED`, `SWIPED`, `EMV`, `ON_FILE`, or `CONTACTLESS`. + EntryMethod *string `json:"entry_method,omitempty" url:"entry_method,omitempty"` + // The status code returned from the Card Verification Value (CVV) check. The code can be + // `CVV_ACCEPTED`, `CVV_REJECTED`, or `CVV_NOT_CHECKED`. + CvvStatus *string `json:"cvv_status,omitempty" url:"cvv_status,omitempty"` + // The status code returned from the Address Verification System (AVS) check. The code can be + // `AVS_ACCEPTED`, `AVS_REJECTED`, or `AVS_NOT_CHECKED`. + AvsStatus *string `json:"avs_status,omitempty" url:"avs_status,omitempty"` + // The status code returned by the card issuer that describes the payment's + // authorization status. + AuthResultCode *string `json:"auth_result_code,omitempty" url:"auth_result_code,omitempty"` + // For EMV payments, the application ID identifies the EMV application used for the payment. + ApplicationIdentifier *string `json:"application_identifier,omitempty" url:"application_identifier,omitempty"` + // For EMV payments, the human-readable name of the EMV application used for the payment. + ApplicationName *string `json:"application_name,omitempty" url:"application_name,omitempty"` + // For EMV payments, the cryptogram generated for the payment. + ApplicationCryptogram *string `json:"application_cryptogram,omitempty" url:"application_cryptogram,omitempty"` + // For EMV payments, the method used to verify the cardholder's identity. The method can be + // `PIN`, `SIGNATURE`, `PIN_AND_SIGNATURE`, `ON_DEVICE`, or `NONE`. + VerificationMethod *string `json:"verification_method,omitempty" url:"verification_method,omitempty"` + // For EMV payments, the results of the cardholder verification. The result can be + // `SUCCESS`, `FAILURE`, or `UNKNOWN`. + VerificationResults *string `json:"verification_results,omitempty" url:"verification_results,omitempty"` + // The statement description sent to the card networks. + // + // Note: The actual statement description varies and is likely to be truncated and appended with + // additional information on a per issuer basis. + StatementDescription *string `json:"statement_description,omitempty" url:"statement_description,omitempty"` + // **Deprecated**: Use `Payment.device_details` instead. + // + // Details about the device that took the payment. + DeviceDetails *DeviceDetails `json:"device_details,omitempty" url:"device_details,omitempty"` + // The timeline for card payments. + CardPaymentTimeline *CardPaymentTimeline `json:"card_payment_timeline,omitempty" url:"card_payment_timeline,omitempty"` + // Whether the card must be physically present for the payment to + // be refunded. If set to `true`, the card must be present. + RefundRequiresCardPresence *bool `json:"refund_requires_card_presence,omitempty" url:"refund_requires_card_presence,omitempty"` + // Information about errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` -const ( - CatalogCategoryTypeRegularCategory CatalogCategoryType = "REGULAR_CATEGORY" - CatalogCategoryTypeMenuCategory CatalogCategoryType = "MENU_CATEGORY" - CatalogCategoryTypeKitchenCategory CatalogCategoryType = "KITCHEN_CATEGORY" -) + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} -func NewCatalogCategoryTypeFromString(s string) (CatalogCategoryType, error) { - switch s { - case "REGULAR_CATEGORY": - return CatalogCategoryTypeRegularCategory, nil - case "MENU_CATEGORY": - return CatalogCategoryTypeMenuCategory, nil - case "KITCHEN_CATEGORY": - return CatalogCategoryTypeKitchenCategory, nil +func (c *CardPaymentDetails) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CardPaymentDetails) UnmarshalJSON(data []byte) error { + type unmarshaler CardPaymentDetails + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - var t CatalogCategoryType - return "", fmt.Errorf("%s is not a valid %T", s, t) + *c = CardPaymentDetails(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil } -func (c CatalogCategoryType) Ptr() *CatalogCategoryType { - return &c +func (c *CardPaymentDetails) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) } -// Contains information defining a custom attribute. Custom attributes are -// intended to store additional information about a catalog object or to associate a -// catalog object with an entity in another system. Do not use custom attributes -// to store any sensitive information (personally identifiable information, card details, etc.). -// [Read more about custom attributes](https://developer.squareup.com/docs/catalog-api/add-custom-attributes) -type CatalogCustomAttributeDefinition struct { - // The type of this custom attribute. Cannot be modified after creation. - // Required. - // See [CatalogCustomAttributeDefinitionType](#type-catalogcustomattributedefinitiontype) for possible values - Type CatalogCustomAttributeDefinitionType `json:"type" url:"type"` - // The name of this definition for API and seller-facing UI purposes. - // The name must be unique within the (merchant, application) pair. Required. - // May not be empty and may not exceed 255 characters. Can be modified after creation. - Name string `json:"name" url:"name"` - // Seller-oriented description of the meaning of this Custom Attribute, - // any constraints that the seller should observe, etc. May be displayed as a tooltip in Square UIs. - Description *string `json:"description,omitempty" url:"description,omitempty"` - // **Read only.** Contains information about the application that - // created this custom attribute definition. - SourceApplication *SourceApplication `json:"source_application,omitempty" url:"source_application,omitempty"` - // The set of `CatalogObject` types that this custom atttribute may be applied to. - // Currently, only `ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, and `CATEGORY` are allowed. At least one type must be included. - // See [CatalogObjectType](#type-catalogobjecttype) for possible values - AllowedObjectTypes []CatalogObjectType `json:"allowed_object_types,omitempty" url:"allowed_object_types,omitempty"` - // The visibility of a custom attribute in seller-facing UIs (including Square Point - // of Sale applications and Square Dashboard). May be modified. - // See [CatalogCustomAttributeDefinitionSellerVisibility](#type-catalogcustomattributedefinitionsellervisibility) for possible values - SellerVisibility *CatalogCustomAttributeDefinitionSellerVisibility `json:"seller_visibility,omitempty" url:"seller_visibility,omitempty"` - // The visibility of a custom attribute to applications other than the application - // that created the attribute. - // See [CatalogCustomAttributeDefinitionAppVisibility](#type-catalogcustomattributedefinitionappvisibility) for possible values - AppVisibility *CatalogCustomAttributeDefinitionAppVisibility `json:"app_visibility,omitempty" url:"app_visibility,omitempty"` - // Optionally, populated when `type` = `STRING`, unset otherwise. - StringConfig *CatalogCustomAttributeDefinitionStringConfig `json:"string_config,omitempty" url:"string_config,omitempty"` - // Optionally, populated when `type` = `NUMBER`, unset otherwise. - NumberConfig *CatalogCustomAttributeDefinitionNumberConfig `json:"number_config,omitempty" url:"number_config,omitempty"` - // Populated when `type` is set to `SELECTION`, unset otherwise. - SelectionConfig *CatalogCustomAttributeDefinitionSelectionConfig `json:"selection_config,omitempty" url:"selection_config,omitempty"` - // The number of custom attributes that reference this - // custom attribute definition. Set by the server in response to a ListCatalog - // request with `include_counts` set to `true`. If the actual count is greater - // than 100, `custom_attribute_usage_count` will be set to `100`. - CustomAttributeUsageCount *int `json:"custom_attribute_usage_count,omitempty" url:"custom_attribute_usage_count,omitempty"` - // The name of the desired custom attribute key that can be used to access - // the custom attribute value on catalog objects. Cannot be modified after the - // custom attribute definition has been created. - // Must be between 1 and 60 characters, and may only contain the characters `[a-zA-Z0-9_-]`. - Key *string `json:"key,omitempty" url:"key,omitempty"` +// The timeline for card payments. +type CardPaymentTimeline struct { + // The timestamp when the payment was authorized, in RFC 3339 format. + AuthorizedAt *string `json:"authorized_at,omitempty" url:"authorized_at,omitempty"` + // The timestamp when the payment was captured, in RFC 3339 format. + CapturedAt *string `json:"captured_at,omitempty" url:"captured_at,omitempty"` + // The timestamp when the payment was voided, in RFC 3339 format. + VoidedAt *string `json:"voided_at,omitempty" url:"voided_at,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogCustomAttributeDefinition) GetExtraProperties() map[string]interface{} { +func (c *CardPaymentTimeline) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogCustomAttributeDefinition) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogCustomAttributeDefinition +func (c *CardPaymentTimeline) UnmarshalJSON(data []byte) error { + type unmarshaler CardPaymentTimeline var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogCustomAttributeDefinition(value) + *c = CardPaymentTimeline(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -6274,7 +7633,7 @@ func (c *CatalogCustomAttributeDefinition) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogCustomAttributeDefinition) String() string { +func (c *CardPaymentTimeline) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -6286,60 +7645,86 @@ func (c *CatalogCustomAttributeDefinition) String() string { return fmt.Sprintf("%#v", c) } -// Defines the visibility of a custom attribute to applications other than their -// creating application. -type CatalogCustomAttributeDefinitionAppVisibility string +// Indicates a card's prepaid type, such as `NOT_PREPAID` or `PREPAID`. +type CardPrepaidType string const ( - CatalogCustomAttributeDefinitionAppVisibilityAppVisibilityHidden CatalogCustomAttributeDefinitionAppVisibility = "APP_VISIBILITY_HIDDEN" - CatalogCustomAttributeDefinitionAppVisibilityAppVisibilityReadOnly CatalogCustomAttributeDefinitionAppVisibility = "APP_VISIBILITY_READ_ONLY" - CatalogCustomAttributeDefinitionAppVisibilityAppVisibilityReadWriteValues CatalogCustomAttributeDefinitionAppVisibility = "APP_VISIBILITY_READ_WRITE_VALUES" + CardPrepaidTypeUnknownPrepaidType CardPrepaidType = "UNKNOWN_PREPAID_TYPE" + CardPrepaidTypeNotPrepaid CardPrepaidType = "NOT_PREPAID" + CardPrepaidTypePrepaid CardPrepaidType = "PREPAID" ) -func NewCatalogCustomAttributeDefinitionAppVisibilityFromString(s string) (CatalogCustomAttributeDefinitionAppVisibility, error) { +func NewCardPrepaidTypeFromString(s string) (CardPrepaidType, error) { switch s { - case "APP_VISIBILITY_HIDDEN": - return CatalogCustomAttributeDefinitionAppVisibilityAppVisibilityHidden, nil - case "APP_VISIBILITY_READ_ONLY": - return CatalogCustomAttributeDefinitionAppVisibilityAppVisibilityReadOnly, nil - case "APP_VISIBILITY_READ_WRITE_VALUES": - return CatalogCustomAttributeDefinitionAppVisibilityAppVisibilityReadWriteValues, nil + case "UNKNOWN_PREPAID_TYPE": + return CardPrepaidTypeUnknownPrepaidType, nil + case "NOT_PREPAID": + return CardPrepaidTypeNotPrepaid, nil + case "PREPAID": + return CardPrepaidTypePrepaid, nil } - var t CatalogCustomAttributeDefinitionAppVisibility + var t CardPrepaidType return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (c CatalogCustomAttributeDefinitionAppVisibility) Ptr() *CatalogCustomAttributeDefinitionAppVisibility { +func (c CardPrepaidType) Ptr() *CardPrepaidType { return &c } -type CatalogCustomAttributeDefinitionNumberConfig struct { - // An integer between 0 and 5 that represents the maximum number of - // positions allowed after the decimal in number custom attribute values - // For example: - // - // - if the precision is 0, the quantity can be 1, 2, 3, etc. - // - if the precision is 1, the quantity can be 0.1, 0.2, etc. - // - if the precision is 2, the quantity can be 0.01, 0.12, etc. - // - // Default: 5 - Precision *int `json:"precision,omitempty" url:"precision,omitempty"` +// Indicates a card's type, such as `CREDIT` or `DEBIT`. +type CardType string + +const ( + CardTypeUnknownCardType CardType = "UNKNOWN_CARD_TYPE" + CardTypeCredit CardType = "CREDIT" + CardTypeDebit CardType = "DEBIT" +) + +func NewCardTypeFromString(s string) (CardType, error) { + switch s { + case "UNKNOWN_CARD_TYPE": + return CardTypeUnknownCardType, nil + case "CREDIT": + return CardTypeCredit, nil + case "DEBIT": + return CardTypeDebit, nil + } + var t CardType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c CardType) Ptr() *CardType { + return &c +} + +// Published when a Card is updated by the developer using the UpdateCard endpoint. +type CardUpdatedEvent struct { + // The ID of the target seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"card.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *CardUpdatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogCustomAttributeDefinitionNumberConfig) GetExtraProperties() map[string]interface{} { +func (c *CardUpdatedEvent) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogCustomAttributeDefinitionNumberConfig) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogCustomAttributeDefinitionNumberConfig +func (c *CardUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler CardUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogCustomAttributeDefinitionNumberConfig(value) + *c = CardUpdatedEvent(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -6351,7 +7736,7 @@ func (c *CatalogCustomAttributeDefinitionNumberConfig) UnmarshalJSON(data []byte return nil } -func (c *CatalogCustomAttributeDefinitionNumberConfig) String() string { +func (c *CardUpdatedEvent) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -6363,32 +7748,29 @@ func (c *CatalogCustomAttributeDefinitionNumberConfig) String() string { return fmt.Sprintf("%#v", c) } -// Configuration associated with `SELECTION`-type custom attribute definitions. -type CatalogCustomAttributeDefinitionSelectionConfig struct { - // The maximum number of selections that can be set. The maximum value for this - // attribute is 100. The default value is 1. The value can be modified, but changing the value will not - // affect existing custom attribute values on objects. Clients need to - // handle custom attributes with more selected values than allowed by this limit. - MaxAllowedSelections *int `json:"max_allowed_selections,omitempty" url:"max_allowed_selections,omitempty"` - // The set of valid `CatalogCustomAttributeSelections`. Up to a maximum of 100 - // selections can be defined. Can be modified. - AllowedSelections []*CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection `json:"allowed_selections,omitempty" url:"allowed_selections,omitempty"` +type CardUpdatedEventData struct { + // The type of the event data object. The value is `"card"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The ID of the event data object. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the updated card. + Object *CardUpdatedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogCustomAttributeDefinitionSelectionConfig) GetExtraProperties() map[string]interface{} { +func (c *CardUpdatedEventData) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogCustomAttributeDefinitionSelectionConfig) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogCustomAttributeDefinitionSelectionConfig +func (c *CardUpdatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler CardUpdatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogCustomAttributeDefinitionSelectionConfig(value) + *c = CardUpdatedEventData(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -6400,7 +7782,7 @@ func (c *CatalogCustomAttributeDefinitionSelectionConfig) UnmarshalJSON(data []b return nil } -func (c *CatalogCustomAttributeDefinitionSelectionConfig) String() string { +func (c *CardUpdatedEventData) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -6412,28 +7794,25 @@ func (c *CatalogCustomAttributeDefinitionSelectionConfig) String() string { return fmt.Sprintf("%#v", c) } -// A named selection for this `SELECTION`-type custom attribute definition. -type CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection struct { - // Unique ID set by Square. - UID *string `json:"uid,omitempty" url:"uid,omitempty"` - // Selection name, unique within `allowed_selections`. - Name string `json:"name" url:"name"` +type CardUpdatedEventObject struct { + // The updated card. + Card *Card `json:"card,omitempty" url:"card,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection) GetExtraProperties() map[string]interface{} { +func (c *CardUpdatedEventObject) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection +func (c *CardUpdatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler CardUpdatedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection(value) + *c = CardUpdatedEventObject(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -6445,7 +7824,7 @@ func (c *CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection return nil } -func (c *CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection) String() string { +func (c *CardUpdatedEventObject) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -6457,55 +7836,76 @@ func (c *CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection return fmt.Sprintf("%#v", c) } -// Defines the visibility of a custom attribute to sellers in Square -// client applications, Square APIs or in Square UIs (including Square Point -// of Sale applications and Square Dashboard). -type CatalogCustomAttributeDefinitionSellerVisibility string +// Additional details about `WALLET` type payments with the `brand` of `CASH_APP`. +type CashAppDetails struct { + // The name of the Cash App account holder. + BuyerFullName *string `json:"buyer_full_name,omitempty" url:"buyer_full_name,omitempty"` + // The country of the Cash App account holder, in ISO 3166-1-alpha-2 format. + // + // For possible values, see [Country](entity:Country). + BuyerCountryCode *string `json:"buyer_country_code,omitempty" url:"buyer_country_code,omitempty"` + // $Cashtag of the Cash App account holder. + BuyerCashtag *string `json:"buyer_cashtag,omitempty" url:"buyer_cashtag,omitempty"` -const ( - CatalogCustomAttributeDefinitionSellerVisibilitySellerVisibilityHidden CatalogCustomAttributeDefinitionSellerVisibility = "SELLER_VISIBILITY_HIDDEN" - CatalogCustomAttributeDefinitionSellerVisibilitySellerVisibilityReadWriteValues CatalogCustomAttributeDefinitionSellerVisibility = "SELLER_VISIBILITY_READ_WRITE_VALUES" -) + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} -func NewCatalogCustomAttributeDefinitionSellerVisibilityFromString(s string) (CatalogCustomAttributeDefinitionSellerVisibility, error) { - switch s { - case "SELLER_VISIBILITY_HIDDEN": - return CatalogCustomAttributeDefinitionSellerVisibilitySellerVisibilityHidden, nil - case "SELLER_VISIBILITY_READ_WRITE_VALUES": - return CatalogCustomAttributeDefinitionSellerVisibilitySellerVisibilityReadWriteValues, nil +func (c *CashAppDetails) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CashAppDetails) UnmarshalJSON(data []byte) error { + type unmarshaler CashAppDetails + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - var t CatalogCustomAttributeDefinitionSellerVisibility - return "", fmt.Errorf("%s is not a valid %T", s, t) + *c = CashAppDetails(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil } -func (c CatalogCustomAttributeDefinitionSellerVisibility) Ptr() *CatalogCustomAttributeDefinitionSellerVisibility { - return &c +func (c *CashAppDetails) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) } -// Configuration associated with Custom Attribute Definitions of type `STRING`. -type CatalogCustomAttributeDefinitionStringConfig struct { - // If true, each Custom Attribute instance associated with this Custom Attribute - // Definition must have a unique value within the seller's catalog. For - // example, this may be used for a value like a SKU that should not be - // duplicated within a seller's catalog. May not be modified after the - // definition has been created. - EnforceUniqueness *bool `json:"enforce_uniqueness,omitempty" url:"enforce_uniqueness,omitempty"` +type CashDrawerDevice struct { + // The device Square-issued ID + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The device merchant-specified name. + Name *string `json:"name,omitempty" url:"name,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogCustomAttributeDefinitionStringConfig) GetExtraProperties() map[string]interface{} { +func (c *CashDrawerDevice) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogCustomAttributeDefinitionStringConfig) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogCustomAttributeDefinitionStringConfig +func (c *CashDrawerDevice) UnmarshalJSON(data []byte) error { + type unmarshaler CashDrawerDevice var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogCustomAttributeDefinitionStringConfig(value) + *c = CashDrawerDevice(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -6517,7 +7917,7 @@ func (c *CatalogCustomAttributeDefinitionStringConfig) UnmarshalJSON(data []byte return nil } -func (c *CatalogCustomAttributeDefinitionStringConfig) String() string { +func (c *CashDrawerDevice) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -6529,75 +7929,145 @@ func (c *CatalogCustomAttributeDefinitionStringConfig) String() string { return fmt.Sprintf("%#v", c) } -// Defines the possible types for a custom attribute. -type CatalogCustomAttributeDefinitionType string +// The types of events on a CashDrawerShift. +// Each event type represents an employee action on the actual cash drawer +// represented by a CashDrawerShift. +type CashDrawerEventType string const ( - CatalogCustomAttributeDefinitionTypeString CatalogCustomAttributeDefinitionType = "STRING" - CatalogCustomAttributeDefinitionTypeBoolean CatalogCustomAttributeDefinitionType = "BOOLEAN" - CatalogCustomAttributeDefinitionTypeNumber CatalogCustomAttributeDefinitionType = "NUMBER" - CatalogCustomAttributeDefinitionTypeSelection CatalogCustomAttributeDefinitionType = "SELECTION" -) - -func NewCatalogCustomAttributeDefinitionTypeFromString(s string) (CatalogCustomAttributeDefinitionType, error) { - switch s { - case "STRING": - return CatalogCustomAttributeDefinitionTypeString, nil - case "BOOLEAN": - return CatalogCustomAttributeDefinitionTypeBoolean, nil - case "NUMBER": - return CatalogCustomAttributeDefinitionTypeNumber, nil - case "SELECTION": - return CatalogCustomAttributeDefinitionTypeSelection, nil + CashDrawerEventTypeNoSale CashDrawerEventType = "NO_SALE" + CashDrawerEventTypeCashTenderPayment CashDrawerEventType = "CASH_TENDER_PAYMENT" + CashDrawerEventTypeOtherTenderPayment CashDrawerEventType = "OTHER_TENDER_PAYMENT" + CashDrawerEventTypeCashTenderCancelledPayment CashDrawerEventType = "CASH_TENDER_CANCELLED_PAYMENT" + CashDrawerEventTypeOtherTenderCancelledPayment CashDrawerEventType = "OTHER_TENDER_CANCELLED_PAYMENT" + CashDrawerEventTypeCashTenderRefund CashDrawerEventType = "CASH_TENDER_REFUND" + CashDrawerEventTypeOtherTenderRefund CashDrawerEventType = "OTHER_TENDER_REFUND" + CashDrawerEventTypePaidIn CashDrawerEventType = "PAID_IN" + CashDrawerEventTypePaidOut CashDrawerEventType = "PAID_OUT" +) + +func NewCashDrawerEventTypeFromString(s string) (CashDrawerEventType, error) { + switch s { + case "NO_SALE": + return CashDrawerEventTypeNoSale, nil + case "CASH_TENDER_PAYMENT": + return CashDrawerEventTypeCashTenderPayment, nil + case "OTHER_TENDER_PAYMENT": + return CashDrawerEventTypeOtherTenderPayment, nil + case "CASH_TENDER_CANCELLED_PAYMENT": + return CashDrawerEventTypeCashTenderCancelledPayment, nil + case "OTHER_TENDER_CANCELLED_PAYMENT": + return CashDrawerEventTypeOtherTenderCancelledPayment, nil + case "CASH_TENDER_REFUND": + return CashDrawerEventTypeCashTenderRefund, nil + case "OTHER_TENDER_REFUND": + return CashDrawerEventTypeOtherTenderRefund, nil + case "PAID_IN": + return CashDrawerEventTypePaidIn, nil + case "PAID_OUT": + return CashDrawerEventTypePaidOut, nil } - var t CatalogCustomAttributeDefinitionType + var t CashDrawerEventType return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (c CatalogCustomAttributeDefinitionType) Ptr() *CatalogCustomAttributeDefinitionType { +func (c CashDrawerEventType) Ptr() *CashDrawerEventType { return &c } -// An instance of a custom attribute. Custom attributes can be defined and -// added to `ITEM` and `ITEM_VARIATION` type catalog objects. -// [Read more about custom attributes](https://developer.squareup.com/docs/catalog-api/add-custom-attributes). -type CatalogCustomAttributeValue struct { - // The name of the custom attribute. - Name *string `json:"name,omitempty" url:"name,omitempty"` - // The string value of the custom attribute. Populated if `type` = `STRING`. - StringValue *string `json:"string_value,omitempty" url:"string_value,omitempty"` - // The id of the [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) this value belongs to. - CustomAttributeDefinitionID *string `json:"custom_attribute_definition_id,omitempty" url:"custom_attribute_definition_id,omitempty"` - // A copy of type from the associated `CatalogCustomAttributeDefinition`. - // See [CatalogCustomAttributeDefinitionType](#type-catalogcustomattributedefinitiontype) for possible values - Type *CatalogCustomAttributeDefinitionType `json:"type,omitempty" url:"type,omitempty"` - // Populated if `type` = `NUMBER`. Contains a string - // representation of a decimal number, using a `.` as the decimal separator. - NumberValue *string `json:"number_value,omitempty" url:"number_value,omitempty"` - // A `true` or `false` value. Populated if `type` = `BOOLEAN`. - BooleanValue *bool `json:"boolean_value,omitempty" url:"boolean_value,omitempty"` - // One or more choices from `allowed_selections`. Populated if `type` = `SELECTION`. - SelectionUIDValues []string `json:"selection_uid_values,omitempty" url:"selection_uid_values,omitempty"` - // If the associated `CatalogCustomAttributeDefinition` object is defined by another application, this key is prefixed by the defining application ID. - // For example, if the CatalogCustomAttributeDefinition has a key attribute of "cocoa_brand" and the defining application ID is "abcd1234", this key is "abcd1234:cocoa_brand" - // when the application making the request is different from the application defining the custom attribute definition. Otherwise, the key is simply "cocoa_brand". - Key *string `json:"key,omitempty" url:"key,omitempty"` +// This model gives the details of a cash drawer shift. +// The cash_payment_money, cash_refund_money, cash_paid_in_money, +// and cash_paid_out_money fields are all computed by summing their respective +// event types. +type CashDrawerShift struct { + // The shift unique ID. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The shift current state. + // See [CashDrawerShiftState](#type-cashdrawershiftstate) for possible values + State *CashDrawerShiftState `json:"state,omitempty" url:"state,omitempty"` + // The time when the shift began, in ISO 8601 format. + OpenedAt *string `json:"opened_at,omitempty" url:"opened_at,omitempty"` + // The time when the shift ended, in ISO 8601 format. + EndedAt *string `json:"ended_at,omitempty" url:"ended_at,omitempty"` + // The time when the shift was closed, in ISO 8601 format. + ClosedAt *string `json:"closed_at,omitempty" url:"closed_at,omitempty"` + // The IDs of all employees that were logged into Square Point of Sale at any + // point while the cash drawer shift was open. + EmployeeIDs []string `json:"employee_ids,omitempty" url:"employee_ids,omitempty"` + // The ID of the employee that started the cash drawer shift. + OpeningEmployeeID *string `json:"opening_employee_id,omitempty" url:"opening_employee_id,omitempty"` + // The ID of the employee that ended the cash drawer shift. + EndingEmployeeID *string `json:"ending_employee_id,omitempty" url:"ending_employee_id,omitempty"` + // The ID of the employee that closed the cash drawer shift by auditing + // the cash drawer contents. + ClosingEmployeeID *string `json:"closing_employee_id,omitempty" url:"closing_employee_id,omitempty"` + // The free-form text description of a cash drawer by an employee. + Description *string `json:"description,omitempty" url:"description,omitempty"` + // The amount of money in the cash drawer at the start of the shift. + // The amount must be greater than or equal to zero. + OpenedCashMoney *Money `json:"opened_cash_money,omitempty" url:"opened_cash_money,omitempty"` + // The amount of money added to the cash drawer from cash payments. + // This is computed by summing all events with the types CASH_TENDER_PAYMENT and + // CASH_TENDER_CANCELED_PAYMENT. The amount is always greater than or equal to + // zero. + CashPaymentMoney *Money `json:"cash_payment_money,omitempty" url:"cash_payment_money,omitempty"` + // The amount of money removed from the cash drawer from cash refunds. + // It is computed by summing the events of type CASH_TENDER_REFUND. The amount + // is always greater than or equal to zero. + CashRefundsMoney *Money `json:"cash_refunds_money,omitempty" url:"cash_refunds_money,omitempty"` + // The amount of money added to the cash drawer for reasons other than cash + // payments. It is computed by summing the events of type PAID_IN. The amount is + // always greater than or equal to zero. + CashPaidInMoney *Money `json:"cash_paid_in_money,omitempty" url:"cash_paid_in_money,omitempty"` + // The amount of money removed from the cash drawer for reasons other than + // cash refunds. It is computed by summing the events of type PAID_OUT. The amount + // is always greater than or equal to zero. + CashPaidOutMoney *Money `json:"cash_paid_out_money,omitempty" url:"cash_paid_out_money,omitempty"` + // The amount of money that should be in the cash drawer at the end of the + // shift, based on the shift's other money amounts. + // This can be negative if employees have not correctly recorded all the events + // on the cash drawer. + // cash_paid_out_money is a summation of amounts from cash_payment_money (zero + // or positive), cash_refunds_money (zero or negative), cash_paid_in_money (zero + // or positive), and cash_paid_out_money (zero or negative) event types. + ExpectedCashMoney *Money `json:"expected_cash_money,omitempty" url:"expected_cash_money,omitempty"` + // The amount of money found in the cash drawer at the end of the shift + // by an auditing employee. The amount should be positive. + ClosedCashMoney *Money `json:"closed_cash_money,omitempty" url:"closed_cash_money,omitempty"` + // The device running Square Point of Sale that was connected to the cash drawer. + Device *CashDrawerDevice `json:"device,omitempty" url:"device,omitempty"` + // The shift start time in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The shift updated at time in RFC 3339 format. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // The ID of the location the cash drawer shift belongs to. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The IDs of all team members that were logged into Square Point of Sale at any + // point while the cash drawer shift was open. + TeamMemberIDs []string `json:"team_member_ids,omitempty" url:"team_member_ids,omitempty"` + // The ID of the team member that started the cash drawer shift. + OpeningTeamMemberID *string `json:"opening_team_member_id,omitempty" url:"opening_team_member_id,omitempty"` + // The ID of the team member that ended the cash drawer shift. + EndingTeamMemberID *string `json:"ending_team_member_id,omitempty" url:"ending_team_member_id,omitempty"` + // The ID of the team member that closed the cash drawer shift by auditing + // the cash drawer contents. + ClosingTeamMemberID *string `json:"closing_team_member_id,omitempty" url:"closing_team_member_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogCustomAttributeValue) GetExtraProperties() map[string]interface{} { +func (c *CashDrawerShift) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogCustomAttributeValue) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogCustomAttributeValue +func (c *CashDrawerShift) UnmarshalJSON(data []byte) error { + type unmarshaler CashDrawerShift var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogCustomAttributeValue(value) + *c = CashDrawerShift(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -6609,7 +8079,7 @@ func (c *CatalogCustomAttributeValue) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogCustomAttributeValue) String() string { +func (c *CashDrawerShift) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -6621,60 +8091,42 @@ func (c *CatalogCustomAttributeValue) String() string { return fmt.Sprintf("%#v", c) } -// A discount applicable to items. -type CatalogDiscount struct { - // The discount name. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points. - Name *string `json:"name,omitempty" url:"name,omitempty"` - // Indicates whether the discount is a fixed amount or percentage, or entered at the time of sale. - // See [CatalogDiscountType](#type-catalogdiscounttype) for possible values - DiscountType *CatalogDiscountType `json:"discount_type,omitempty" url:"discount_type,omitempty"` - // The percentage of the discount as a string representation of a decimal number, using a `.` as the decimal - // separator and without a `%` sign. A value of `7.5` corresponds to `7.5%`. Specify a percentage of `0` if `discount_type` - // is `VARIABLE_PERCENTAGE`. - // - // Do not use this field for amount-based or variable discounts. - Percentage *string `json:"percentage,omitempty" url:"percentage,omitempty"` - // The amount of the discount. Specify an amount of `0` if `discount_type` is `VARIABLE_AMOUNT`. - // - // Do not use this field for percentage-based or variable discounts. - AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` - // Indicates whether a mobile staff member needs to enter their PIN to apply the - // discount to a payment in the Square Point of Sale app. - PinRequired *bool `json:"pin_required,omitempty" url:"pin_required,omitempty"` - // The color of the discount display label in the Square Point of Sale app. This must be a valid hex color code. - LabelColor *string `json:"label_color,omitempty" url:"label_color,omitempty"` - // Indicates whether this discount should reduce the price used to calculate tax. - // - // Most discounts should use `MODIFY_TAX_BASIS`. However, in some circumstances taxes must - // be calculated based on an item's price, ignoring a particular discount. For example, - // in many US jurisdictions, a manufacturer coupon or instant rebate reduces the price a - // customer pays but does not reduce the sale price used to calculate how much sales tax is - // due. In this case, the discount representing that manufacturer coupon should have - // `DO_NOT_MODIFY_TAX_BASIS` for this field. - // - // If you are unsure whether you need to use this field, consult your tax professional. - // See [CatalogDiscountModifyTaxBasis](#type-catalogdiscountmodifytaxbasis) for possible values - ModifyTaxBasis *CatalogDiscountModifyTaxBasis `json:"modify_tax_basis,omitempty" url:"modify_tax_basis,omitempty"` - // For a percentage discount, the maximum absolute value of the discount. For example, if a - // 50% discount has a `maximum_amount_money` of $20, a $100 purchase will yield a $20 discount, - // not a $50 discount. - MaximumAmountMoney *Money `json:"maximum_amount_money,omitempty" url:"maximum_amount_money,omitempty"` +type CashDrawerShiftEvent struct { + // The unique ID of the event. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The ID of the employee that created the event. + EmployeeID *string `json:"employee_id,omitempty" url:"employee_id,omitempty"` + // The type of cash drawer shift event. + // See [CashDrawerEventType](#type-cashdrawereventtype) for possible values + EventType *CashDrawerEventType `json:"event_type,omitempty" url:"event_type,omitempty"` + // The amount of money that was added to or removed from the cash drawer + // in the event. The amount can be positive (for added money) + // or zero (for other tender type payments). The addition or removal of money can be determined by + // by the event type. + EventMoney *Money `json:"event_money,omitempty" url:"event_money,omitempty"` + // The event time in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // An optional description of the event, entered by the employee that + // created the event. + Description *string `json:"description,omitempty" url:"description,omitempty"` + // The ID of the team member that created the event. + TeamMemberID *string `json:"team_member_id,omitempty" url:"team_member_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogDiscount) GetExtraProperties() map[string]interface{} { +func (c *CashDrawerShiftEvent) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogDiscount) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogDiscount +func (c *CashDrawerShiftEvent) UnmarshalJSON(data []byte) error { + type unmarshaler CashDrawerShiftEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogDiscount(value) + *c = CashDrawerShiftEvent(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -6686,7 +8138,7 @@ func (c *CatalogDiscount) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogDiscount) String() string { +func (c *CashDrawerShiftEvent) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -6698,81 +8150,84 @@ func (c *CatalogDiscount) String() string { return fmt.Sprintf("%#v", c) } -type CatalogDiscountModifyTaxBasis string - -const ( - CatalogDiscountModifyTaxBasisModifyTaxBasis CatalogDiscountModifyTaxBasis = "MODIFY_TAX_BASIS" - CatalogDiscountModifyTaxBasisDoNotModifyTaxBasis CatalogDiscountModifyTaxBasis = "DO_NOT_MODIFY_TAX_BASIS" -) - -func NewCatalogDiscountModifyTaxBasisFromString(s string) (CatalogDiscountModifyTaxBasis, error) { - switch s { - case "MODIFY_TAX_BASIS": - return CatalogDiscountModifyTaxBasisModifyTaxBasis, nil - case "DO_NOT_MODIFY_TAX_BASIS": - return CatalogDiscountModifyTaxBasisDoNotModifyTaxBasis, nil - } - var t CatalogDiscountModifyTaxBasis - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (c CatalogDiscountModifyTaxBasis) Ptr() *CatalogDiscountModifyTaxBasis { - return &c -} - -// How to apply a CatalogDiscount to a CatalogItem. -type CatalogDiscountType string +// The current state of a cash drawer shift. +type CashDrawerShiftState string const ( - CatalogDiscountTypeFixedPercentage CatalogDiscountType = "FIXED_PERCENTAGE" - CatalogDiscountTypeFixedAmount CatalogDiscountType = "FIXED_AMOUNT" - CatalogDiscountTypeVariablePercentage CatalogDiscountType = "VARIABLE_PERCENTAGE" - CatalogDiscountTypeVariableAmount CatalogDiscountType = "VARIABLE_AMOUNT" + CashDrawerShiftStateOpen CashDrawerShiftState = "OPEN" + CashDrawerShiftStateEnded CashDrawerShiftState = "ENDED" + CashDrawerShiftStateClosed CashDrawerShiftState = "CLOSED" ) -func NewCatalogDiscountTypeFromString(s string) (CatalogDiscountType, error) { +func NewCashDrawerShiftStateFromString(s string) (CashDrawerShiftState, error) { switch s { - case "FIXED_PERCENTAGE": - return CatalogDiscountTypeFixedPercentage, nil - case "FIXED_AMOUNT": - return CatalogDiscountTypeFixedAmount, nil - case "VARIABLE_PERCENTAGE": - return CatalogDiscountTypeVariablePercentage, nil - case "VARIABLE_AMOUNT": - return CatalogDiscountTypeVariableAmount, nil + case "OPEN": + return CashDrawerShiftStateOpen, nil + case "ENDED": + return CashDrawerShiftStateEnded, nil + case "CLOSED": + return CashDrawerShiftStateClosed, nil } - var t CatalogDiscountType + var t CashDrawerShiftState return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (c CatalogDiscountType) Ptr() *CatalogDiscountType { +func (c CashDrawerShiftState) Ptr() *CashDrawerShiftState { return &c } -// SEO data for for a seller's Square Online store. -type CatalogEcomSeoData struct { - // The SEO title used for the Square Online store. - PageTitle *string `json:"page_title,omitempty" url:"page_title,omitempty"` - // The SEO description used for the Square Online store. - PageDescription *string `json:"page_description,omitempty" url:"page_description,omitempty"` - // The SEO permalink used for the Square Online store. - Permalink *string `json:"permalink,omitempty" url:"permalink,omitempty"` +// The summary of a closed cash drawer shift. +// This model contains only the money counted to start a cash drawer shift, counted +// at the end of the shift, and the amount that should be in the drawer at shift +// end based on summing all cash drawer shift events. +type CashDrawerShiftSummary struct { + // The shift unique ID. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The shift current state. + // See [CashDrawerShiftState](#type-cashdrawershiftstate) for possible values + State *CashDrawerShiftState `json:"state,omitempty" url:"state,omitempty"` + // The shift start time in ISO 8601 format. + OpenedAt *string `json:"opened_at,omitempty" url:"opened_at,omitempty"` + // The shift end time in ISO 8601 format. + EndedAt *string `json:"ended_at,omitempty" url:"ended_at,omitempty"` + // The shift close time in ISO 8601 format. + ClosedAt *string `json:"closed_at,omitempty" url:"closed_at,omitempty"` + // An employee free-text description of a cash drawer shift. + Description *string `json:"description,omitempty" url:"description,omitempty"` + // The amount of money in the cash drawer at the start of the shift. This + // must be a positive amount. + OpenedCashMoney *Money `json:"opened_cash_money,omitempty" url:"opened_cash_money,omitempty"` + // The amount of money that should be in the cash drawer at the end of the + // shift, based on the cash drawer events on the shift. + // The amount is correct if all shift employees accurately recorded their + // cash drawer shift events. Unrecorded events and events with the wrong amount + // result in an incorrect expected_cash_money amount that can be negative. + ExpectedCashMoney *Money `json:"expected_cash_money,omitempty" url:"expected_cash_money,omitempty"` + // The amount of money found in the cash drawer at the end of the shift by + // an auditing employee. The amount must be greater than or equal to zero. + ClosedCashMoney *Money `json:"closed_cash_money,omitempty" url:"closed_cash_money,omitempty"` + // The shift start time in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The shift updated at time in RFC 3339 format. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // The ID of the location the cash drawer shift belongs to. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogEcomSeoData) GetExtraProperties() map[string]interface{} { +func (c *CashDrawerShiftSummary) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogEcomSeoData) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogEcomSeoData +func (c *CashDrawerShiftSummary) UnmarshalJSON(data []byte) error { + type unmarshaler CashDrawerShiftSummary var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogEcomSeoData(value) + *c = CashDrawerShiftSummary(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -6784,7 +8239,7 @@ func (c *CatalogEcomSeoData) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogEcomSeoData) String() string { +func (c *CashDrawerShiftSummary) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -6796,38 +8251,31 @@ func (c *CatalogEcomSeoData) String() string { return fmt.Sprintf("%#v", c) } -// A mapping between a temporary client-supplied ID and a permanent server-generated ID. -// -// When calling [UpsertCatalogObject]($e/Catalog/UpsertCatalogObject) or -// [BatchUpsertCatalogObjects]($e/Catalog/BatchUpsertCatalogObjects) to -// create a [CatalogObject]($m/CatalogObject) instance, you can supply -// a temporary ID for the to-be-created object, especially when the object is to be referenced -// elsewhere in the same request body. This temporary ID can be any string unique within -// the call, but must be prefixed by "#". -// -// After the request is submitted and the object created, a permanent server-generated ID is assigned -// to the new object. The permanent ID is unique across the Square catalog. -type CatalogIDMapping struct { - // The client-supplied temporary `#`-prefixed ID for a new `CatalogObject`. - ClientObjectID *string `json:"client_object_id,omitempty" url:"client_object_id,omitempty"` - // The permanent ID for the CatalogObject created by the server. - ObjectID *string `json:"object_id,omitempty" url:"object_id,omitempty"` +// Stores details about a cash payment. Contains only non-confidential information. For more information, see +// [Take Cash Payments](https://developer.squareup.com/docs/payments-api/take-payments/cash-payments). +type CashPaymentDetails struct { + // The amount and currency of the money supplied by the buyer. + BuyerSuppliedMoney *Money `json:"buyer_supplied_money,omitempty" url:"buyer_supplied_money,omitempty"` + // The amount of change due back to the buyer. + // This read-only field is calculated + // from the `amount_money` and `buyer_supplied_money` fields. + ChangeBackMoney *Money `json:"change_back_money,omitempty" url:"change_back_money,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogIDMapping) GetExtraProperties() map[string]interface{} { +func (c *CashPaymentDetails) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogIDMapping) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogIDMapping +func (c *CashPaymentDetails) UnmarshalJSON(data []byte) error { + type unmarshaler CashPaymentDetails var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogIDMapping(value) + *c = CashPaymentDetails(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -6839,7 +8287,7 @@ func (c *CatalogIDMapping) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogIDMapping) String() string { +func (c *CashPaymentDetails) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -6851,44 +8299,35 @@ func (c *CatalogIDMapping) String() string { return fmt.Sprintf("%#v", c) } -// An image file to use in Square catalogs. It can be associated with -// `CatalogItem`, `CatalogItemVariation`, `CatalogCategory`, and `CatalogModifierList` objects. -// Only the images on items and item variations are exposed in Dashboard. -// Only the first image on an item is displayed in Square Point of Sale (SPOS). -// Images on items and variations are displayed through Square Online Store. -// Images on other object types are for use by 3rd party application developers. -type CatalogImage struct { - // The internal name to identify this image in calls to the Square API. - // This is a searchable attribute for use in applicable query filters - // using the [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects). - // It is not unique and should not be shown in a buyer facing context. - Name *string `json:"name,omitempty" url:"name,omitempty"` - // The URL of this image, generated by Square after an image is uploaded - // using the [CreateCatalogImage](api-endpoint:Catalog-CreateCatalogImage) endpoint. - // To modify the image, use the UpdateCatalogImage endpoint. Do not change the URL field. - URL *string `json:"url,omitempty" url:"url,omitempty"` - // A caption that describes what is shown in the image. Displayed in the - // Square Online Store. This is a searchable attribute for use in applicable query filters - // using the [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects). - Caption *string `json:"caption,omitempty" url:"caption,omitempty"` - // The immutable order ID for this image object created by the Photo Studio service in Square Online Store. - PhotoStudioOrderID *string `json:"photo_studio_order_id,omitempty" url:"photo_studio_order_id,omitempty"` +// Represents a time period of availability. +type CatalogAvailabilityPeriod struct { + // The start time of an availability period, specified in local time using partial-time + // RFC 3339 format. For example, `8:30:00` for a period starting at 8:30 in the morning. + // Note that the seconds value is always :00, but it is appended for conformance to the RFC. + StartLocalTime *string `json:"start_local_time,omitempty" url:"start_local_time,omitempty"` + // The end time of an availability period, specified in local time using partial-time + // RFC 3339 format. For example, `21:00:00` for a period ending at 9:00 in the evening. + // Note that the seconds value is always :00, but it is appended for conformance to the RFC. + EndLocalTime *string `json:"end_local_time,omitempty" url:"end_local_time,omitempty"` + // The day of the week for this availability period. + // See [DayOfWeek](#type-dayofweek) for possible values + DayOfWeek *DayOfWeek `json:"day_of_week,omitempty" url:"day_of_week,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogImage) GetExtraProperties() map[string]interface{} { +func (c *CatalogAvailabilityPeriod) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogImage) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogImage +func (c *CatalogAvailabilityPeriod) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogAvailabilityPeriod var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogImage(value) + *c = CatalogAvailabilityPeriod(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -6900,7 +8339,7 @@ func (c *CatalogImage) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogImage) String() string { +func (c *CatalogAvailabilityPeriod) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -6912,22 +8351,49 @@ func (c *CatalogImage) String() string { return fmt.Sprintf("%#v", c) } -type CatalogInfoRequest struct { +// A category to which a `CatalogItem` instance belongs. +type CatalogCategory struct { + // The category name. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points. + Name *string `json:"name,omitempty" url:"name,omitempty"` + // The IDs of images associated with this `CatalogCategory` instance. + // Currently these images are not displayed by Square, but are free to be displayed in 3rd party applications. + ImageIDs []string `json:"image_ids,omitempty" url:"image_ids,omitempty"` + // The type of the category. + // See [CatalogCategoryType](#type-catalogcategorytype) for possible values + CategoryType *CatalogCategoryType `json:"category_type,omitempty" url:"category_type,omitempty"` + // The ID of the parent category of this category instance. + ParentCategory *CatalogObjectCategory `json:"parent_category,omitempty" url:"parent_category,omitempty"` + // Indicates whether a category is a top level category, which does not have any parent_category. + IsTopLevel *bool `json:"is_top_level,omitempty" url:"is_top_level,omitempty"` + // A list of IDs representing channels, such as a Square Online site, where the category can be made visible. + Channels []string `json:"channels,omitempty" url:"channels,omitempty"` + // The IDs of the `CatalogAvailabilityPeriod` objects associated with the category. + AvailabilityPeriodIDs []string `json:"availability_period_ids,omitempty" url:"availability_period_ids,omitempty"` + // Indicates whether the category is visible (`true`) or hidden (`false`) on all of the seller's Square Online sites. + OnlineVisibility *bool `json:"online_visibility,omitempty" url:"online_visibility,omitempty"` + // The top-level category in a category hierarchy. + RootCategory *string `json:"root_category,omitempty" url:"root_category,omitempty"` + // The SEO data for a seller's Square Online store. + EcomSeoData *CatalogEcomSeoData `json:"ecom_seo_data,omitempty" url:"ecom_seo_data,omitempty"` + // The path from the category to its root category. The first node of the path is the parent of the category + // and the last is the root category. The path is empty if the category is a root category. + PathToRoot []*CategoryPathToRootNode `json:"path_to_root,omitempty" url:"path_to_root,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogInfoRequest) GetExtraProperties() map[string]interface{} { +func (c *CatalogCategory) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogInfoRequest) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogInfoRequest +func (c *CatalogCategory) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogCategory var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogInfoRequest(value) + *c = CatalogCategory(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -6939,7 +8405,7 @@ func (c *CatalogInfoRequest) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogInfoRequest) String() string { +func (c *CatalogCategory) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -6951,102 +8417,99 @@ func (c *CatalogInfoRequest) String() string { return fmt.Sprintf("%#v", c) } -type CatalogInfoResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // Limits that apply to this API. - Limits *CatalogInfoResponseLimits `json:"limits,omitempty" url:"limits,omitempty"` - // Names and abbreviations for standard units. - StandardUnitDescriptionGroup *StandardUnitDescriptionGroup `json:"standard_unit_description_group,omitempty" url:"standard_unit_description_group,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (c *CatalogInfoResponse) GetExtraProperties() map[string]interface{} { - return c.extraProperties -} +// Indicates the type of a category. +type CatalogCategoryType string -func (c *CatalogInfoResponse) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogInfoResponse - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *c = CatalogInfoResponse(value) +const ( + CatalogCategoryTypeCatalogCategoryTypeDoNotUse CatalogCategoryType = "CATALOG_CATEGORY_TYPE_DO_NOT_USE" + CatalogCategoryTypeRegularCategory CatalogCategoryType = "REGULAR_CATEGORY" + CatalogCategoryTypeMenuCategory CatalogCategoryType = "MENU_CATEGORY" + CatalogCategoryTypeKitchenCategory CatalogCategoryType = "KITCHEN_CATEGORY" +) - extraProperties, err := core.ExtractExtraProperties(data, *c) - if err != nil { - return err +func NewCatalogCategoryTypeFromString(s string) (CatalogCategoryType, error) { + switch s { + case "CATALOG_CATEGORY_TYPE_DO_NOT_USE": + return CatalogCategoryTypeCatalogCategoryTypeDoNotUse, nil + case "REGULAR_CATEGORY": + return CatalogCategoryTypeRegularCategory, nil + case "MENU_CATEGORY": + return CatalogCategoryTypeMenuCategory, nil + case "KITCHEN_CATEGORY": + return CatalogCategoryTypeKitchenCategory, nil } - c.extraProperties = extraProperties - - c._rawJSON = json.RawMessage(data) - return nil + var t CatalogCategoryType + return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (c *CatalogInfoResponse) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(c); err == nil { - return value - } - return fmt.Sprintf("%#v", c) +func (c CatalogCategoryType) Ptr() *CatalogCategoryType { + return &c } -type CatalogInfoResponseLimits struct { - // The maximum number of objects that may appear within a single batch in a - // `/v2/catalog/batch-upsert` request. - BatchUpsertMaxObjectsPerBatch *int `json:"batch_upsert_max_objects_per_batch,omitempty" url:"batch_upsert_max_objects_per_batch,omitempty"` - // The maximum number of objects that may appear across all batches in a - // `/v2/catalog/batch-upsert` request. - BatchUpsertMaxTotalObjects *int `json:"batch_upsert_max_total_objects,omitempty" url:"batch_upsert_max_total_objects,omitempty"` - // The maximum number of object IDs that may appear in a `/v2/catalog/batch-retrieve` - // request. - BatchRetrieveMaxObjectIDs *int `json:"batch_retrieve_max_object_ids,omitempty" url:"batch_retrieve_max_object_ids,omitempty"` - // The maximum number of results that may be returned in a page of a - // `/v2/catalog/search` response. - SearchMaxPageLimit *int `json:"search_max_page_limit,omitempty" url:"search_max_page_limit,omitempty"` - // The maximum number of object IDs that may be included in a single - // `/v2/catalog/batch-delete` request. - BatchDeleteMaxObjectIDs *int `json:"batch_delete_max_object_ids,omitempty" url:"batch_delete_max_object_ids,omitempty"` - // The maximum number of item IDs that may be included in a single - // `/v2/catalog/update-item-taxes` request. - UpdateItemTaxesMaxItemIDs *int `json:"update_item_taxes_max_item_ids,omitempty" url:"update_item_taxes_max_item_ids,omitempty"` - // The maximum number of tax IDs to be enabled that may be included in a single - // `/v2/catalog/update-item-taxes` request. - UpdateItemTaxesMaxTaxesToEnable *int `json:"update_item_taxes_max_taxes_to_enable,omitempty" url:"update_item_taxes_max_taxes_to_enable,omitempty"` - // The maximum number of tax IDs to be disabled that may be included in a single - // `/v2/catalog/update-item-taxes` request. - UpdateItemTaxesMaxTaxesToDisable *int `json:"update_item_taxes_max_taxes_to_disable,omitempty" url:"update_item_taxes_max_taxes_to_disable,omitempty"` - // The maximum number of item IDs that may be included in a single - // `/v2/catalog/update-item-modifier-lists` request. - UpdateItemModifierListsMaxItemIDs *int `json:"update_item_modifier_lists_max_item_ids,omitempty" url:"update_item_modifier_lists_max_item_ids,omitempty"` - // The maximum number of modifier list IDs to be enabled that may be included in - // a single `/v2/catalog/update-item-modifier-lists` request. - UpdateItemModifierListsMaxModifierListsToEnable *int `json:"update_item_modifier_lists_max_modifier_lists_to_enable,omitempty" url:"update_item_modifier_lists_max_modifier_lists_to_enable,omitempty"` - // The maximum number of modifier list IDs to be disabled that may be included in - // a single `/v2/catalog/update-item-modifier-lists` request. - UpdateItemModifierListsMaxModifierListsToDisable *int `json:"update_item_modifier_lists_max_modifier_lists_to_disable,omitempty" url:"update_item_modifier_lists_max_modifier_lists_to_disable,omitempty"` +// Contains information defining a custom attribute. Custom attributes are +// intended to store additional information about a catalog object or to associate a +// catalog object with an entity in another system. Do not use custom attributes +// to store any sensitive information (personally identifiable information, card details, etc.). +// [Read more about custom attributes](https://developer.squareup.com/docs/catalog-api/add-custom-attributes) +type CatalogCustomAttributeDefinition struct { + // The type of this custom attribute. Cannot be modified after creation. + // Required. + // See [CatalogCustomAttributeDefinitionType](#type-catalogcustomattributedefinitiontype) for possible values + Type CatalogCustomAttributeDefinitionType `json:"type" url:"type"` + // The name of this definition for API and seller-facing UI purposes. + // The name must be unique within the (merchant, application) pair. Required. + // May not be empty and may not exceed 255 characters. Can be modified after creation. + Name string `json:"name" url:"name"` + // Seller-oriented description of the meaning of this Custom Attribute, + // any constraints that the seller should observe, etc. May be displayed as a tooltip in Square UIs. + Description *string `json:"description,omitempty" url:"description,omitempty"` + // **Read only.** Contains information about the application that + // created this custom attribute definition. + SourceApplication *SourceApplication `json:"source_application,omitempty" url:"source_application,omitempty"` + // The set of `CatalogObject` types that this custom atttribute may be applied to. + // Currently, only `ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, and `CATEGORY` are allowed. At least one type must be included. + // See [CatalogObjectType](#type-catalogobjecttype) for possible values + AllowedObjectTypes []CatalogObjectType `json:"allowed_object_types,omitempty" url:"allowed_object_types,omitempty"` + // The visibility of a custom attribute in seller-facing UIs (including Square Point + // of Sale applications and Square Dashboard). May be modified. + // See [CatalogCustomAttributeDefinitionSellerVisibility](#type-catalogcustomattributedefinitionsellervisibility) for possible values + SellerVisibility *CatalogCustomAttributeDefinitionSellerVisibility `json:"seller_visibility,omitempty" url:"seller_visibility,omitempty"` + // The visibility of a custom attribute to applications other than the application + // that created the attribute. + // See [CatalogCustomAttributeDefinitionAppVisibility](#type-catalogcustomattributedefinitionappvisibility) for possible values + AppVisibility *CatalogCustomAttributeDefinitionAppVisibility `json:"app_visibility,omitempty" url:"app_visibility,omitempty"` + // Optionally, populated when `type` = `STRING`, unset otherwise. + StringConfig *CatalogCustomAttributeDefinitionStringConfig `json:"string_config,omitempty" url:"string_config,omitempty"` + // Optionally, populated when `type` = `NUMBER`, unset otherwise. + NumberConfig *CatalogCustomAttributeDefinitionNumberConfig `json:"number_config,omitempty" url:"number_config,omitempty"` + // Populated when `type` is set to `SELECTION`, unset otherwise. + SelectionConfig *CatalogCustomAttributeDefinitionSelectionConfig `json:"selection_config,omitempty" url:"selection_config,omitempty"` + // The number of custom attributes that reference this + // custom attribute definition. Set by the server in response to a ListCatalog + // request with `include_counts` set to `true`. If the actual count is greater + // than 100, `custom_attribute_usage_count` will be set to `100`. + CustomAttributeUsageCount *int `json:"custom_attribute_usage_count,omitempty" url:"custom_attribute_usage_count,omitempty"` + // The name of the desired custom attribute key that can be used to access + // the custom attribute value on catalog objects. Cannot be modified after the + // custom attribute definition has been created. + // Must be between 1 and 60 characters, and may only contain the characters `[a-zA-Z0-9_-]`. + Key *string `json:"key,omitempty" url:"key,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogInfoResponseLimits) GetExtraProperties() map[string]interface{} { +func (c *CatalogCustomAttributeDefinition) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogInfoResponseLimits) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogInfoResponseLimits +func (c *CatalogCustomAttributeDefinition) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogCustomAttributeDefinition var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogInfoResponseLimits(value) + *c = CatalogCustomAttributeDefinition(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -7058,7 +8521,7 @@ func (c *CatalogInfoResponseLimits) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogInfoResponseLimits) String() string { +func (c *CatalogCustomAttributeDefinition) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -7070,130 +8533,63 @@ func (c *CatalogInfoResponseLimits) String() string { return fmt.Sprintf("%#v", c) } -// A [CatalogObject]($m/CatalogObject) instance of the `ITEM` type, also referred to as an item, in the catalog. -type CatalogItem struct { - // The item's name. This is a searchable attribute for use in applicable query filters, its value must not be empty, and the length is of Unicode code points. - Name *string `json:"name,omitempty" url:"name,omitempty"` - // The item's description. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points. - // - // Deprecated at 2022-07-20, this field is planned to retire in 6 months. You should migrate to use `description_html` to set the description - // of the [CatalogItem](entity:CatalogItem) instance. The `description` and `description_html` field values are kept in sync. If you try to - // set the both fields, the `description_html` text value overwrites the `description` value. Updates in one field are also reflected in the other, - // except for when you use an early version before Square API 2022-07-20 and `description_html` is set to blank, setting the `description` value to null - // does not nullify `description_html`. - Description *string `json:"description,omitempty" url:"description,omitempty"` - // The text of the item's display label in the Square Point of Sale app. Only up to the first five characters of the string are used. - // This attribute is searchable, and its value length is of Unicode code points. - Abbreviation *string `json:"abbreviation,omitempty" url:"abbreviation,omitempty"` - // The color of the item's display label in the Square Point of Sale app. This must be a valid hex color code. - LabelColor *string `json:"label_color,omitempty" url:"label_color,omitempty"` - // Indicates whether the item is taxable (`true`) or non-taxable (`false`). Default is `true`. - IsTaxable *bool `json:"is_taxable,omitempty" url:"is_taxable,omitempty"` - // If `true`, the item can be added to shipping orders from the merchant's online store. - AvailableOnline *bool `json:"available_online,omitempty" url:"available_online,omitempty"` - // If `true`, the item can be added to pickup orders from the merchant's online store. - AvailableForPickup *bool `json:"available_for_pickup,omitempty" url:"available_for_pickup,omitempty"` - // If `true`, the item can be added to electronically fulfilled orders from the merchant's online store. - AvailableElectronically *bool `json:"available_electronically,omitempty" url:"available_electronically,omitempty"` - // The ID of the item's category, if any. Deprecated since 2023-12-13. Use `CatalogItem.categories`, instead. - CategoryID *string `json:"category_id,omitempty" url:"category_id,omitempty"` - // A set of IDs indicating the taxes enabled for - // this item. When updating an item, any taxes listed here will be added to the item. - // Taxes may also be added to or deleted from an item using `UpdateItemTaxes`. - TaxIDs []string `json:"tax_ids,omitempty" url:"tax_ids,omitempty"` - // A set of `CatalogItemModifierListInfo` objects - // representing the modifier lists that apply to this item, along with the overrides and min - // and max limits that are specific to this item. Modifier lists - // may also be added to or deleted from an item using `UpdateItemModifierLists`. - ModifierListInfo []*CatalogItemModifierListInfo `json:"modifier_list_info,omitempty" url:"modifier_list_info,omitempty"` - // A list of [CatalogItemVariation](entity:CatalogItemVariation) objects for this item. An item must have - // at least one variation. - Variations []*CatalogObject `json:"variations,omitempty" url:"variations,omitempty"` - // The product type of the item. Once set, the `product_type` value cannot be modified. - // - // Items of the `LEGACY_SQUARE_ONLINE_SERVICE` and `LEGACY_SQUARE_ONLINE_MEMBERSHIP` product types can be updated - // but cannot be created using the API. - // See [CatalogItemProductType](#type-catalogitemproducttype) for possible values - ProductType *CatalogItemProductType `json:"product_type,omitempty" url:"product_type,omitempty"` - // If `false`, the Square Point of Sale app will present the `CatalogItem`'s - // details screen immediately, allowing the merchant to choose `CatalogModifier`s - // before adding the item to the cart. This is the default behavior. - // - // If `true`, the Square Point of Sale app will immediately add the item to the cart with the pre-selected - // modifiers, and merchants can edit modifiers by drilling down onto the item's details. - // - // Third-party clients are encouraged to implement similar behaviors. - SkipModifierScreen *bool `json:"skip_modifier_screen,omitempty" url:"skip_modifier_screen,omitempty"` - // List of item options IDs for this item. Used to manage and group item - // variations in a specified order. - // - // Maximum: 6 item options. - ItemOptions []*CatalogItemOptionForItem `json:"item_options,omitempty" url:"item_options,omitempty"` - // The IDs of images associated with this `CatalogItem` instance. - // These images will be shown to customers in Square Online Store. - // The first image will show up as the icon for this item in POS. - ImageIDs []string `json:"image_ids,omitempty" url:"image_ids,omitempty"` - // A name to sort the item by. If this name is unspecified, namely, the `sort_name` field is absent, the regular `name` field is used for sorting. - // Its value must not be empty. - // - // It is currently supported for sellers of the Japanese locale only. - SortName *string `json:"sort_name,omitempty" url:"sort_name,omitempty"` - // The list of categories. - Categories []*CatalogObjectCategory `json:"categories,omitempty" url:"categories,omitempty"` - // The item's description as expressed in valid HTML elements. The length of this field value, including those of HTML tags, - // is of Unicode points. With application query filters, the text values of the HTML elements and attributes are searchable. Invalid or - // unsupported HTML elements or attributes are ignored. - // - // Supported HTML elements include: - // - // - `a`: Link. Supports linking to website URLs, email address, and telephone numbers. - // - `b`, `strong`: Bold text - // - `br`: Line break - // - `code`: Computer code - // - `div`: Section - // - `h1-h6`: Headings - // - `i`, `em`: Italics - // - `li`: List element - // - `ol`: Numbered list - // - `p`: Paragraph - // - `ul`: Bullet list - // - `u`: Underline +// Defines the visibility of a custom attribute to applications other than their +// creating application. +type CatalogCustomAttributeDefinitionAppVisibility string + +const ( + CatalogCustomAttributeDefinitionAppVisibilityAppVisibilityDoNotUse CatalogCustomAttributeDefinitionAppVisibility = "APP_VISIBILITY_DO_NOT_USE" + CatalogCustomAttributeDefinitionAppVisibilityAppVisibilityHidden CatalogCustomAttributeDefinitionAppVisibility = "APP_VISIBILITY_HIDDEN" + CatalogCustomAttributeDefinitionAppVisibilityAppVisibilityReadOnly CatalogCustomAttributeDefinitionAppVisibility = "APP_VISIBILITY_READ_ONLY" + CatalogCustomAttributeDefinitionAppVisibilityAppVisibilityReadWriteValues CatalogCustomAttributeDefinitionAppVisibility = "APP_VISIBILITY_READ_WRITE_VALUES" +) + +func NewCatalogCustomAttributeDefinitionAppVisibilityFromString(s string) (CatalogCustomAttributeDefinitionAppVisibility, error) { + switch s { + case "APP_VISIBILITY_DO_NOT_USE": + return CatalogCustomAttributeDefinitionAppVisibilityAppVisibilityDoNotUse, nil + case "APP_VISIBILITY_HIDDEN": + return CatalogCustomAttributeDefinitionAppVisibilityAppVisibilityHidden, nil + case "APP_VISIBILITY_READ_ONLY": + return CatalogCustomAttributeDefinitionAppVisibilityAppVisibilityReadOnly, nil + case "APP_VISIBILITY_READ_WRITE_VALUES": + return CatalogCustomAttributeDefinitionAppVisibilityAppVisibilityReadWriteValues, nil + } + var t CatalogCustomAttributeDefinitionAppVisibility + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c CatalogCustomAttributeDefinitionAppVisibility) Ptr() *CatalogCustomAttributeDefinitionAppVisibility { + return &c +} + +type CatalogCustomAttributeDefinitionNumberConfig struct { + // An integer between 0 and 5 that represents the maximum number of + // positions allowed after the decimal in number custom attribute values + // For example: // - // Supported HTML attributes include: + // - if the precision is 0, the quantity can be 1, 2, 3, etc. + // - if the precision is 1, the quantity can be 0.1, 0.2, etc. + // - if the precision is 2, the quantity can be 0.01, 0.12, etc. // - // - `align`: Alignment of the text content - // - `href`: Link destination - // - `rel`: Relationship between link's target and source - // - `target`: Place to open the linked document - DescriptionHTML *string `json:"description_html,omitempty" url:"description_html,omitempty"` - // A server-generated plaintext version of the `description_html` field, without formatting tags. - DescriptionPlaintext *string `json:"description_plaintext,omitempty" url:"description_plaintext,omitempty"` - // A list of IDs representing channels, such as a Square Online site, where the item can be made visible or available. - Channels []string `json:"channels,omitempty" url:"channels,omitempty"` - // Indicates whether this item is archived (`true`) or not (`false`). - IsArchived *bool `json:"is_archived,omitempty" url:"is_archived,omitempty"` - // The SEO data for a seller's Square Online store. - EcomSeoData *CatalogEcomSeoData `json:"ecom_seo_data,omitempty" url:"ecom_seo_data,omitempty"` - // The food and beverage-specific details for the `FOOD_AND_BEV` item. - FoodAndBeverageDetails *CatalogItemFoodAndBeverageDetails `json:"food_and_beverage_details,omitempty" url:"food_and_beverage_details,omitempty"` - // The item's reporting category. - ReportingCategory *CatalogObjectCategory `json:"reporting_category,omitempty" url:"reporting_category,omitempty"` + // Default: 5 + Precision *int `json:"precision,omitempty" url:"precision,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogItem) GetExtraProperties() map[string]interface{} { +func (c *CatalogCustomAttributeDefinitionNumberConfig) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogItem) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogItem +func (c *CatalogCustomAttributeDefinitionNumberConfig) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogCustomAttributeDefinitionNumberConfig var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogItem(value) + *c = CatalogCustomAttributeDefinitionNumberConfig(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -7205,7 +8601,7 @@ func (c *CatalogItem) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogItem) String() string { +func (c *CatalogCustomAttributeDefinitionNumberConfig) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -7217,30 +8613,32 @@ func (c *CatalogItem) String() string { return fmt.Sprintf("%#v", c) } -// The food and beverage-specific details of a `FOOD_AND_BEV` item. -type CatalogItemFoodAndBeverageDetails struct { - // The calorie count (in the unit of kcal) for the `FOOD_AND_BEV` type of items. - CalorieCount *int `json:"calorie_count,omitempty" url:"calorie_count,omitempty"` - // The dietary preferences for the `FOOD_AND_BEV` item. - DietaryPreferences []*CatalogItemFoodAndBeverageDetailsDietaryPreference `json:"dietary_preferences,omitempty" url:"dietary_preferences,omitempty"` - // The ingredients for the `FOOD_AND_BEV` type item. - Ingredients []*CatalogItemFoodAndBeverageDetailsIngredient `json:"ingredients,omitempty" url:"ingredients,omitempty"` +// Configuration associated with `SELECTION`-type custom attribute definitions. +type CatalogCustomAttributeDefinitionSelectionConfig struct { + // The maximum number of selections that can be set. The maximum value for this + // attribute is 100. The default value is 1. The value can be modified, but changing the value will not + // affect existing custom attribute values on objects. Clients need to + // handle custom attributes with more selected values than allowed by this limit. + MaxAllowedSelections *int `json:"max_allowed_selections,omitempty" url:"max_allowed_selections,omitempty"` + // The set of valid `CatalogCustomAttributeSelections`. Up to a maximum of 100 + // selections can be defined. Can be modified. + AllowedSelections []*CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection `json:"allowed_selections,omitempty" url:"allowed_selections,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogItemFoodAndBeverageDetails) GetExtraProperties() map[string]interface{} { +func (c *CatalogCustomAttributeDefinitionSelectionConfig) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogItemFoodAndBeverageDetails) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogItemFoodAndBeverageDetails +func (c *CatalogCustomAttributeDefinitionSelectionConfig) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogCustomAttributeDefinitionSelectionConfig var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogItemFoodAndBeverageDetails(value) + *c = CatalogCustomAttributeDefinitionSelectionConfig(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -7252,7 +8650,7 @@ func (c *CatalogItemFoodAndBeverageDetails) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogItemFoodAndBeverageDetails) String() string { +func (c *CatalogCustomAttributeDefinitionSelectionConfig) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -7264,32 +8662,28 @@ func (c *CatalogItemFoodAndBeverageDetails) String() string { return fmt.Sprintf("%#v", c) } -// Dietary preferences that can be assigned to an `FOOD_AND_BEV` item and its ingredients. -type CatalogItemFoodAndBeverageDetailsDietaryPreference struct { - // The dietary preference type. Supported values include `STANDARD` and `CUSTOM` as specified in `FoodAndBeverageDetails.DietaryPreferenceType`. - // See [DietaryPreferenceType](#type-dietarypreferencetype) for possible values - Type *CatalogItemFoodAndBeverageDetailsDietaryPreferenceType `json:"type,omitempty" url:"type,omitempty"` - // The name of the dietary preference from a standard pre-defined list. This should be null if it's a custom dietary preference. - // See [StandardDietaryPreference](#type-standarddietarypreference) for possible values - StandardName *CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference `json:"standard_name,omitempty" url:"standard_name,omitempty"` - // The name of a user-defined custom dietary preference. This should be null if it's a standard dietary preference. - CustomName *string `json:"custom_name,omitempty" url:"custom_name,omitempty"` +// A named selection for this `SELECTION`-type custom attribute definition. +type CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection struct { + // Unique ID set by Square. + UID *string `json:"uid,omitempty" url:"uid,omitempty"` + // Selection name, unique within `allowed_selections`. + Name string `json:"name" url:"name"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogItemFoodAndBeverageDetailsDietaryPreference) GetExtraProperties() map[string]interface{} { +func (c *CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogItemFoodAndBeverageDetailsDietaryPreference) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogItemFoodAndBeverageDetailsDietaryPreference +func (c *CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogItemFoodAndBeverageDetailsDietaryPreference(value) + *c = CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -7301,7 +8695,7 @@ func (c *CatalogItemFoodAndBeverageDetailsDietaryPreference) UnmarshalJSON(data return nil } -func (c *CatalogItemFoodAndBeverageDetailsDietaryPreference) String() string { +func (c *CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -7313,93 +8707,58 @@ func (c *CatalogItemFoodAndBeverageDetailsDietaryPreference) String() string { return fmt.Sprintf("%#v", c) } -// Standard dietary preferences for food and beverage items that are recommended on item creation. -type CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference string - -const ( - CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreferenceDairyFree CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference = "DAIRY_FREE" - CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreferenceGlutenFree CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference = "GLUTEN_FREE" - CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreferenceHalal CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference = "HALAL" - CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreferenceKosher CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference = "KOSHER" - CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreferenceNutFree CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference = "NUT_FREE" - CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreferenceVegan CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference = "VEGAN" - CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreferenceVegetarian CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference = "VEGETARIAN" -) - -func NewCatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreferenceFromString(s string) (CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference, error) { - switch s { - case "DAIRY_FREE": - return CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreferenceDairyFree, nil - case "GLUTEN_FREE": - return CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreferenceGlutenFree, nil - case "HALAL": - return CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreferenceHalal, nil - case "KOSHER": - return CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreferenceKosher, nil - case "NUT_FREE": - return CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreferenceNutFree, nil - case "VEGAN": - return CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreferenceVegan, nil - case "VEGETARIAN": - return CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreferenceVegetarian, nil - } - var t CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (c CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference) Ptr() *CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference { - return &c -} - -// The type of dietary preference for the `FOOD_AND_BEV` type of items and integredients. -type CatalogItemFoodAndBeverageDetailsDietaryPreferenceType string +// Defines the visibility of a custom attribute to sellers in Square +// client applications, Square APIs or in Square UIs (including Square Point +// of Sale applications and Square Dashboard). +type CatalogCustomAttributeDefinitionSellerVisibility string const ( - CatalogItemFoodAndBeverageDetailsDietaryPreferenceTypeStandard CatalogItemFoodAndBeverageDetailsDietaryPreferenceType = "STANDARD" - CatalogItemFoodAndBeverageDetailsDietaryPreferenceTypeCustom CatalogItemFoodAndBeverageDetailsDietaryPreferenceType = "CUSTOM" + CatalogCustomAttributeDefinitionSellerVisibilitySellerVisibilityDoNotUse CatalogCustomAttributeDefinitionSellerVisibility = "SELLER_VISIBILITY_DO_NOT_USE" + CatalogCustomAttributeDefinitionSellerVisibilitySellerVisibilityHidden CatalogCustomAttributeDefinitionSellerVisibility = "SELLER_VISIBILITY_HIDDEN" + CatalogCustomAttributeDefinitionSellerVisibilitySellerVisibilityReadWriteValues CatalogCustomAttributeDefinitionSellerVisibility = "SELLER_VISIBILITY_READ_WRITE_VALUES" ) -func NewCatalogItemFoodAndBeverageDetailsDietaryPreferenceTypeFromString(s string) (CatalogItemFoodAndBeverageDetailsDietaryPreferenceType, error) { +func NewCatalogCustomAttributeDefinitionSellerVisibilityFromString(s string) (CatalogCustomAttributeDefinitionSellerVisibility, error) { switch s { - case "STANDARD": - return CatalogItemFoodAndBeverageDetailsDietaryPreferenceTypeStandard, nil - case "CUSTOM": - return CatalogItemFoodAndBeverageDetailsDietaryPreferenceTypeCustom, nil + case "SELLER_VISIBILITY_DO_NOT_USE": + return CatalogCustomAttributeDefinitionSellerVisibilitySellerVisibilityDoNotUse, nil + case "SELLER_VISIBILITY_HIDDEN": + return CatalogCustomAttributeDefinitionSellerVisibilitySellerVisibilityHidden, nil + case "SELLER_VISIBILITY_READ_WRITE_VALUES": + return CatalogCustomAttributeDefinitionSellerVisibilitySellerVisibilityReadWriteValues, nil } - var t CatalogItemFoodAndBeverageDetailsDietaryPreferenceType + var t CatalogCustomAttributeDefinitionSellerVisibility return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (c CatalogItemFoodAndBeverageDetailsDietaryPreferenceType) Ptr() *CatalogItemFoodAndBeverageDetailsDietaryPreferenceType { +func (c CatalogCustomAttributeDefinitionSellerVisibility) Ptr() *CatalogCustomAttributeDefinitionSellerVisibility { return &c } -// Describes the ingredient used in a `FOOD_AND_BEV` item. -type CatalogItemFoodAndBeverageDetailsIngredient struct { - // The dietary preference type of the ingredient. Supported values include `STANDARD` and `CUSTOM` as specified in `FoodAndBeverageDetails.DietaryPreferenceType`. - // See [DietaryPreferenceType](#type-dietarypreferencetype) for possible values - Type *CatalogItemFoodAndBeverageDetailsDietaryPreferenceType `json:"type,omitempty" url:"type,omitempty"` - // The name of the ingredient from a standard pre-defined list. This should be null if it's a custom dietary preference. - // See [StandardIngredient](#type-standardingredient) for possible values - StandardName *CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient `json:"standard_name,omitempty" url:"standard_name,omitempty"` - // The name of a custom user-defined ingredient. This should be null if it's a standard dietary preference. - CustomName *string `json:"custom_name,omitempty" url:"custom_name,omitempty"` +// Configuration associated with Custom Attribute Definitions of type `STRING`. +type CatalogCustomAttributeDefinitionStringConfig struct { + // If true, each Custom Attribute instance associated with this Custom Attribute + // Definition must have a unique value within the seller's catalog. For + // example, this may be used for a value like a SKU that should not be + // duplicated within a seller's catalog. May not be modified after the + // definition has been created. + EnforceUniqueness *bool `json:"enforce_uniqueness,omitempty" url:"enforce_uniqueness,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogItemFoodAndBeverageDetailsIngredient) GetExtraProperties() map[string]interface{} { +func (c *CatalogCustomAttributeDefinitionStringConfig) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogItemFoodAndBeverageDetailsIngredient) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogItemFoodAndBeverageDetailsIngredient +func (c *CatalogCustomAttributeDefinitionStringConfig) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogCustomAttributeDefinitionStringConfig var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogItemFoodAndBeverageDetailsIngredient(value) + *c = CatalogCustomAttributeDefinitionStringConfig(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -7411,7 +8770,7 @@ func (c *CatalogItemFoodAndBeverageDetailsIngredient) UnmarshalJSON(data []byte) return nil } -func (c *CatalogItemFoodAndBeverageDetailsIngredient) String() string { +func (c *CatalogCustomAttributeDefinitionStringConfig) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -7423,115 +8782,87 @@ func (c *CatalogItemFoodAndBeverageDetailsIngredient) String() string { return fmt.Sprintf("%#v", c) } -// Standard ingredients for food and beverage items that are recommended on item creation. -type CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient string +// Defines the possible types for a custom attribute. +type CatalogCustomAttributeDefinitionType string const ( - CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientCelery CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient = "CELERY" - CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientCrustaceans CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient = "CRUSTACEANS" - CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientEggs CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient = "EGGS" - CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientFish CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient = "FISH" - CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientGluten CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient = "GLUTEN" - CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientLupin CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient = "LUPIN" - CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientMilk CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient = "MILK" - CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientMolluscs CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient = "MOLLUSCS" - CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientMustard CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient = "MUSTARD" - CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientPeanuts CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient = "PEANUTS" - CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientSesame CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient = "SESAME" - CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientSoy CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient = "SOY" - CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientSulphites CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient = "SULPHITES" - CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientTreeNuts CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient = "TREE_NUTS" + CatalogCustomAttributeDefinitionTypeAttributeTypeDoNotUse CatalogCustomAttributeDefinitionType = "ATTRIBUTE_TYPE_DO_NOT_USE" + CatalogCustomAttributeDefinitionTypeString CatalogCustomAttributeDefinitionType = "STRING" + CatalogCustomAttributeDefinitionTypeInteger CatalogCustomAttributeDefinitionType = "INTEGER" + CatalogCustomAttributeDefinitionTypeBoolean CatalogCustomAttributeDefinitionType = "BOOLEAN" + CatalogCustomAttributeDefinitionTypeNumber CatalogCustomAttributeDefinitionType = "NUMBER" + CatalogCustomAttributeDefinitionTypeSelection CatalogCustomAttributeDefinitionType = "SELECTION" + CatalogCustomAttributeDefinitionTypeStringInt CatalogCustomAttributeDefinitionType = "STRING_INT" + CatalogCustomAttributeDefinitionTypeTokenInt CatalogCustomAttributeDefinitionType = "TOKEN_INT" ) -func NewCatalogItemFoodAndBeverageDetailsIngredientStandardIngredientFromString(s string) (CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient, error) { +func NewCatalogCustomAttributeDefinitionTypeFromString(s string) (CatalogCustomAttributeDefinitionType, error) { switch s { - case "CELERY": - return CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientCelery, nil - case "CRUSTACEANS": - return CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientCrustaceans, nil - case "EGGS": - return CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientEggs, nil - case "FISH": - return CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientFish, nil - case "GLUTEN": - return CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientGluten, nil - case "LUPIN": - return CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientLupin, nil - case "MILK": - return CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientMilk, nil - case "MOLLUSCS": - return CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientMolluscs, nil - case "MUSTARD": - return CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientMustard, nil - case "PEANUTS": - return CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientPeanuts, nil - case "SESAME": - return CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientSesame, nil - case "SOY": - return CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientSoy, nil - case "SULPHITES": - return CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientSulphites, nil - case "TREE_NUTS": - return CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientTreeNuts, nil + case "ATTRIBUTE_TYPE_DO_NOT_USE": + return CatalogCustomAttributeDefinitionTypeAttributeTypeDoNotUse, nil + case "STRING": + return CatalogCustomAttributeDefinitionTypeString, nil + case "INTEGER": + return CatalogCustomAttributeDefinitionTypeInteger, nil + case "BOOLEAN": + return CatalogCustomAttributeDefinitionTypeBoolean, nil + case "NUMBER": + return CatalogCustomAttributeDefinitionTypeNumber, nil + case "SELECTION": + return CatalogCustomAttributeDefinitionTypeSelection, nil + case "STRING_INT": + return CatalogCustomAttributeDefinitionTypeStringInt, nil + case "TOKEN_INT": + return CatalogCustomAttributeDefinitionTypeTokenInt, nil } - var t CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient + var t CatalogCustomAttributeDefinitionType return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (c CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient) Ptr() *CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient { +func (c CatalogCustomAttributeDefinitionType) Ptr() *CatalogCustomAttributeDefinitionType { return &c } -// References a text-based modifier or a list of non text-based modifiers applied to a `CatalogItem` instance -// and specifies supported behaviors of the application. -type CatalogItemModifierListInfo struct { - // The ID of the `CatalogModifierList` controlled by this `CatalogModifierListInfo`. - ModifierListID string `json:"modifier_list_id" url:"modifier_list_id"` - // A set of `CatalogModifierOverride` objects that override whether a given `CatalogModifier` is enabled by default. - ModifierOverrides []*CatalogModifierOverride `json:"modifier_overrides,omitempty" url:"modifier_overrides,omitempty"` - // If 0 or larger, the smallest number of `CatalogModifier`s that must be selected from this `CatalogModifierList`. - // The default value is `-1`. - // - // When `CatalogModifierList.selection_type` is `MULTIPLE`, `CatalogModifierListInfo.min_selected_modifiers=-1` - // and `CatalogModifierListInfo.max_selected_modifier=-1` means that from zero to the maximum number of modifiers of - // the `CatalogModifierList` can be selected from the `CatalogModifierList`. - // - // When the `CatalogModifierList.selection_type` is `SINGLE`, `CatalogModifierListInfo.min_selected_modifiers=-1` - // and `CatalogModifierListInfo.max_selected_modifier=-1` means that exactly one modifier must be present in - // and can be selected from the `CatalogModifierList` - MinSelectedModifiers *int `json:"min_selected_modifiers,omitempty" url:"min_selected_modifiers,omitempty"` - // If 0 or larger, the largest number of `CatalogModifier`s that can be selected from this `CatalogModifierList`. - // The default value is `-1`. - // - // When `CatalogModifierList.selection_type` is `MULTIPLE`, `CatalogModifierListInfo.min_selected_modifiers=-1` - // and `CatalogModifierListInfo.max_selected_modifier=-1` means that from zero to the maximum number of modifiers of - // the `CatalogModifierList` can be selected from the `CatalogModifierList`. - // - // When the `CatalogModifierList.selection_type` is `SINGLE`, `CatalogModifierListInfo.min_selected_modifiers=-1` - // and `CatalogModifierListInfo.max_selected_modifier=-1` means that exactly one modifier must be present in - // and can be selected from the `CatalogModifierList` - MaxSelectedModifiers *int `json:"max_selected_modifiers,omitempty" url:"max_selected_modifiers,omitempty"` - // If `true`, enable this `CatalogModifierList`. The default value is `true`. - Enabled *bool `json:"enabled,omitempty" url:"enabled,omitempty"` - // The position of this `CatalogItemModifierListInfo` object within the `modifier_list_info` list applied - // to a `CatalogItem` instance. - Ordinal *int `json:"ordinal,omitempty" url:"ordinal,omitempty"` +// An instance of a custom attribute. Custom attributes can be defined and +// added to `ITEM` and `ITEM_VARIATION` type catalog objects. +// [Read more about custom attributes](https://developer.squareup.com/docs/catalog-api/add-custom-attributes). +type CatalogCustomAttributeValue struct { + // The name of the custom attribute. + Name *string `json:"name,omitempty" url:"name,omitempty"` + // The string value of the custom attribute. Populated if `type` = `STRING`. + StringValue *string `json:"string_value,omitempty" url:"string_value,omitempty"` + // The id of the [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) this value belongs to. + CustomAttributeDefinitionID *string `json:"custom_attribute_definition_id,omitempty" url:"custom_attribute_definition_id,omitempty"` + // A copy of type from the associated `CatalogCustomAttributeDefinition`. + // See [CatalogCustomAttributeDefinitionType](#type-catalogcustomattributedefinitiontype) for possible values + Type *CatalogCustomAttributeDefinitionType `json:"type,omitempty" url:"type,omitempty"` + // Populated if `type` = `NUMBER`. Contains a string + // representation of a decimal number, using a `.` as the decimal separator. + NumberValue *string `json:"number_value,omitempty" url:"number_value,omitempty"` + // A `true` or `false` value. Populated if `type` = `BOOLEAN`. + BooleanValue *bool `json:"boolean_value,omitempty" url:"boolean_value,omitempty"` + // One or more choices from `allowed_selections`. Populated if `type` = `SELECTION`. + SelectionUIDValues []string `json:"selection_uid_values,omitempty" url:"selection_uid_values,omitempty"` + // If the associated `CatalogCustomAttributeDefinition` object is defined by another application, this key is prefixed by the defining application ID. + // For example, if the CatalogCustomAttributeDefinition has a key attribute of "cocoa_brand" and the defining application ID is "abcd1234", this key is "abcd1234:cocoa_brand" + // when the application making the request is different from the application defining the custom attribute definition. Otherwise, the key is simply "cocoa_brand". + Key *string `json:"key,omitempty" url:"key,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogItemModifierListInfo) GetExtraProperties() map[string]interface{} { +func (c *CatalogCustomAttributeValue) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogItemModifierListInfo) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogItemModifierListInfo +func (c *CatalogCustomAttributeValue) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogCustomAttributeValue var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogItemModifierListInfo(value) + *c = CatalogCustomAttributeValue(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -7543,7 +8874,7 @@ func (c *CatalogItemModifierListInfo) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogItemModifierListInfo) String() string { +func (c *CatalogCustomAttributeValue) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -7555,82 +8886,60 @@ func (c *CatalogItemModifierListInfo) String() string { return fmt.Sprintf("%#v", c) } -// A group of variations for a `CatalogItem`. -type CatalogItemOption struct { - // The item option's display name for the seller. Must be unique across - // all item options. This is a searchable attribute for use in applicable query filters. +// A discount applicable to items. +type CatalogDiscount struct { + // The discount name. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points. Name *string `json:"name,omitempty" url:"name,omitempty"` - // The item option's display name for the customer. This is a searchable attribute for use in applicable query filters. - DisplayName *string `json:"display_name,omitempty" url:"display_name,omitempty"` - // The item option's human-readable description. Displayed in the Square - // Point of Sale app for the seller and in the Online Store or on receipts for - // the buyer. This is a searchable attribute for use in applicable query filters. - Description *string `json:"description,omitempty" url:"description,omitempty"` - // If true, display colors for entries in `values` when present. - ShowColors *bool `json:"show_colors,omitempty" url:"show_colors,omitempty"` - // A list of CatalogObjects containing the - // `CatalogItemOptionValue`s for this item. - Values []*CatalogObject `json:"values,omitempty" url:"values,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (c *CatalogItemOption) GetExtraProperties() map[string]interface{} { - return c.extraProperties -} - -func (c *CatalogItemOption) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogItemOption - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *c = CatalogItemOption(value) - - extraProperties, err := core.ExtractExtraProperties(data, *c) - if err != nil { - return err - } - c.extraProperties = extraProperties - - c._rawJSON = json.RawMessage(data) - return nil -} - -func (c *CatalogItemOption) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(c); err == nil { - return value - } - return fmt.Sprintf("%#v", c) -} - -// An option that can be assigned to an item. -// For example, a t-shirt item may offer a color option or a size option. -type CatalogItemOptionForItem struct { - // The unique id of the item option, used to form the dimensions of the item option matrix in a specified order. - ItemOptionID *string `json:"item_option_id,omitempty" url:"item_option_id,omitempty"` + // Indicates whether the discount is a fixed amount or percentage, or entered at the time of sale. + // See [CatalogDiscountType](#type-catalogdiscounttype) for possible values + DiscountType *CatalogDiscountType `json:"discount_type,omitempty" url:"discount_type,omitempty"` + // The percentage of the discount as a string representation of a decimal number, using a `.` as the decimal + // separator and without a `%` sign. A value of `7.5` corresponds to `7.5%`. Specify a percentage of `0` if `discount_type` + // is `VARIABLE_PERCENTAGE`. + // + // Do not use this field for amount-based or variable discounts. + Percentage *string `json:"percentage,omitempty" url:"percentage,omitempty"` + // The amount of the discount. Specify an amount of `0` if `discount_type` is `VARIABLE_AMOUNT`. + // + // Do not use this field for percentage-based or variable discounts. + AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` + // Indicates whether a mobile staff member needs to enter their PIN to apply the + // discount to a payment in the Square Point of Sale app. + PinRequired *bool `json:"pin_required,omitempty" url:"pin_required,omitempty"` + // The color of the discount display label in the Square Point of Sale app. This must be a valid hex color code. + LabelColor *string `json:"label_color,omitempty" url:"label_color,omitempty"` + // Indicates whether this discount should reduce the price used to calculate tax. + // + // Most discounts should use `MODIFY_TAX_BASIS`. However, in some circumstances taxes must + // be calculated based on an item's price, ignoring a particular discount. For example, + // in many US jurisdictions, a manufacturer coupon or instant rebate reduces the price a + // customer pays but does not reduce the sale price used to calculate how much sales tax is + // due. In this case, the discount representing that manufacturer coupon should have + // `DO_NOT_MODIFY_TAX_BASIS` for this field. + // + // If you are unsure whether you need to use this field, consult your tax professional. + // See [CatalogDiscountModifyTaxBasis](#type-catalogdiscountmodifytaxbasis) for possible values + ModifyTaxBasis *CatalogDiscountModifyTaxBasis `json:"modify_tax_basis,omitempty" url:"modify_tax_basis,omitempty"` + // For a percentage discount, the maximum absolute value of the discount. For example, if a + // 50% discount has a `maximum_amount_money` of $20, a $100 purchase will yield a $20 discount, + // not a $50 discount. + MaximumAmountMoney *Money `json:"maximum_amount_money,omitempty" url:"maximum_amount_money,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogItemOptionForItem) GetExtraProperties() map[string]interface{} { +func (c *CatalogDiscount) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogItemOptionForItem) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogItemOptionForItem +func (c *CatalogDiscount) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogDiscount var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogItemOptionForItem(value) + *c = CatalogDiscount(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -7642,7 +8951,7 @@ func (c *CatalogItemOptionForItem) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogItemOptionForItem) String() string { +func (c *CatalogDiscount) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -7654,39 +8963,81 @@ func (c *CatalogItemOptionForItem) String() string { return fmt.Sprintf("%#v", c) } -// An enumerated value that can link a -// `CatalogItemVariation` to an item option as one of -// its item option values. -type CatalogItemOptionValue struct { - // Unique ID of the associated item option. - ItemOptionID *string `json:"item_option_id,omitempty" url:"item_option_id,omitempty"` - // Name of this item option value. This is a searchable attribute for use in applicable query filters. - Name *string `json:"name,omitempty" url:"name,omitempty"` - // A human-readable description for the option value. This is a searchable attribute for use in applicable query filters. - Description *string `json:"description,omitempty" url:"description,omitempty"` - // The HTML-supported hex color for the item option (e.g., "#ff8d4e85"). - // Only displayed if `show_colors` is enabled on the parent `ItemOption`. When - // left unset, `color` defaults to white ("#ffffff") when `show_colors` is - // enabled on the parent `ItemOption`. - Color *string `json:"color,omitempty" url:"color,omitempty"` - // Determines where this option value appears in a list of option values. - Ordinal *int `json:"ordinal,omitempty" url:"ordinal,omitempty"` +type CatalogDiscountModifyTaxBasis string + +const ( + CatalogDiscountModifyTaxBasisModifyTaxBasis CatalogDiscountModifyTaxBasis = "MODIFY_TAX_BASIS" + CatalogDiscountModifyTaxBasisDoNotModifyTaxBasis CatalogDiscountModifyTaxBasis = "DO_NOT_MODIFY_TAX_BASIS" +) + +func NewCatalogDiscountModifyTaxBasisFromString(s string) (CatalogDiscountModifyTaxBasis, error) { + switch s { + case "MODIFY_TAX_BASIS": + return CatalogDiscountModifyTaxBasisModifyTaxBasis, nil + case "DO_NOT_MODIFY_TAX_BASIS": + return CatalogDiscountModifyTaxBasisDoNotModifyTaxBasis, nil + } + var t CatalogDiscountModifyTaxBasis + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c CatalogDiscountModifyTaxBasis) Ptr() *CatalogDiscountModifyTaxBasis { + return &c +} + +// How to apply a CatalogDiscount to a CatalogItem. +type CatalogDiscountType string + +const ( + CatalogDiscountTypeFixedPercentage CatalogDiscountType = "FIXED_PERCENTAGE" + CatalogDiscountTypeFixedAmount CatalogDiscountType = "FIXED_AMOUNT" + CatalogDiscountTypeVariablePercentage CatalogDiscountType = "VARIABLE_PERCENTAGE" + CatalogDiscountTypeVariableAmount CatalogDiscountType = "VARIABLE_AMOUNT" +) + +func NewCatalogDiscountTypeFromString(s string) (CatalogDiscountType, error) { + switch s { + case "FIXED_PERCENTAGE": + return CatalogDiscountTypeFixedPercentage, nil + case "FIXED_AMOUNT": + return CatalogDiscountTypeFixedAmount, nil + case "VARIABLE_PERCENTAGE": + return CatalogDiscountTypeVariablePercentage, nil + case "VARIABLE_AMOUNT": + return CatalogDiscountTypeVariableAmount, nil + } + var t CatalogDiscountType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c CatalogDiscountType) Ptr() *CatalogDiscountType { + return &c +} + +// SEO data for for a seller's Square Online store. +type CatalogEcomSeoData struct { + // The SEO title used for the Square Online store. + PageTitle *string `json:"page_title,omitempty" url:"page_title,omitempty"` + // The SEO description used for the Square Online store. + PageDescription *string `json:"page_description,omitempty" url:"page_description,omitempty"` + // The SEO permalink used for the Square Online store. + Permalink *string `json:"permalink,omitempty" url:"permalink,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogItemOptionValue) GetExtraProperties() map[string]interface{} { +func (c *CatalogEcomSeoData) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogItemOptionValue) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogItemOptionValue +func (c *CatalogEcomSeoData) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogEcomSeoData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogItemOptionValue(value) + *c = CatalogEcomSeoData(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -7698,7 +9049,7 @@ func (c *CatalogItemOptionValue) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogItemOptionValue) String() string { +func (c *CatalogEcomSeoData) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -7710,31 +9061,38 @@ func (c *CatalogItemOptionValue) String() string { return fmt.Sprintf("%#v", c) } -// A `CatalogItemOptionValue` links an item variation to an item option as -// an item option value. For example, a t-shirt item may offer a color option and -// a size option. An item option value would represent each variation of t-shirt: -// For example, "Color:Red, Size:Small" or "Color:Blue, Size:Medium". -type CatalogItemOptionValueForItemVariation struct { - // The unique id of an item option. - ItemOptionID *string `json:"item_option_id,omitempty" url:"item_option_id,omitempty"` - // The unique id of the selected value for the item option. - ItemOptionValueID *string `json:"item_option_value_id,omitempty" url:"item_option_value_id,omitempty"` +// A mapping between a temporary client-supplied ID and a permanent server-generated ID. +// +// When calling [UpsertCatalogObject](api-endpoint:Catalog-UpsertCatalogObject) or +// [BatchUpsertCatalogObjects](api-endpoint:Catalog-BatchUpsertCatalogObjects) to +// create a [CatalogObject](entity:CatalogObject) instance, you can supply +// a temporary ID for the to-be-created object, especially when the object is to be referenced +// elsewhere in the same request body. This temporary ID can be any string unique within +// the call, but must be prefixed by "#". +// +// After the request is submitted and the object created, a permanent server-generated ID is assigned +// to the new object. The permanent ID is unique across the Square catalog. +type CatalogIDMapping struct { + // The client-supplied temporary `#`-prefixed ID for a new `CatalogObject`. + ClientObjectID *string `json:"client_object_id,omitempty" url:"client_object_id,omitempty"` + // The permanent ID for the CatalogObject created by the server. + ObjectID *string `json:"object_id,omitempty" url:"object_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogItemOptionValueForItemVariation) GetExtraProperties() map[string]interface{} { +func (c *CatalogIDMapping) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogItemOptionValueForItemVariation) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogItemOptionValueForItemVariation +func (c *CatalogIDMapping) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogIDMapping var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogItemOptionValueForItemVariation(value) + *c = CatalogIDMapping(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -7746,7 +9104,7 @@ func (c *CatalogItemOptionValueForItemVariation) UnmarshalJSON(data []byte) erro return nil } -func (c *CatalogItemOptionValueForItemVariation) String() string { +func (c *CatalogIDMapping) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -7758,154 +9116,44 @@ func (c *CatalogItemOptionValueForItemVariation) String() string { return fmt.Sprintf("%#v", c) } -// The type of a CatalogItem. Connect V2 only allows the creation of `REGULAR` or `APPOINTMENTS_SERVICE` items. -type CatalogItemProductType string - -const ( - CatalogItemProductTypeRegular CatalogItemProductType = "REGULAR" - CatalogItemProductTypeGiftCard CatalogItemProductType = "GIFT_CARD" - CatalogItemProductTypeAppointmentsService CatalogItemProductType = "APPOINTMENTS_SERVICE" - CatalogItemProductTypeFoodAndBev CatalogItemProductType = "FOOD_AND_BEV" - CatalogItemProductTypeEvent CatalogItemProductType = "EVENT" - CatalogItemProductTypeDigital CatalogItemProductType = "DIGITAL" - CatalogItemProductTypeDonation CatalogItemProductType = "DONATION" - CatalogItemProductTypeLegacySquareOnlineService CatalogItemProductType = "LEGACY_SQUARE_ONLINE_SERVICE" - CatalogItemProductTypeLegacySquareOnlineMembership CatalogItemProductType = "LEGACY_SQUARE_ONLINE_MEMBERSHIP" -) - -func NewCatalogItemProductTypeFromString(s string) (CatalogItemProductType, error) { - switch s { - case "REGULAR": - return CatalogItemProductTypeRegular, nil - case "GIFT_CARD": - return CatalogItemProductTypeGiftCard, nil - case "APPOINTMENTS_SERVICE": - return CatalogItemProductTypeAppointmentsService, nil - case "FOOD_AND_BEV": - return CatalogItemProductTypeFoodAndBev, nil - case "EVENT": - return CatalogItemProductTypeEvent, nil - case "DIGITAL": - return CatalogItemProductTypeDigital, nil - case "DONATION": - return CatalogItemProductTypeDonation, nil - case "LEGACY_SQUARE_ONLINE_SERVICE": - return CatalogItemProductTypeLegacySquareOnlineService, nil - case "LEGACY_SQUARE_ONLINE_MEMBERSHIP": - return CatalogItemProductTypeLegacySquareOnlineMembership, nil - } - var t CatalogItemProductType - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (c CatalogItemProductType) Ptr() *CatalogItemProductType { - return &c -} - -// An item variation, representing a product for sale, in the Catalog object model. Each [item]($m/CatalogItem) must have at least one -// item variation and can have at most 250 item variations. -// -// An item variation can be sellable, stockable, or both if it has a unit of measure for its count for the sold number of the variation, the stocked -// number of the variation, or both. For example, when a variation representing wine is stocked and sold by the bottle, the variation is both -// stockable and sellable. But when a variation of the wine is sold by the glass, the sold units cannot be used as a measure of the stocked units. This by-the-glass -// variation is sellable, but not stockable. To accurately keep track of the wine's inventory count at any time, the sellable count must be -// converted to stockable count. Typically, the seller defines this unit conversion. For example, 1 bottle equals 5 glasses. The Square API exposes -// the `stockable_conversion` property on the variation to specify the conversion. Thus, when two glasses of the wine are sold, the sellable count -// decreases by 2, and the stockable count automatically decreases by 0.4 bottle according to the conversion. -type CatalogItemVariation struct { - // The ID of the `CatalogItem` associated with this item variation. - ItemID *string `json:"item_id,omitempty" url:"item_id,omitempty"` - // The item variation's name. This is a searchable attribute for use in applicable query filters. - // - // Its value has a maximum length of 255 Unicode code points. However, when the parent [item](entity:CatalogItem) - // uses [item options](entity:CatalogItemOption), this attribute is auto-generated, read-only, and can be - // longer than 255 Unicode code points. +// An image file to use in Square catalogs. It can be associated with +// `CatalogItem`, `CatalogItemVariation`, `CatalogCategory`, and `CatalogModifierList` objects. +// Only the images on items and item variations are exposed in Dashboard. +// Only the first image on an item is displayed in Square Point of Sale (SPOS). +// Images on items and variations are displayed through Square Online Store. +// Images on other object types are for use by 3rd party application developers. +type CatalogImage struct { + // The internal name to identify this image in calls to the Square API. + // This is a searchable attribute for use in applicable query filters + // using the [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects). + // It is not unique and should not be shown in a buyer facing context. Name *string `json:"name,omitempty" url:"name,omitempty"` - // The item variation's SKU, if any. This is a searchable attribute for use in applicable query filters. - Sku *string `json:"sku,omitempty" url:"sku,omitempty"` - // The universal product code (UPC) of the item variation, if any. This is a searchable attribute for use in applicable query filters. - // - // The value of this attribute should be a number of 12-14 digits long. This restriction is enforced on the Square Seller Dashboard, - // Square Point of Sale or Retail Point of Sale apps, where this attribute shows in the GTIN field. If a non-compliant UPC value is assigned - // to this attribute using the API, the value is not editable on the Seller Dashboard, Square Point of Sale or Retail Point of Sale apps - // unless it is updated to fit the expected format. - Upc *string `json:"upc,omitempty" url:"upc,omitempty"` - // The order in which this item variation should be displayed. This value is read-only. On writes, the ordinal - // for each item variation within a parent `CatalogItem` is set according to the item variations's - // position. On reads, the value is not guaranteed to be sequential or unique. - Ordinal *int `json:"ordinal,omitempty" url:"ordinal,omitempty"` - // Indicates whether the item variation's price is fixed or determined at the time - // of sale. - // See [CatalogPricingType](#type-catalogpricingtype) for possible values - PricingType *CatalogPricingType `json:"pricing_type,omitempty" url:"pricing_type,omitempty"` - // The item variation's price, if fixed pricing is used. - PriceMoney *Money `json:"price_money,omitempty" url:"price_money,omitempty"` - // Per-location price and inventory overrides. - LocationOverrides []*ItemVariationLocationOverrides `json:"location_overrides,omitempty" url:"location_overrides,omitempty"` - // If `true`, inventory tracking is active for the variation. - TrackInventory *bool `json:"track_inventory,omitempty" url:"track_inventory,omitempty"` - // Indicates whether the item variation displays an alert when its inventory quantity is less than or equal - // to its `inventory_alert_threshold`. - // See [InventoryAlertType](#type-inventoryalerttype) for possible values - InventoryAlertType *InventoryAlertType `json:"inventory_alert_type,omitempty" url:"inventory_alert_type,omitempty"` - // If the inventory quantity for the variation is less than or equal to this value and `inventory_alert_type` - // is `LOW_QUANTITY`, the variation displays an alert in the merchant dashboard. - // - // This value is always an integer. - InventoryAlertThreshold *int64 `json:"inventory_alert_threshold,omitempty" url:"inventory_alert_threshold,omitempty"` - // Arbitrary user metadata to associate with the item variation. This attribute value length is of Unicode code points. - UserData *string `json:"user_data,omitempty" url:"user_data,omitempty"` - // If the `CatalogItem` that owns this item variation is of type - // `APPOINTMENTS_SERVICE`, then this is the duration of the service in milliseconds. For - // example, a 30 minute appointment would have the value `1800000`, which is equal to - // 30 (minutes) _ 60 (seconds per minute) _ 1000 (milliseconds per second). - ServiceDuration *int64 `json:"service_duration,omitempty" url:"service_duration,omitempty"` - // If the `CatalogItem` that owns this item variation is of type - // `APPOINTMENTS_SERVICE`, a bool representing whether this service is available for booking. - AvailableForBooking *bool `json:"available_for_booking,omitempty" url:"available_for_booking,omitempty"` - // List of item option values associated with this item variation. Listed - // in the same order as the item options of the parent item. - ItemOptionValues []*CatalogItemOptionValueForItemVariation `json:"item_option_values,omitempty" url:"item_option_values,omitempty"` - // ID of the ‘CatalogMeasurementUnit’ that is used to measure the quantity - // sold of this item variation. If left unset, the item will be sold in - // whole quantities. - MeasurementUnitID *string `json:"measurement_unit_id,omitempty" url:"measurement_unit_id,omitempty"` - // Whether this variation can be sold. The inventory count of a sellable variation indicates - // the number of units available for sale. When a variation is both stockable and sellable, - // its sellable inventory count can be smaller than or equal to its stockable count. - Sellable *bool `json:"sellable,omitempty" url:"sellable,omitempty"` - // Whether stock is counted directly on this variation (TRUE) or only on its components (FALSE). - // When a variation is both stockable and sellable, the inventory count of a stockable variation keeps track of the number of units of this variation in stock - // and is not an indicator of the number of units of the variation that can be sold. - Stockable *bool `json:"stockable,omitempty" url:"stockable,omitempty"` - // The IDs of images associated with this `CatalogItemVariation` instance. - // These images will be shown to customers in Square Online Store. - ImageIDs []string `json:"image_ids,omitempty" url:"image_ids,omitempty"` - // Tokens of employees that can perform the service represented by this variation. Only valid for - // variations of type `APPOINTMENTS_SERVICE`. - TeamMemberIDs []string `json:"team_member_ids,omitempty" url:"team_member_ids,omitempty"` - // The unit conversion rule, as prescribed by the [CatalogStockConversion]($m/CatalogStockConversion) type, - // that describes how this non-stockable (i.e., sellable/receivable) item variation is converted - // to/from the stockable item variation sharing the same parent item. With the stock conversion, - // you can accurately track inventory when an item variation is sold in one unit, but stocked in - // another unit. - StockableConversion *CatalogStockConversion `json:"stockable_conversion,omitempty" url:"stockable_conversion,omitempty"` + // The URL of this image, generated by Square after an image is uploaded + // using the [CreateCatalogImage](api-endpoint:Catalog-CreateCatalogImage) endpoint. + // To modify the image, use the UpdateCatalogImage endpoint. Do not change the URL field. + URL *string `json:"url,omitempty" url:"url,omitempty"` + // A caption that describes what is shown in the image. Displayed in the + // Square Online Store. This is a searchable attribute for use in applicable query filters + // using the [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects). + Caption *string `json:"caption,omitempty" url:"caption,omitempty"` + // The immutable order ID for this image object created by the Photo Studio service in Square Online Store. + PhotoStudioOrderID *string `json:"photo_studio_order_id,omitempty" url:"photo_studio_order_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogItemVariation) GetExtraProperties() map[string]interface{} { +func (c *CatalogImage) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogItemVariation) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogItemVariation +func (c *CatalogImage) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogImage var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogItemVariation(value) + *c = CatalogImage(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -7917,7 +9165,7 @@ func (c *CatalogItemVariation) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogItemVariation) String() string { +func (c *CatalogImage) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -7929,37 +9177,22 @@ func (c *CatalogItemVariation) String() string { return fmt.Sprintf("%#v", c) } -// Represents the unit used to measure a `CatalogItemVariation` and -// specifies the precision for decimal quantities. -type CatalogMeasurementUnit struct { - // Indicates the unit used to measure the quantity of a catalog item variation. - MeasurementUnit *MeasurementUnit `json:"measurement_unit,omitempty" url:"measurement_unit,omitempty"` - // An integer between 0 and 5 that represents the maximum number of - // positions allowed after the decimal in quantities measured with this unit. - // For example: - // - // - if the precision is 0, the quantity can be 1, 2, 3, etc. - // - if the precision is 1, the quantity can be 0.1, 0.2, etc. - // - if the precision is 2, the quantity can be 0.01, 0.12, etc. - // - // Default: 3 - Precision *int `json:"precision,omitempty" url:"precision,omitempty"` - +type CatalogInfoRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogMeasurementUnit) GetExtraProperties() map[string]interface{} { +func (c *CatalogInfoRequest) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogMeasurementUnit) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogMeasurementUnit +func (c *CatalogInfoRequest) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogInfoRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogMeasurementUnit(value) + *c = CatalogInfoRequest(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -7971,7 +9204,7 @@ func (c *CatalogMeasurementUnit) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogMeasurementUnit) String() string { +func (c *CatalogInfoRequest) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -7983,37 +9216,29 @@ func (c *CatalogMeasurementUnit) String() string { return fmt.Sprintf("%#v", c) } -// A modifier applicable to items at the time of sale. An example of a modifier is a Cheese add-on to a Burger item. -type CatalogModifier struct { - // The modifier name. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points. - Name *string `json:"name,omitempty" url:"name,omitempty"` - // The modifier price. - PriceMoney *Money `json:"price_money,omitempty" url:"price_money,omitempty"` - // Determines where this `CatalogModifier` appears in the `CatalogModifierList`. - Ordinal *int `json:"ordinal,omitempty" url:"ordinal,omitempty"` - // The ID of the `CatalogModifierList` associated with this modifier. - ModifierListID *string `json:"modifier_list_id,omitempty" url:"modifier_list_id,omitempty"` - // Location-specific price overrides. - LocationOverrides []*ModifierLocationOverrides `json:"location_overrides,omitempty" url:"location_overrides,omitempty"` - // The ID of the image associated with this `CatalogModifier` instance. - // Currently this image is not displayed by Square, but is free to be displayed in 3rd party applications. - ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` +type CatalogInfoResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // Limits that apply to this API. + Limits *CatalogInfoResponseLimits `json:"limits,omitempty" url:"limits,omitempty"` + // Names and abbreviations for standard units. + StandardUnitDescriptionGroup *StandardUnitDescriptionGroup `json:"standard_unit_description_group,omitempty" url:"standard_unit_description_group,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogModifier) GetExtraProperties() map[string]interface{} { +func (c *CatalogInfoResponse) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogModifier) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogModifier +func (c *CatalogInfoResponse) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogInfoResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogModifier(value) + *c = CatalogInfoResponse(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -8025,7 +9250,7 @@ func (c *CatalogModifier) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogModifier) String() string { +func (c *CatalogInfoResponse) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -8037,82 +9262,56 @@ func (c *CatalogModifier) String() string { return fmt.Sprintf("%#v", c) } -// For a text-based modifier, this encapsulates the modifier's text when its `modifier_type` is `TEXT`. -// For example, to sell T-shirts with custom prints, a text-based modifier can be used to capture the buyer-supplied -// text string to be selected for the T-shirt at the time of sale. -// -// For non text-based modifiers, this encapsulates a non-empty list of modifiers applicable to items -// at the time of sale. Each element of the modifier list is a `CatalogObject` instance of the `MODIFIER` type. -// For example, a "Condiments" modifier list applicable to a "Hot Dog" item -// may contain "Ketchup", "Mustard", and "Relish" modifiers. -// -// A non text-based modifier can be applied to the modified item once or multiple times, if the `selection_type` field -// is set to `SINGLE` or `MULTIPLE`, respectively. On the other hand, a text-based modifier can be applied to the item -// only once and the `selection_type` field is always set to `SINGLE`. -type CatalogModifierList struct { - // The name of the `CatalogModifierList` instance. This is a searchable attribute for use in applicable query filters, and its value length is of - // Unicode code points. - Name *string `json:"name,omitempty" url:"name,omitempty"` - // The position of this `CatalogModifierList` within a list of `CatalogModifierList` instances. - Ordinal *int `json:"ordinal,omitempty" url:"ordinal,omitempty"` - // Indicates whether a single (`SINGLE`) or multiple (`MULTIPLE`) modifiers from the list - // can be applied to a single `CatalogItem`. - // - // For text-based modifiers, the `selection_type` attribute is always `SINGLE`. The other value is ignored. - // See [CatalogModifierListSelectionType](#type-catalogmodifierlistselectiontype) for possible values - SelectionType *CatalogModifierListSelectionType `json:"selection_type,omitempty" url:"selection_type,omitempty"` - // A non-empty list of `CatalogModifier` objects to be included in the `CatalogModifierList`, - // for non text-based modifiers when the `modifier_type` attribute is `LIST`. Each element of this list - // is a `CatalogObject` instance of the `MODIFIER` type, containing the following attributes: - // - // ``` - // { - // "id": "{{catalog_modifier_id}}", - // "type": "MODIFIER", - // "modifier_data": {{a CatalogModifier instance>}} - // } - // ``` - Modifiers []*CatalogObject `json:"modifiers,omitempty" url:"modifiers,omitempty"` - // The IDs of images associated with this `CatalogModifierList` instance. - // Currently these images are not displayed on Square products, but may be displayed in 3rd-party applications. - ImageIDs []string `json:"image_ids,omitempty" url:"image_ids,omitempty"` - // The type of the modifier. - // - // When this `modifier_type` value is `TEXT`, the `CatalogModifierList` represents a text-based modifier. - // When this `modifier_type` value is `LIST`, the `CatalogModifierList` contains a list of `CatalogModifier` objects. - // See [CatalogModifierListModifierType](#type-catalogmodifierlistmodifiertype) for possible values - ModifierType *CatalogModifierListModifierType `json:"modifier_type,omitempty" url:"modifier_type,omitempty"` - // The maximum length, in Unicode points, of the text string of the text-based modifier as represented by - // this `CatalogModifierList` object with the `modifier_type` set to `TEXT`. - MaxLength *int `json:"max_length,omitempty" url:"max_length,omitempty"` - // Whether the text string must be a non-empty string (`true`) or not (`false`) for a text-based modifier - // as represented by this `CatalogModifierList` object with the `modifier_type` set to `TEXT`. - TextRequired *bool `json:"text_required,omitempty" url:"text_required,omitempty"` - // A note for internal use by the business. - // - // For example, for a text-based modifier applied to a T-shirt item, if the buyer-supplied text of "Hello, Kitty!" - // is to be printed on the T-shirt, this `internal_name` attribute can be "Use italic face" as - // an instruction for the business to follow. - // - // For non text-based modifiers, this `internal_name` attribute can be - // used to include SKUs, internal codes, or supplemental descriptions for internal use. - InternalName *string `json:"internal_name,omitempty" url:"internal_name,omitempty"` +type CatalogInfoResponseLimits struct { + // The maximum number of objects that may appear within a single batch in a + // `/v2/catalog/batch-upsert` request. + BatchUpsertMaxObjectsPerBatch *int `json:"batch_upsert_max_objects_per_batch,omitempty" url:"batch_upsert_max_objects_per_batch,omitempty"` + // The maximum number of objects that may appear across all batches in a + // `/v2/catalog/batch-upsert` request. + BatchUpsertMaxTotalObjects *int `json:"batch_upsert_max_total_objects,omitempty" url:"batch_upsert_max_total_objects,omitempty"` + // The maximum number of object IDs that may appear in a `/v2/catalog/batch-retrieve` + // request. + BatchRetrieveMaxObjectIDs *int `json:"batch_retrieve_max_object_ids,omitempty" url:"batch_retrieve_max_object_ids,omitempty"` + // The maximum number of results that may be returned in a page of a + // `/v2/catalog/search` response. + SearchMaxPageLimit *int `json:"search_max_page_limit,omitempty" url:"search_max_page_limit,omitempty"` + // The maximum number of object IDs that may be included in a single + // `/v2/catalog/batch-delete` request. + BatchDeleteMaxObjectIDs *int `json:"batch_delete_max_object_ids,omitempty" url:"batch_delete_max_object_ids,omitempty"` + // The maximum number of item IDs that may be included in a single + // `/v2/catalog/update-item-taxes` request. + UpdateItemTaxesMaxItemIDs *int `json:"update_item_taxes_max_item_ids,omitempty" url:"update_item_taxes_max_item_ids,omitempty"` + // The maximum number of tax IDs to be enabled that may be included in a single + // `/v2/catalog/update-item-taxes` request. + UpdateItemTaxesMaxTaxesToEnable *int `json:"update_item_taxes_max_taxes_to_enable,omitempty" url:"update_item_taxes_max_taxes_to_enable,omitempty"` + // The maximum number of tax IDs to be disabled that may be included in a single + // `/v2/catalog/update-item-taxes` request. + UpdateItemTaxesMaxTaxesToDisable *int `json:"update_item_taxes_max_taxes_to_disable,omitempty" url:"update_item_taxes_max_taxes_to_disable,omitempty"` + // The maximum number of item IDs that may be included in a single + // `/v2/catalog/update-item-modifier-lists` request. + UpdateItemModifierListsMaxItemIDs *int `json:"update_item_modifier_lists_max_item_ids,omitempty" url:"update_item_modifier_lists_max_item_ids,omitempty"` + // The maximum number of modifier list IDs to be enabled that may be included in + // a single `/v2/catalog/update-item-modifier-lists` request. + UpdateItemModifierListsMaxModifierListsToEnable *int `json:"update_item_modifier_lists_max_modifier_lists_to_enable,omitempty" url:"update_item_modifier_lists_max_modifier_lists_to_enable,omitempty"` + // The maximum number of modifier list IDs to be disabled that may be included in + // a single `/v2/catalog/update-item-modifier-lists` request. + UpdateItemModifierListsMaxModifierListsToDisable *int `json:"update_item_modifier_lists_max_modifier_lists_to_disable,omitempty" url:"update_item_modifier_lists_max_modifier_lists_to_disable,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogModifierList) GetExtraProperties() map[string]interface{} { +func (c *CatalogInfoResponseLimits) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogModifierList) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogModifierList +func (c *CatalogInfoResponseLimits) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogInfoResponseLimits var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogModifierList(value) + *c = CatalogInfoResponseLimits(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -8124,7 +9323,7 @@ func (c *CatalogModifierList) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogModifierList) String() string { +func (c *CatalogInfoResponseLimits) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -8136,74 +9335,345 @@ func (c *CatalogModifierList) String() string { return fmt.Sprintf("%#v", c) } -// Defines the type of `CatalogModifierList`. -type CatalogModifierListModifierType string - -const ( - CatalogModifierListModifierTypeList CatalogModifierListModifierType = "LIST" - CatalogModifierListModifierTypeText CatalogModifierListModifierType = "TEXT" -) - -func NewCatalogModifierListModifierTypeFromString(s string) (CatalogModifierListModifierType, error) { +// A [CatalogObject](entity:CatalogObject) instance of the `ITEM` type, also referred to as an item, in the catalog. +type CatalogItem struct { + // The item's name. This is a searchable attribute for use in applicable query filters, its value must not be empty, and the length is of Unicode code points. + Name *string `json:"name,omitempty" url:"name,omitempty"` + // The item's description. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points. + // + // Deprecated at 2022-07-20, this field is planned to retire in 6 months. You should migrate to use `description_html` to set the description + // of the [CatalogItem](entity:CatalogItem) instance. The `description` and `description_html` field values are kept in sync. If you try to + // set the both fields, the `description_html` text value overwrites the `description` value. Updates in one field are also reflected in the other, + // except for when you use an early version before Square API 2022-07-20 and `description_html` is set to blank, setting the `description` value to null + // does not nullify `description_html`. + Description *string `json:"description,omitempty" url:"description,omitempty"` + // The text of the item's display label in the Square Point of Sale app. Only up to the first five characters of the string are used. + // This attribute is searchable, and its value length is of Unicode code points. + Abbreviation *string `json:"abbreviation,omitempty" url:"abbreviation,omitempty"` + // The color of the item's display label in the Square Point of Sale app. This must be a valid hex color code. + LabelColor *string `json:"label_color,omitempty" url:"label_color,omitempty"` + // Indicates whether the item is taxable (`true`) or non-taxable (`false`). Default is `true`. + IsTaxable *bool `json:"is_taxable,omitempty" url:"is_taxable,omitempty"` + // If `true`, the item can be added to shipping orders from the merchant's online store. + AvailableOnline *bool `json:"available_online,omitempty" url:"available_online,omitempty"` + // If `true`, the item can be added to pickup orders from the merchant's online store. + AvailableForPickup *bool `json:"available_for_pickup,omitempty" url:"available_for_pickup,omitempty"` + // If `true`, the item can be added to electronically fulfilled orders from the merchant's online store. + AvailableElectronically *bool `json:"available_electronically,omitempty" url:"available_electronically,omitempty"` + // The ID of the item's category, if any. Deprecated since 2023-12-13. Use `CatalogItem.categories`, instead. + CategoryID *string `json:"category_id,omitempty" url:"category_id,omitempty"` + // A set of IDs indicating the taxes enabled for + // this item. When updating an item, any taxes listed here will be added to the item. + // Taxes may also be added to or deleted from an item using `UpdateItemTaxes`. + TaxIDs []string `json:"tax_ids,omitempty" url:"tax_ids,omitempty"` + // A set of `CatalogItemModifierListInfo` objects + // representing the modifier lists that apply to this item, along with the overrides and min + // and max limits that are specific to this item. Modifier lists + // may also be added to or deleted from an item using `UpdateItemModifierLists`. + ModifierListInfo []*CatalogItemModifierListInfo `json:"modifier_list_info,omitempty" url:"modifier_list_info,omitempty"` + // **Retired**. The URL of an image representing this item. Retired + // in favor of `image_id` in [CatalogObject](entity:CatalogObject). + ImageURL *string `json:"image_url,omitempty" url:"image_url,omitempty"` + // A list of [CatalogItemVariation](entity:CatalogItemVariation) objects for this item. An item must have + // at least one variation. + Variations []*CatalogObject `json:"variations,omitempty" url:"variations,omitempty"` + // The product type of the item. Once set, the `product_type` value cannot be modified. + // + // Items of the `LEGACY_SQUARE_ONLINE_SERVICE` and `LEGACY_SQUARE_ONLINE_MEMBERSHIP` product types can be updated + // but cannot be created using the API. + // See [CatalogItemProductType](#type-catalogitemproducttype) for possible values + ProductType *CatalogItemProductType `json:"product_type,omitempty" url:"product_type,omitempty"` + // If `false`, the Square Point of Sale app will present the `CatalogItem`'s + // details screen immediately, allowing the merchant to choose `CatalogModifier`s + // before adding the item to the cart. This is the default behavior. + // + // If `true`, the Square Point of Sale app will immediately add the item to the cart with the pre-selected + // modifiers, and merchants can edit modifiers by drilling down onto the item's details. + // + // Third-party clients are encouraged to implement similar behaviors. + SkipModifierScreen *bool `json:"skip_modifier_screen,omitempty" url:"skip_modifier_screen,omitempty"` + // List of item options IDs for this item. Used to manage and group item + // variations in a specified order. + // + // Maximum: 6 item options. + ItemOptions []*CatalogItemOptionForItem `json:"item_options,omitempty" url:"item_options,omitempty"` + // The IDs of images associated with this `CatalogItem` instance. + // These images will be shown to customers in Square Online Store. + // The first image will show up as the icon for this item in POS. + ImageIDs []string `json:"image_ids,omitempty" url:"image_ids,omitempty"` + // A name to sort the item by. If this name is unspecified, namely, the `sort_name` field is absent, the regular `name` field is used for sorting. + // Its value must not be empty. + // + // It is currently supported for sellers of the Japanese locale only. + SortName *string `json:"sort_name,omitempty" url:"sort_name,omitempty"` + // The list of categories. + Categories []*CatalogObjectCategory `json:"categories,omitempty" url:"categories,omitempty"` + // The item's description as expressed in valid HTML elements. The length of this field value, including those of HTML tags, + // is of Unicode points. With application query filters, the text values of the HTML elements and attributes are searchable. Invalid or + // unsupported HTML elements or attributes are ignored. + // + // Supported HTML elements include: + // + // - `a`: Link. Supports linking to website URLs, email address, and telephone numbers. + // - `b`, `strong`: Bold text + // - `br`: Line break + // - `code`: Computer code + // - `div`: Section + // - `h1-h6`: Headings + // - `i`, `em`: Italics + // - `li`: List element + // - `ol`: Numbered list + // - `p`: Paragraph + // - `ul`: Bullet list + // - `u`: Underline + // + // Supported HTML attributes include: + // + // - `align`: Alignment of the text content + // - `href`: Link destination + // - `rel`: Relationship between link's target and source + // - `target`: Place to open the linked document + DescriptionHTML *string `json:"description_html,omitempty" url:"description_html,omitempty"` + // A server-generated plaintext version of the `description_html` field, without formatting tags. + DescriptionPlaintext *string `json:"description_plaintext,omitempty" url:"description_plaintext,omitempty"` + // A list of IDs representing channels, such as a Square Online site, where the item can be made visible or available. + Channels []string `json:"channels,omitempty" url:"channels,omitempty"` + // Indicates whether this item is archived (`true`) or not (`false`). + IsArchived *bool `json:"is_archived,omitempty" url:"is_archived,omitempty"` + // The SEO data for a seller's Square Online store. + EcomSeoData *CatalogEcomSeoData `json:"ecom_seo_data,omitempty" url:"ecom_seo_data,omitempty"` + // The food and beverage-specific details for the `FOOD_AND_BEV` item. + FoodAndBeverageDetails *CatalogItemFoodAndBeverageDetails `json:"food_and_beverage_details,omitempty" url:"food_and_beverage_details,omitempty"` + // The item's reporting category. + ReportingCategory *CatalogObjectCategory `json:"reporting_category,omitempty" url:"reporting_category,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CatalogItem) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CatalogItem) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogItem + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CatalogItem(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CatalogItem) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// The food and beverage-specific details of a `FOOD_AND_BEV` item. +type CatalogItemFoodAndBeverageDetails struct { + // The calorie count (in the unit of kcal) for the `FOOD_AND_BEV` type of items. + CalorieCount *int `json:"calorie_count,omitempty" url:"calorie_count,omitempty"` + // The dietary preferences for the `FOOD_AND_BEV` item. + DietaryPreferences []*CatalogItemFoodAndBeverageDetailsDietaryPreference `json:"dietary_preferences,omitempty" url:"dietary_preferences,omitempty"` + // The ingredients for the `FOOD_AND_BEV` type item. + Ingredients []*CatalogItemFoodAndBeverageDetailsIngredient `json:"ingredients,omitempty" url:"ingredients,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CatalogItemFoodAndBeverageDetails) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CatalogItemFoodAndBeverageDetails) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogItemFoodAndBeverageDetails + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CatalogItemFoodAndBeverageDetails(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CatalogItemFoodAndBeverageDetails) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Dietary preferences that can be assigned to an `FOOD_AND_BEV` item and its ingredients. +type CatalogItemFoodAndBeverageDetailsDietaryPreference struct { + // The dietary preference type. Supported values include `STANDARD` and `CUSTOM` as specified in `FoodAndBeverageDetails.DietaryPreferenceType`. + // See [DietaryPreferenceType](#type-dietarypreferencetype) for possible values + Type *CatalogItemFoodAndBeverageDetailsDietaryPreferenceType `json:"type,omitempty" url:"type,omitempty"` + // The name of the dietary preference from a standard pre-defined list. This should be null if it's a custom dietary preference. + // See [StandardDietaryPreference](#type-standarddietarypreference) for possible values + StandardName *CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference `json:"standard_name,omitempty" url:"standard_name,omitempty"` + // The name of a user-defined custom dietary preference. This should be null if it's a standard dietary preference. + CustomName *string `json:"custom_name,omitempty" url:"custom_name,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CatalogItemFoodAndBeverageDetailsDietaryPreference) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CatalogItemFoodAndBeverageDetailsDietaryPreference) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogItemFoodAndBeverageDetailsDietaryPreference + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CatalogItemFoodAndBeverageDetailsDietaryPreference(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CatalogItemFoodAndBeverageDetailsDietaryPreference) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Standard dietary preferences for food and beverage items that are recommended on item creation. +type CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference string + +const ( + CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreferenceStandardDietaryPreferenceDoNotUse CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference = "STANDARD_DIETARY_PREFERENCE_DO_NOT_USE" + CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreferenceDairyFree CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference = "DAIRY_FREE" + CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreferenceGlutenFree CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference = "GLUTEN_FREE" + CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreferenceHalal CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference = "HALAL" + CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreferenceKosher CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference = "KOSHER" + CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreferenceNutFree CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference = "NUT_FREE" + CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreferenceVegan CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference = "VEGAN" + CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreferenceVegetarian CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference = "VEGETARIAN" +) + +func NewCatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreferenceFromString(s string) (CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference, error) { switch s { - case "LIST": - return CatalogModifierListModifierTypeList, nil - case "TEXT": - return CatalogModifierListModifierTypeText, nil + case "STANDARD_DIETARY_PREFERENCE_DO_NOT_USE": + return CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreferenceStandardDietaryPreferenceDoNotUse, nil + case "DAIRY_FREE": + return CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreferenceDairyFree, nil + case "GLUTEN_FREE": + return CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreferenceGlutenFree, nil + case "HALAL": + return CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreferenceHalal, nil + case "KOSHER": + return CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreferenceKosher, nil + case "NUT_FREE": + return CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreferenceNutFree, nil + case "VEGAN": + return CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreferenceVegan, nil + case "VEGETARIAN": + return CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreferenceVegetarian, nil } - var t CatalogModifierListModifierType + var t CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (c CatalogModifierListModifierType) Ptr() *CatalogModifierListModifierType { +func (c CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference) Ptr() *CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference { return &c } -// Indicates whether a CatalogModifierList supports multiple selections. -type CatalogModifierListSelectionType string +// The type of dietary preference for the `FOOD_AND_BEV` type of items and integredients. +type CatalogItemFoodAndBeverageDetailsDietaryPreferenceType string const ( - CatalogModifierListSelectionTypeSingle CatalogModifierListSelectionType = "SINGLE" - CatalogModifierListSelectionTypeMultiple CatalogModifierListSelectionType = "MULTIPLE" + CatalogItemFoodAndBeverageDetailsDietaryPreferenceTypeDietaryPreferenceTypeDoNotUse CatalogItemFoodAndBeverageDetailsDietaryPreferenceType = "DIETARY_PREFERENCE_TYPE_DO_NOT_USE" + CatalogItemFoodAndBeverageDetailsDietaryPreferenceTypeStandard CatalogItemFoodAndBeverageDetailsDietaryPreferenceType = "STANDARD" + CatalogItemFoodAndBeverageDetailsDietaryPreferenceTypeCustom CatalogItemFoodAndBeverageDetailsDietaryPreferenceType = "CUSTOM" ) -func NewCatalogModifierListSelectionTypeFromString(s string) (CatalogModifierListSelectionType, error) { +func NewCatalogItemFoodAndBeverageDetailsDietaryPreferenceTypeFromString(s string) (CatalogItemFoodAndBeverageDetailsDietaryPreferenceType, error) { switch s { - case "SINGLE": - return CatalogModifierListSelectionTypeSingle, nil - case "MULTIPLE": - return CatalogModifierListSelectionTypeMultiple, nil + case "DIETARY_PREFERENCE_TYPE_DO_NOT_USE": + return CatalogItemFoodAndBeverageDetailsDietaryPreferenceTypeDietaryPreferenceTypeDoNotUse, nil + case "STANDARD": + return CatalogItemFoodAndBeverageDetailsDietaryPreferenceTypeStandard, nil + case "CUSTOM": + return CatalogItemFoodAndBeverageDetailsDietaryPreferenceTypeCustom, nil } - var t CatalogModifierListSelectionType + var t CatalogItemFoodAndBeverageDetailsDietaryPreferenceType return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (c CatalogModifierListSelectionType) Ptr() *CatalogModifierListSelectionType { +func (c CatalogItemFoodAndBeverageDetailsDietaryPreferenceType) Ptr() *CatalogItemFoodAndBeverageDetailsDietaryPreferenceType { return &c } -// Options to control how to override the default behavior of the specified modifier. -type CatalogModifierOverride struct { - // The ID of the `CatalogModifier` whose default behavior is being overridden. - ModifierID string `json:"modifier_id" url:"modifier_id"` - // If `true`, this `CatalogModifier` should be selected by default for this `CatalogItem`. - OnByDefault *bool `json:"on_by_default,omitempty" url:"on_by_default,omitempty"` +// Describes the ingredient used in a `FOOD_AND_BEV` item. +type CatalogItemFoodAndBeverageDetailsIngredient struct { + // The dietary preference type of the ingredient. Supported values include `STANDARD` and `CUSTOM` as specified in `FoodAndBeverageDetails.DietaryPreferenceType`. + // See [DietaryPreferenceType](#type-dietarypreferencetype) for possible values + Type *CatalogItemFoodAndBeverageDetailsDietaryPreferenceType `json:"type,omitempty" url:"type,omitempty"` + // The name of the ingredient from a standard pre-defined list. This should be null if it's a custom dietary preference. + // See [StandardIngredient](#type-standardingredient) for possible values + StandardName *CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient `json:"standard_name,omitempty" url:"standard_name,omitempty"` + // The name of a custom user-defined ingredient. This should be null if it's a standard dietary preference. + CustomName *string `json:"custom_name,omitempty" url:"custom_name,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogModifierOverride) GetExtraProperties() map[string]interface{} { +func (c *CatalogItemFoodAndBeverageDetailsIngredient) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogModifierOverride) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogModifierOverride +func (c *CatalogItemFoodAndBeverageDetailsIngredient) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogItemFoodAndBeverageDetailsIngredient var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogModifierOverride(value) + *c = CatalogItemFoodAndBeverageDetailsIngredient(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -8215,7 +9685,7 @@ func (c *CatalogModifierOverride) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogModifierOverride) String() string { +func (c *CatalogItemFoodAndBeverageDetailsIngredient) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -8227,478 +9697,173 @@ func (c *CatalogModifierOverride) String() string { return fmt.Sprintf("%#v", c) } -// The wrapper object for the catalog entries of a given object type. -// -// Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object. -// -// For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance. -// -// In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance. -// -// For a more detailed discussion of the Catalog data model, please see the -// [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. -type CatalogObject struct { - Type string - Item *CatalogObjectItem - Image *CatalogObjectImage - Category *CatalogObjectCategory - ItemVariation *CatalogObjectItemVariation - Tax *CatalogObjectTax - Discount *CatalogObjectDiscount - ModifierList *CatalogObjectModifierList - Modifier *CatalogObjectModifier - DiningOption *CatalogObjectDiningOption - TaxExemption *CatalogObjectTaxExemption - ServiceCharge *CatalogObjectServiceCharge - PricingRule *CatalogObjectPricingRule - ProductSet *CatalogObjectProductSet - TimePeriod *CatalogObjectTimePeriod - MeasurementUnit *CatalogObjectMeasurementUnit - SubscriptionPlan *CatalogObjectSubscriptionPlan - ItemOption *CatalogObjectItemOption - ItemOptionVal *CatalogObjectItemOptionValue - CustomAttributeDefinition *CatalogObjectCustomAttributeDefinition - QuickAmountsSettings *CatalogObjectQuickAmountsSettings - Component *CatalogObjectComponent - Composition *CatalogObjectComposition - Resource *CatalogObjectResource - CheckoutLink *CatalogObjectCheckoutLink - Address *CatalogObjectAddress - SubscriptionProduct *CatalogObjectSubscriptionProduct -} +// Standard ingredients for food and beverage items that are recommended on item creation. +type CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient string -func (c *CatalogObject) UnmarshalJSON(data []byte) error { - var unmarshaler struct { - Type string `json:"type"` +const ( + CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientStandardIngredientDoNotUse CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient = "STANDARD_INGREDIENT_DO_NOT_USE" + CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientCelery CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient = "CELERY" + CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientCrustaceans CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient = "CRUSTACEANS" + CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientEggs CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient = "EGGS" + CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientFish CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient = "FISH" + CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientGluten CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient = "GLUTEN" + CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientLupin CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient = "LUPIN" + CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientMilk CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient = "MILK" + CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientMolluscs CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient = "MOLLUSCS" + CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientMustard CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient = "MUSTARD" + CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientPeanuts CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient = "PEANUTS" + CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientSesame CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient = "SESAME" + CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientSoy CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient = "SOY" + CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientSulphites CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient = "SULPHITES" + CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientTreeNuts CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient = "TREE_NUTS" +) + +func NewCatalogItemFoodAndBeverageDetailsIngredientStandardIngredientFromString(s string) (CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient, error) { + switch s { + case "STANDARD_INGREDIENT_DO_NOT_USE": + return CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientStandardIngredientDoNotUse, nil + case "CELERY": + return CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientCelery, nil + case "CRUSTACEANS": + return CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientCrustaceans, nil + case "EGGS": + return CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientEggs, nil + case "FISH": + return CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientFish, nil + case "GLUTEN": + return CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientGluten, nil + case "LUPIN": + return CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientLupin, nil + case "MILK": + return CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientMilk, nil + case "MOLLUSCS": + return CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientMolluscs, nil + case "MUSTARD": + return CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientMustard, nil + case "PEANUTS": + return CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientPeanuts, nil + case "SESAME": + return CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientSesame, nil + case "SOY": + return CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientSoy, nil + case "SULPHITES": + return CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientSulphites, nil + case "TREE_NUTS": + return CatalogItemFoodAndBeverageDetailsIngredientStandardIngredientTreeNuts, nil } - if err := json.Unmarshal(data, &unmarshaler); err != nil { + var t CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient) Ptr() *CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient { + return &c +} + +// References a text-based modifier or a list of non text-based modifiers applied to a `CatalogItem` instance +// and specifies supported behaviors of the application. +type CatalogItemModifierListInfo struct { + // The ID of the `CatalogModifierList` controlled by this `CatalogModifierListInfo`. + ModifierListID string `json:"modifier_list_id" url:"modifier_list_id"` + // A set of `CatalogModifierOverride` objects that override whether a given `CatalogModifier` is enabled by default. + ModifierOverrides []*CatalogModifierOverride `json:"modifier_overrides,omitempty" url:"modifier_overrides,omitempty"` + // If 0 or larger, the smallest number of `CatalogModifier`s that must be selected from this `CatalogModifierList`. + // The default value is `-1`. + // + // When `CatalogModifierList.selection_type` is `MULTIPLE`, `CatalogModifierListInfo.min_selected_modifiers=-1` + // and `CatalogModifierListInfo.max_selected_modifier=-1` means that from zero to the maximum number of modifiers of + // the `CatalogModifierList` can be selected from the `CatalogModifierList`. + // + // When the `CatalogModifierList.selection_type` is `SINGLE`, `CatalogModifierListInfo.min_selected_modifiers=-1` + // and `CatalogModifierListInfo.max_selected_modifier=-1` means that exactly one modifier must be present in + // and can be selected from the `CatalogModifierList` + MinSelectedModifiers *int `json:"min_selected_modifiers,omitempty" url:"min_selected_modifiers,omitempty"` + // If 0 or larger, the largest number of `CatalogModifier`s that can be selected from this `CatalogModifierList`. + // The default value is `-1`. + // + // When `CatalogModifierList.selection_type` is `MULTIPLE`, `CatalogModifierListInfo.min_selected_modifiers=-1` + // and `CatalogModifierListInfo.max_selected_modifier=-1` means that from zero to the maximum number of modifiers of + // the `CatalogModifierList` can be selected from the `CatalogModifierList`. + // + // When the `CatalogModifierList.selection_type` is `SINGLE`, `CatalogModifierListInfo.min_selected_modifiers=-1` + // and `CatalogModifierListInfo.max_selected_modifier=-1` means that exactly one modifier must be present in + // and can be selected from the `CatalogModifierList` + MaxSelectedModifiers *int `json:"max_selected_modifiers,omitempty" url:"max_selected_modifiers,omitempty"` + // If `true`, enable this `CatalogModifierList`. The default value is `true`. + Enabled *bool `json:"enabled,omitempty" url:"enabled,omitempty"` + // The position of this `CatalogItemModifierListInfo` object within the `modifier_list_info` list applied + // to a `CatalogItem` instance. + Ordinal *int `json:"ordinal,omitempty" url:"ordinal,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CatalogItemModifierListInfo) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CatalogItemModifierListInfo) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogItemModifierListInfo + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { return err } - c.Type = unmarshaler.Type - if unmarshaler.Type == "" { - return fmt.Errorf("%T did not include discriminant type", c) + *c = CatalogItemModifierListInfo(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err } - switch unmarshaler.Type { - case "ITEM": - value := new(CatalogObjectItem) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - c.Item = value - case "IMAGE": - value := new(CatalogObjectImage) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - c.Image = value - case "CATEGORY": - value := new(CatalogObjectCategory) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - c.Category = value - case "ITEM_VARIATION": - value := new(CatalogObjectItemVariation) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - c.ItemVariation = value - case "TAX": - value := new(CatalogObjectTax) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - c.Tax = value - case "DISCOUNT": - value := new(CatalogObjectDiscount) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - c.Discount = value - case "MODIFIER_LIST": - value := new(CatalogObjectModifierList) - if err := json.Unmarshal(data, &value); err != nil { - return err + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CatalogItemModifierListInfo) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value } - c.ModifierList = value - case "MODIFIER": - value := new(CatalogObjectModifier) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - c.Modifier = value - case "DINING_OPTION": - value := new(CatalogObjectDiningOption) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - c.DiningOption = value - case "TAX_EXEMPTION": - value := new(CatalogObjectTaxExemption) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - c.TaxExemption = value - case "SERVICE_CHARGE": - value := new(CatalogObjectServiceCharge) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - c.ServiceCharge = value - case "PRICING_RULE": - value := new(CatalogObjectPricingRule) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - c.PricingRule = value - case "PRODUCT_SET": - value := new(CatalogObjectProductSet) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - c.ProductSet = value - case "TIME_PERIOD": - value := new(CatalogObjectTimePeriod) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - c.TimePeriod = value - case "MEASUREMENT_UNIT": - value := new(CatalogObjectMeasurementUnit) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - c.MeasurementUnit = value - case "SUBSCRIPTION_PLAN": - value := new(CatalogObjectSubscriptionPlan) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - c.SubscriptionPlan = value - case "ITEM_OPTION": - value := new(CatalogObjectItemOption) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - c.ItemOption = value - case "ITEM_OPTION_VAL": - value := new(CatalogObjectItemOptionValue) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - c.ItemOptionVal = value - case "CUSTOM_ATTRIBUTE_DEFINITION": - value := new(CatalogObjectCustomAttributeDefinition) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - c.CustomAttributeDefinition = value - case "QUICK_AMOUNTS_SETTINGS": - value := new(CatalogObjectQuickAmountsSettings) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - c.QuickAmountsSettings = value - case "COMPONENT": - value := new(CatalogObjectComponent) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - c.Component = value - case "COMPOSITION": - value := new(CatalogObjectComposition) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - c.Composition = value - case "RESOURCE": - value := new(CatalogObjectResource) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - c.Resource = value - case "CHECKOUT_LINK": - value := new(CatalogObjectCheckoutLink) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - c.CheckoutLink = value - case "ADDRESS": - value := new(CatalogObjectAddress) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - c.Address = value - case "SUBSCRIPTION_PRODUCT": - value := new(CatalogObjectSubscriptionProduct) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - c.SubscriptionProduct = value - } - return nil -} - -func (c CatalogObject) MarshalJSON() ([]byte, error) { - if c.Item != nil { - return core.MarshalJSONWithExtraProperty(c.Item, "type", "ITEM") - } - if c.Image != nil { - return core.MarshalJSONWithExtraProperty(c.Image, "type", "IMAGE") - } - if c.Category != nil { - return core.MarshalJSONWithExtraProperty(c.Category, "type", "CATEGORY") - } - if c.ItemVariation != nil { - return core.MarshalJSONWithExtraProperty(c.ItemVariation, "type", "ITEM_VARIATION") - } - if c.Tax != nil { - return core.MarshalJSONWithExtraProperty(c.Tax, "type", "TAX") - } - if c.Discount != nil { - return core.MarshalJSONWithExtraProperty(c.Discount, "type", "DISCOUNT") - } - if c.ModifierList != nil { - return core.MarshalJSONWithExtraProperty(c.ModifierList, "type", "MODIFIER_LIST") - } - if c.Modifier != nil { - return core.MarshalJSONWithExtraProperty(c.Modifier, "type", "MODIFIER") - } - if c.DiningOption != nil { - return core.MarshalJSONWithExtraProperty(c.DiningOption, "type", "DINING_OPTION") - } - if c.TaxExemption != nil { - return core.MarshalJSONWithExtraProperty(c.TaxExemption, "type", "TAX_EXEMPTION") - } - if c.ServiceCharge != nil { - return core.MarshalJSONWithExtraProperty(c.ServiceCharge, "type", "SERVICE_CHARGE") - } - if c.PricingRule != nil { - return core.MarshalJSONWithExtraProperty(c.PricingRule, "type", "PRICING_RULE") - } - if c.ProductSet != nil { - return core.MarshalJSONWithExtraProperty(c.ProductSet, "type", "PRODUCT_SET") - } - if c.TimePeriod != nil { - return core.MarshalJSONWithExtraProperty(c.TimePeriod, "type", "TIME_PERIOD") - } - if c.MeasurementUnit != nil { - return core.MarshalJSONWithExtraProperty(c.MeasurementUnit, "type", "MEASUREMENT_UNIT") - } - if c.SubscriptionPlan != nil { - return core.MarshalJSONWithExtraProperty(c.SubscriptionPlan, "type", "SUBSCRIPTION_PLAN") - } - if c.ItemOption != nil { - return core.MarshalJSONWithExtraProperty(c.ItemOption, "type", "ITEM_OPTION") - } - if c.ItemOptionVal != nil { - return core.MarshalJSONWithExtraProperty(c.ItemOptionVal, "type", "ITEM_OPTION_VAL") - } - if c.CustomAttributeDefinition != nil { - return core.MarshalJSONWithExtraProperty(c.CustomAttributeDefinition, "type", "CUSTOM_ATTRIBUTE_DEFINITION") - } - if c.QuickAmountsSettings != nil { - return core.MarshalJSONWithExtraProperty(c.QuickAmountsSettings, "type", "QUICK_AMOUNTS_SETTINGS") - } - if c.Component != nil { - return core.MarshalJSONWithExtraProperty(c.Component, "type", "COMPONENT") - } - if c.Composition != nil { - return core.MarshalJSONWithExtraProperty(c.Composition, "type", "COMPOSITION") - } - if c.Resource != nil { - return core.MarshalJSONWithExtraProperty(c.Resource, "type", "RESOURCE") - } - if c.CheckoutLink != nil { - return core.MarshalJSONWithExtraProperty(c.CheckoutLink, "type", "CHECKOUT_LINK") - } - if c.Address != nil { - return core.MarshalJSONWithExtraProperty(c.Address, "type", "ADDRESS") - } - if c.SubscriptionProduct != nil { - return core.MarshalJSONWithExtraProperty(c.SubscriptionProduct, "type", "SUBSCRIPTION_PRODUCT") - } - return nil, fmt.Errorf("type %T does not define a non-empty union type", c) -} - -type CatalogObjectVisitor interface { - VisitItem(*CatalogObjectItem) error - VisitImage(*CatalogObjectImage) error - VisitCategory(*CatalogObjectCategory) error - VisitItemVariation(*CatalogObjectItemVariation) error - VisitTax(*CatalogObjectTax) error - VisitDiscount(*CatalogObjectDiscount) error - VisitModifierList(*CatalogObjectModifierList) error - VisitModifier(*CatalogObjectModifier) error - VisitDiningOption(*CatalogObjectDiningOption) error - VisitTaxExemption(*CatalogObjectTaxExemption) error - VisitServiceCharge(*CatalogObjectServiceCharge) error - VisitPricingRule(*CatalogObjectPricingRule) error - VisitProductSet(*CatalogObjectProductSet) error - VisitTimePeriod(*CatalogObjectTimePeriod) error - VisitMeasurementUnit(*CatalogObjectMeasurementUnit) error - VisitSubscriptionPlan(*CatalogObjectSubscriptionPlan) error - VisitItemOption(*CatalogObjectItemOption) error - VisitItemOptionVal(*CatalogObjectItemOptionValue) error - VisitCustomAttributeDefinition(*CatalogObjectCustomAttributeDefinition) error - VisitQuickAmountsSettings(*CatalogObjectQuickAmountsSettings) error - VisitComponent(*CatalogObjectComponent) error - VisitComposition(*CatalogObjectComposition) error - VisitResource(*CatalogObjectResource) error - VisitCheckoutLink(*CatalogObjectCheckoutLink) error - VisitAddress(*CatalogObjectAddress) error - VisitSubscriptionProduct(*CatalogObjectSubscriptionProduct) error -} - -func (c *CatalogObject) Accept(visitor CatalogObjectVisitor) error { - if c.Item != nil { - return visitor.VisitItem(c.Item) - } - if c.Image != nil { - return visitor.VisitImage(c.Image) - } - if c.Category != nil { - return visitor.VisitCategory(c.Category) - } - if c.ItemVariation != nil { - return visitor.VisitItemVariation(c.ItemVariation) - } - if c.Tax != nil { - return visitor.VisitTax(c.Tax) - } - if c.Discount != nil { - return visitor.VisitDiscount(c.Discount) - } - if c.ModifierList != nil { - return visitor.VisitModifierList(c.ModifierList) - } - if c.Modifier != nil { - return visitor.VisitModifier(c.Modifier) - } - if c.DiningOption != nil { - return visitor.VisitDiningOption(c.DiningOption) - } - if c.TaxExemption != nil { - return visitor.VisitTaxExemption(c.TaxExemption) - } - if c.ServiceCharge != nil { - return visitor.VisitServiceCharge(c.ServiceCharge) - } - if c.PricingRule != nil { - return visitor.VisitPricingRule(c.PricingRule) - } - if c.ProductSet != nil { - return visitor.VisitProductSet(c.ProductSet) - } - if c.TimePeriod != nil { - return visitor.VisitTimePeriod(c.TimePeriod) - } - if c.MeasurementUnit != nil { - return visitor.VisitMeasurementUnit(c.MeasurementUnit) - } - if c.SubscriptionPlan != nil { - return visitor.VisitSubscriptionPlan(c.SubscriptionPlan) - } - if c.ItemOption != nil { - return visitor.VisitItemOption(c.ItemOption) - } - if c.ItemOptionVal != nil { - return visitor.VisitItemOptionVal(c.ItemOptionVal) - } - if c.CustomAttributeDefinition != nil { - return visitor.VisitCustomAttributeDefinition(c.CustomAttributeDefinition) - } - if c.QuickAmountsSettings != nil { - return visitor.VisitQuickAmountsSettings(c.QuickAmountsSettings) } - if c.Component != nil { - return visitor.VisitComponent(c.Component) - } - if c.Composition != nil { - return visitor.VisitComposition(c.Composition) - } - if c.Resource != nil { - return visitor.VisitResource(c.Resource) - } - if c.CheckoutLink != nil { - return visitor.VisitCheckoutLink(c.CheckoutLink) - } - if c.Address != nil { - return visitor.VisitAddress(c.Address) - } - if c.SubscriptionProduct != nil { - return visitor.VisitSubscriptionProduct(c.SubscriptionProduct) + if value, err := core.StringifyJSON(c); err == nil { + return value } - return fmt.Errorf("type %T does not define a non-empty union type", c) + return fmt.Sprintf("%#v", c) } -type CatalogObjectAddress struct { - // An identifier to reference this object in the catalog. When a new `CatalogObject` - // is inserted, the client should set the id to a temporary identifier starting with - // a "`#`" character. Other objects being inserted or updated within the same request - // may use this identifier to refer to the new object. - // - // When the server receives the new object, it will supply a unique identifier that - // replaces the temporary identifier for all future references. - ID string `json:"id" url:"id"` - // Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - // would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` - // The version of the object. When updating an object, the version supplied - // must match the version in the database, otherwise the write will be rejected as conflicting. - Version *int64 `json:"version,omitempty" url:"version,omitempty"` - // If `true`, the object has been deleted from the database. Must be `false` for new objects - // being inserted. When deleted, the `updated_at` field will equal the deletion time. - IsDeleted *bool `json:"is_deleted,omitempty" url:"is_deleted,omitempty"` - // A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - // is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - // value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - // object defined by the application making the request. - // - // If the `CatalogCustomAttributeDefinition` object is - // defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - // the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - // `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - // if the application making the request is different from the application defining the custom attribute definition. - // Otherwise, the key used in the map is simply `"cocoa_brand"`. - // - // Application-defined custom attributes are set at a global (location-independent) level. - // Custom attribute values are intended to store additional information about a catalog object - // or associations with an entity in another system. Do not use custom attributes - // to store any sensitive information (personally identifiable information, card details, etc.). - CustomAttributeValues map[string]*CatalogCustomAttributeValue `json:"custom_attribute_values,omitempty" url:"custom_attribute_values,omitempty"` - // The Connect v1 IDs for this object at each location where it is present, where they - // differ from the object's Connect V2 ID. The field will only be present for objects that - // have been created or modified by legacy APIs. - CatalogV1IDs []*CatalogV1ID `json:"catalog_v1_ids,omitempty" url:"catalog_v1_ids,omitempty"` - // If `true`, this object is present at all locations (including future locations), except where specified in - // the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - // except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - PresentAtAllLocations *bool `json:"present_at_all_locations,omitempty" url:"present_at_all_locations,omitempty"` - // A list of locations where the object is present, even if `present_at_all_locations` is `false`. - // This can include locations that are deactivated. - PresentAtLocationIDs []string `json:"present_at_location_ids,omitempty" url:"present_at_location_ids,omitempty"` - // A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - // This can include locations that are deactivated. - AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` - // Identifies the `CatalogImage` attached to this `CatalogObject`. - ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` +// A group of variations for a `CatalogItem`. +type CatalogItemOption struct { + // The item option's display name for the seller. Must be unique across + // all item options. This is a searchable attribute for use in applicable query filters. + Name *string `json:"name,omitempty" url:"name,omitempty"` + // The item option's display name for the customer. This is a searchable attribute for use in applicable query filters. + DisplayName *string `json:"display_name,omitempty" url:"display_name,omitempty"` + // The item option's human-readable description. Displayed in the Square + // Point of Sale app for the seller and in the Online Store or on receipts for + // the buyer. This is a searchable attribute for use in applicable query filters. + Description *string `json:"description,omitempty" url:"description,omitempty"` + // If true, display colors for entries in `values` when present. + ShowColors *bool `json:"show_colors,omitempty" url:"show_colors,omitempty"` + // A list of CatalogObjects containing the + // `CatalogItemOptionValue`s for this item. + Values []*CatalogObject `json:"values,omitempty" url:"values,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogObjectAddress) GetExtraProperties() map[string]interface{} { +func (c *CatalogItemOption) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogObjectAddress) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogObjectAddress +func (c *CatalogItemOption) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogItemOption var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogObjectAddress(value) + *c = CatalogItemOption(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -8710,7 +9875,7 @@ func (c *CatalogObjectAddress) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogObjectAddress) String() string { +func (c *CatalogItemOption) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -8722,73 +9887,27 @@ func (c *CatalogObjectAddress) String() string { return fmt.Sprintf("%#v", c) } -type CatalogObjectBase struct { - // An identifier to reference this object in the catalog. When a new `CatalogObject` - // is inserted, the client should set the id to a temporary identifier starting with - // a "`#`" character. Other objects being inserted or updated within the same request - // may use this identifier to refer to the new object. - // - // When the server receives the new object, it will supply a unique identifier that - // replaces the temporary identifier for all future references. - ID string `json:"id" url:"id"` - // Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - // would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` - // The version of the object. When updating an object, the version supplied - // must match the version in the database, otherwise the write will be rejected as conflicting. - Version *int64 `json:"version,omitempty" url:"version,omitempty"` - // If `true`, the object has been deleted from the database. Must be `false` for new objects - // being inserted. When deleted, the `updated_at` field will equal the deletion time. - IsDeleted *bool `json:"is_deleted,omitempty" url:"is_deleted,omitempty"` - // A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - // is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - // value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - // object defined by the application making the request. - // - // If the `CatalogCustomAttributeDefinition` object is - // defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - // the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - // `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - // if the application making the request is different from the application defining the custom attribute definition. - // Otherwise, the key used in the map is simply `"cocoa_brand"`. - // - // Application-defined custom attributes are set at a global (location-independent) level. - // Custom attribute values are intended to store additional information about a catalog object - // or associations with an entity in another system. Do not use custom attributes - // to store any sensitive information (personally identifiable information, card details, etc.). - CustomAttributeValues map[string]*CatalogCustomAttributeValue `json:"custom_attribute_values,omitempty" url:"custom_attribute_values,omitempty"` - // The Connect v1 IDs for this object at each location where it is present, where they - // differ from the object's Connect V2 ID. The field will only be present for objects that - // have been created or modified by legacy APIs. - CatalogV1IDs []*CatalogV1ID `json:"catalog_v1_ids,omitempty" url:"catalog_v1_ids,omitempty"` - // If `true`, this object is present at all locations (including future locations), except where specified in - // the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - // except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - PresentAtAllLocations *bool `json:"present_at_all_locations,omitempty" url:"present_at_all_locations,omitempty"` - // A list of locations where the object is present, even if `present_at_all_locations` is `false`. - // This can include locations that are deactivated. - PresentAtLocationIDs []string `json:"present_at_location_ids,omitempty" url:"present_at_location_ids,omitempty"` - // A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - // This can include locations that are deactivated. - AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` - // Identifies the `CatalogImage` attached to this `CatalogObject`. - ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` +// An option that can be assigned to an item. +// For example, a t-shirt item may offer a color option or a size option. +type CatalogItemOptionForItem struct { + // The unique id of the item option, used to form the dimensions of the item option matrix in a specified order. + ItemOptionID *string `json:"item_option_id,omitempty" url:"item_option_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogObjectBase) GetExtraProperties() map[string]interface{} { +func (c *CatalogItemOptionForItem) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogObjectBase) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogObjectBase +func (c *CatalogItemOptionForItem) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogItemOptionForItem var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogObjectBase(value) + *c = CatalogItemOptionForItem(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -8800,7 +9919,7 @@ func (c *CatalogObjectBase) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogObjectBase) String() string { +func (c *CatalogItemOptionForItem) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -8812,26 +9931,39 @@ func (c *CatalogObjectBase) String() string { return fmt.Sprintf("%#v", c) } -// A batch of catalog objects. -type CatalogObjectBatch struct { - // A list of CatalogObjects belonging to this batch. - Objects []*CatalogObject `json:"objects,omitempty" url:"objects,omitempty"` +// An enumerated value that can link a +// `CatalogItemVariation` to an item option as one of +// its item option values. +type CatalogItemOptionValue struct { + // Unique ID of the associated item option. + ItemOptionID *string `json:"item_option_id,omitempty" url:"item_option_id,omitempty"` + // Name of this item option value. This is a searchable attribute for use in applicable query filters. + Name *string `json:"name,omitempty" url:"name,omitempty"` + // A human-readable description for the option value. This is a searchable attribute for use in applicable query filters. + Description *string `json:"description,omitempty" url:"description,omitempty"` + // The HTML-supported hex color for the item option (e.g., "#ff8d4e85"). + // Only displayed if `show_colors` is enabled on the parent `ItemOption`. When + // left unset, `color` defaults to white ("#ffffff") when `show_colors` is + // enabled on the parent `ItemOption`. + Color *string `json:"color,omitempty" url:"color,omitempty"` + // Determines where this option value appears in a list of option values. + Ordinal *int `json:"ordinal,omitempty" url:"ordinal,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogObjectBatch) GetExtraProperties() map[string]interface{} { +func (c *CatalogItemOptionValue) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogObjectBatch) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogObjectBatch +func (c *CatalogItemOptionValue) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogItemOptionValue var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogObjectBatch(value) + *c = CatalogItemOptionValue(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -8843,7 +9975,7 @@ func (c *CatalogObjectBatch) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogObjectBatch) String() string { +func (c *CatalogItemOptionValue) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -8855,74 +9987,31 @@ func (c *CatalogObjectBatch) String() string { return fmt.Sprintf("%#v", c) } -// A category that can be assigned to an item or a parent category that can be assigned -// to another category. For example, a clothing category can be assigned to a t-shirt item or -// be made as the parent category to the pants category. -type CatalogObjectCategory struct { - // The ID of the object's category. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The order of the object within the context of the category. - Ordinal *int64 `json:"ordinal,omitempty" url:"ordinal,omitempty"` - // Structured data for a `CatalogCategory`, set for CatalogObjects of type `CATEGORY`. - CategoryData *CatalogCategory `json:"category_data,omitempty" url:"category_data,omitempty"` - // Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - // would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` - // The version of the object. When updating an object, the version supplied - // must match the version in the database, otherwise the write will be rejected as conflicting. - Version *int64 `json:"version,omitempty" url:"version,omitempty"` - // If `true`, the object has been deleted from the database. Must be `false` for new objects - // being inserted. When deleted, the `updated_at` field will equal the deletion time. - IsDeleted *bool `json:"is_deleted,omitempty" url:"is_deleted,omitempty"` - // A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - // is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - // value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - // object defined by the application making the request. - // - // If the `CatalogCustomAttributeDefinition` object is - // defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - // the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - // `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - // if the application making the request is different from the application defining the custom attribute definition. - // Otherwise, the key used in the map is simply `"cocoa_brand"`. - // - // Application-defined custom attributes are set at a global (location-independent) level. - // Custom attribute values are intended to store additional information about a catalog object - // or associations with an entity in another system. Do not use custom attributes - // to store any sensitive information (personally identifiable information, card details, etc.). - CustomAttributeValues map[string]*CatalogCustomAttributeValue `json:"custom_attribute_values,omitempty" url:"custom_attribute_values,omitempty"` - // The Connect v1 IDs for this object at each location where it is present, where they - // differ from the object's Connect V2 ID. The field will only be present for objects that - // have been created or modified by legacy APIs. - CatalogV1IDs []*CatalogV1ID `json:"catalog_v1_ids,omitempty" url:"catalog_v1_ids,omitempty"` - // If `true`, this object is present at all locations (including future locations), except where specified in - // the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - // except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - PresentAtAllLocations *bool `json:"present_at_all_locations,omitempty" url:"present_at_all_locations,omitempty"` - // A list of locations where the object is present, even if `present_at_all_locations` is `false`. - // This can include locations that are deactivated. - PresentAtLocationIDs []string `json:"present_at_location_ids,omitempty" url:"present_at_location_ids,omitempty"` - // A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - // This can include locations that are deactivated. - AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` - // Identifies the `CatalogImage` attached to this `CatalogObject`. - ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` +// A `CatalogItemOptionValue` links an item variation to an item option as +// an item option value. For example, a t-shirt item may offer a color option and +// a size option. An item option value would represent each variation of t-shirt: +// For example, "Color:Red, Size:Small" or "Color:Blue, Size:Medium". +type CatalogItemOptionValueForItemVariation struct { + // The unique id of an item option. + ItemOptionID *string `json:"item_option_id,omitempty" url:"item_option_id,omitempty"` + // The unique id of the selected value for the item option. + ItemOptionValueID *string `json:"item_option_value_id,omitempty" url:"item_option_value_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogObjectCategory) GetExtraProperties() map[string]interface{} { +func (c *CatalogItemOptionValueForItemVariation) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogObjectCategory) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogObjectCategory +func (c *CatalogItemOptionValueForItemVariation) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogItemOptionValueForItemVariation var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogObjectCategory(value) + *c = CatalogItemOptionValueForItemVariation(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -8934,7 +10023,7 @@ func (c *CatalogObjectCategory) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogObjectCategory) String() string { +func (c *CatalogItemOptionValueForItemVariation) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -8946,73 +10035,169 @@ func (c *CatalogObjectCategory) String() string { return fmt.Sprintf("%#v", c) } -type CatalogObjectCheckoutLink struct { - // An identifier to reference this object in the catalog. When a new `CatalogObject` - // is inserted, the client should set the id to a temporary identifier starting with - // a "`#`" character. Other objects being inserted or updated within the same request - // may use this identifier to refer to the new object. +// The type of a CatalogItem. Connect V2 only allows the creation of `REGULAR` or `APPOINTMENTS_SERVICE` items. +type CatalogItemProductType string + +const ( + CatalogItemProductTypeRegular CatalogItemProductType = "REGULAR" + CatalogItemProductTypeGiftCard CatalogItemProductType = "GIFT_CARD" + CatalogItemProductTypeAppointmentsService CatalogItemProductType = "APPOINTMENTS_SERVICE" + CatalogItemProductTypeClassTicket CatalogItemProductType = "CLASS_TICKET" + CatalogItemProductTypeFoodAndBev CatalogItemProductType = "FOOD_AND_BEV" + CatalogItemProductTypeEvent CatalogItemProductType = "EVENT" + CatalogItemProductTypeDigital CatalogItemProductType = "DIGITAL" + CatalogItemProductTypeDonation CatalogItemProductType = "DONATION" + CatalogItemProductTypeMembership CatalogItemProductType = "MEMBERSHIP" + CatalogItemProductTypeCreditPackage CatalogItemProductType = "CREDIT_PACKAGE" + CatalogItemProductTypeCombo CatalogItemProductType = "COMBO" + CatalogItemProductTypeLegacySquareOnlineService CatalogItemProductType = "LEGACY_SQUARE_ONLINE_SERVICE" + CatalogItemProductTypeLegacySquareOnlineMembership CatalogItemProductType = "LEGACY_SQUARE_ONLINE_MEMBERSHIP" + CatalogItemProductTypeAppointmentsMembership CatalogItemProductType = "APPOINTMENTS_MEMBERSHIP" +) + +func NewCatalogItemProductTypeFromString(s string) (CatalogItemProductType, error) { + switch s { + case "REGULAR": + return CatalogItemProductTypeRegular, nil + case "GIFT_CARD": + return CatalogItemProductTypeGiftCard, nil + case "APPOINTMENTS_SERVICE": + return CatalogItemProductTypeAppointmentsService, nil + case "CLASS_TICKET": + return CatalogItemProductTypeClassTicket, nil + case "FOOD_AND_BEV": + return CatalogItemProductTypeFoodAndBev, nil + case "EVENT": + return CatalogItemProductTypeEvent, nil + case "DIGITAL": + return CatalogItemProductTypeDigital, nil + case "DONATION": + return CatalogItemProductTypeDonation, nil + case "MEMBERSHIP": + return CatalogItemProductTypeMembership, nil + case "CREDIT_PACKAGE": + return CatalogItemProductTypeCreditPackage, nil + case "COMBO": + return CatalogItemProductTypeCombo, nil + case "LEGACY_SQUARE_ONLINE_SERVICE": + return CatalogItemProductTypeLegacySquareOnlineService, nil + case "LEGACY_SQUARE_ONLINE_MEMBERSHIP": + return CatalogItemProductTypeLegacySquareOnlineMembership, nil + case "APPOINTMENTS_MEMBERSHIP": + return CatalogItemProductTypeAppointmentsMembership, nil + } + var t CatalogItemProductType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c CatalogItemProductType) Ptr() *CatalogItemProductType { + return &c +} + +// An item variation, representing a product for sale, in the Catalog object model. Each [item](entity:CatalogItem) must have at least one +// item variation and can have at most 250 item variations. +// +// An item variation can be sellable, stockable, or both if it has a unit of measure for its count for the sold number of the variation, the stocked +// number of the variation, or both. For example, when a variation representing wine is stocked and sold by the bottle, the variation is both +// stockable and sellable. But when a variation of the wine is sold by the glass, the sold units cannot be used as a measure of the stocked units. This by-the-glass +// variation is sellable, but not stockable. To accurately keep track of the wine's inventory count at any time, the sellable count must be +// converted to stockable count. Typically, the seller defines this unit conversion. For example, 1 bottle equals 5 glasses. The Square API exposes +// the `stockable_conversion` property on the variation to specify the conversion. Thus, when two glasses of the wine are sold, the sellable count +// decreases by 2, and the stockable count automatically decreases by 0.4 bottle according to the conversion. +type CatalogItemVariation struct { + // The ID of the `CatalogItem` associated with this item variation. + ItemID *string `json:"item_id,omitempty" url:"item_id,omitempty"` + // The item variation's name. This is a searchable attribute for use in applicable query filters. // - // When the server receives the new object, it will supply a unique identifier that - // replaces the temporary identifier for all future references. - ID string `json:"id" url:"id"` - // Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - // would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` - // The version of the object. When updating an object, the version supplied - // must match the version in the database, otherwise the write will be rejected as conflicting. - Version *int64 `json:"version,omitempty" url:"version,omitempty"` - // If `true`, the object has been deleted from the database. Must be `false` for new objects - // being inserted. When deleted, the `updated_at` field will equal the deletion time. - IsDeleted *bool `json:"is_deleted,omitempty" url:"is_deleted,omitempty"` - // A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - // is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - // value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - // object defined by the application making the request. + // Its value has a maximum length of 255 Unicode code points. However, when the parent [item](entity:CatalogItem) + // uses [item options](entity:CatalogItemOption), this attribute is auto-generated, read-only, and can be + // longer than 255 Unicode code points. + Name *string `json:"name,omitempty" url:"name,omitempty"` + // The item variation's SKU, if any. This is a searchable attribute for use in applicable query filters. + Sku *string `json:"sku,omitempty" url:"sku,omitempty"` + // The universal product code (UPC) of the item variation, if any. This is a searchable attribute for use in applicable query filters. // - // If the `CatalogCustomAttributeDefinition` object is - // defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - // the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - // `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - // if the application making the request is different from the application defining the custom attribute definition. - // Otherwise, the key used in the map is simply `"cocoa_brand"`. + // The value of this attribute should be a number of 12-14 digits long. This restriction is enforced on the Square Seller Dashboard, + // Square Point of Sale or Retail Point of Sale apps, where this attribute shows in the GTIN field. If a non-compliant UPC value is assigned + // to this attribute using the API, the value is not editable on the Seller Dashboard, Square Point of Sale or Retail Point of Sale apps + // unless it is updated to fit the expected format. + Upc *string `json:"upc,omitempty" url:"upc,omitempty"` + // The order in which this item variation should be displayed. This value is read-only. On writes, the ordinal + // for each item variation within a parent `CatalogItem` is set according to the item variations's + // position. On reads, the value is not guaranteed to be sequential or unique. + Ordinal *int `json:"ordinal,omitempty" url:"ordinal,omitempty"` + // Indicates whether the item variation's price is fixed or determined at the time + // of sale. + // See [CatalogPricingType](#type-catalogpricingtype) for possible values + PricingType *CatalogPricingType `json:"pricing_type,omitempty" url:"pricing_type,omitempty"` + // The item variation's price, if fixed pricing is used. + PriceMoney *Money `json:"price_money,omitempty" url:"price_money,omitempty"` + // Per-location price and inventory overrides. + LocationOverrides []*ItemVariationLocationOverrides `json:"location_overrides,omitempty" url:"location_overrides,omitempty"` + // If `true`, inventory tracking is active for the variation. + TrackInventory *bool `json:"track_inventory,omitempty" url:"track_inventory,omitempty"` + // Indicates whether the item variation displays an alert when its inventory quantity is less than or equal + // to its `inventory_alert_threshold`. + // See [InventoryAlertType](#type-inventoryalerttype) for possible values + InventoryAlertType *InventoryAlertType `json:"inventory_alert_type,omitempty" url:"inventory_alert_type,omitempty"` + // If the inventory quantity for the variation is less than or equal to this value and `inventory_alert_type` + // is `LOW_QUANTITY`, the variation displays an alert in the merchant dashboard. // - // Application-defined custom attributes are set at a global (location-independent) level. - // Custom attribute values are intended to store additional information about a catalog object - // or associations with an entity in another system. Do not use custom attributes - // to store any sensitive information (personally identifiable information, card details, etc.). - CustomAttributeValues map[string]*CatalogCustomAttributeValue `json:"custom_attribute_values,omitempty" url:"custom_attribute_values,omitempty"` - // The Connect v1 IDs for this object at each location where it is present, where they - // differ from the object's Connect V2 ID. The field will only be present for objects that - // have been created or modified by legacy APIs. - CatalogV1IDs []*CatalogV1ID `json:"catalog_v1_ids,omitempty" url:"catalog_v1_ids,omitempty"` - // If `true`, this object is present at all locations (including future locations), except where specified in - // the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - // except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - PresentAtAllLocations *bool `json:"present_at_all_locations,omitempty" url:"present_at_all_locations,omitempty"` - // A list of locations where the object is present, even if `present_at_all_locations` is `false`. - // This can include locations that are deactivated. - PresentAtLocationIDs []string `json:"present_at_location_ids,omitempty" url:"present_at_location_ids,omitempty"` - // A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - // This can include locations that are deactivated. - AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` - // Identifies the `CatalogImage` attached to this `CatalogObject`. - ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` + // This value is always an integer. + InventoryAlertThreshold *int64 `json:"inventory_alert_threshold,omitempty" url:"inventory_alert_threshold,omitempty"` + // Arbitrary user metadata to associate with the item variation. This attribute value length is of Unicode code points. + UserData *string `json:"user_data,omitempty" url:"user_data,omitempty"` + // If the `CatalogItem` that owns this item variation is of type + // `APPOINTMENTS_SERVICE`, then this is the duration of the service in milliseconds. For + // example, a 30 minute appointment would have the value `1800000`, which is equal to + // 30 (minutes) _ 60 (seconds per minute) _ 1000 (milliseconds per second). + ServiceDuration *int64 `json:"service_duration,omitempty" url:"service_duration,omitempty"` + // If the `CatalogItem` that owns this item variation is of type + // `APPOINTMENTS_SERVICE`, a bool representing whether this service is available for booking. + AvailableForBooking *bool `json:"available_for_booking,omitempty" url:"available_for_booking,omitempty"` + // List of item option values associated with this item variation. Listed + // in the same order as the item options of the parent item. + ItemOptionValues []*CatalogItemOptionValueForItemVariation `json:"item_option_values,omitempty" url:"item_option_values,omitempty"` + // ID of the ‘CatalogMeasurementUnit’ that is used to measure the quantity + // sold of this item variation. If left unset, the item will be sold in + // whole quantities. + MeasurementUnitID *string `json:"measurement_unit_id,omitempty" url:"measurement_unit_id,omitempty"` + // Whether this variation can be sold. The inventory count of a sellable variation indicates + // the number of units available for sale. When a variation is both stockable and sellable, + // its sellable inventory count can be smaller than or equal to its stockable count. + Sellable *bool `json:"sellable,omitempty" url:"sellable,omitempty"` + // Whether stock is counted directly on this variation (TRUE) or only on its components (FALSE). + // When a variation is both stockable and sellable, the inventory count of a stockable variation keeps track of the number of units of this variation in stock + // and is not an indicator of the number of units of the variation that can be sold. + Stockable *bool `json:"stockable,omitempty" url:"stockable,omitempty"` + // The IDs of images associated with this `CatalogItemVariation` instance. + // These images will be shown to customers in Square Online Store. + ImageIDs []string `json:"image_ids,omitempty" url:"image_ids,omitempty"` + // Tokens of employees that can perform the service represented by this variation. Only valid for + // variations of type `APPOINTMENTS_SERVICE`. + TeamMemberIDs []string `json:"team_member_ids,omitempty" url:"team_member_ids,omitempty"` + // The unit conversion rule, as prescribed by the [CatalogStockConversion](entity:CatalogStockConversion) type, + // that describes how this non-stockable (i.e., sellable/receivable) item variation is converted + // to/from the stockable item variation sharing the same parent item. With the stock conversion, + // you can accurately track inventory when an item variation is sold in one unit, but stocked in + // another unit. + StockableConversion *CatalogStockConversion `json:"stockable_conversion,omitempty" url:"stockable_conversion,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogObjectCheckoutLink) GetExtraProperties() map[string]interface{} { +func (c *CatalogItemVariation) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogObjectCheckoutLink) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogObjectCheckoutLink +func (c *CatalogItemVariation) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogItemVariation var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogObjectCheckoutLink(value) + *c = CatalogItemVariation(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -9024,7 +10209,7 @@ func (c *CatalogObjectCheckoutLink) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogObjectCheckoutLink) String() string { +func (c *CatalogItemVariation) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -9036,73 +10221,37 @@ func (c *CatalogObjectCheckoutLink) String() string { return fmt.Sprintf("%#v", c) } -type CatalogObjectComponent struct { - // An identifier to reference this object in the catalog. When a new `CatalogObject` - // is inserted, the client should set the id to a temporary identifier starting with - // a "`#`" character. Other objects being inserted or updated within the same request - // may use this identifier to refer to the new object. - // - // When the server receives the new object, it will supply a unique identifier that - // replaces the temporary identifier for all future references. - ID string `json:"id" url:"id"` - // Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - // would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` - // The version of the object. When updating an object, the version supplied - // must match the version in the database, otherwise the write will be rejected as conflicting. - Version *int64 `json:"version,omitempty" url:"version,omitempty"` - // If `true`, the object has been deleted from the database. Must be `false` for new objects - // being inserted. When deleted, the `updated_at` field will equal the deletion time. - IsDeleted *bool `json:"is_deleted,omitempty" url:"is_deleted,omitempty"` - // A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - // is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - // value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - // object defined by the application making the request. +// Represents the unit used to measure a `CatalogItemVariation` and +// specifies the precision for decimal quantities. +type CatalogMeasurementUnit struct { + // Indicates the unit used to measure the quantity of a catalog item variation. + MeasurementUnit *MeasurementUnit `json:"measurement_unit,omitempty" url:"measurement_unit,omitempty"` + // An integer between 0 and 5 that represents the maximum number of + // positions allowed after the decimal in quantities measured with this unit. + // For example: // - // If the `CatalogCustomAttributeDefinition` object is - // defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - // the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - // `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - // if the application making the request is different from the application defining the custom attribute definition. - // Otherwise, the key used in the map is simply `"cocoa_brand"`. + // - if the precision is 0, the quantity can be 1, 2, 3, etc. + // - if the precision is 1, the quantity can be 0.1, 0.2, etc. + // - if the precision is 2, the quantity can be 0.01, 0.12, etc. // - // Application-defined custom attributes are set at a global (location-independent) level. - // Custom attribute values are intended to store additional information about a catalog object - // or associations with an entity in another system. Do not use custom attributes - // to store any sensitive information (personally identifiable information, card details, etc.). - CustomAttributeValues map[string]*CatalogCustomAttributeValue `json:"custom_attribute_values,omitempty" url:"custom_attribute_values,omitempty"` - // The Connect v1 IDs for this object at each location where it is present, where they - // differ from the object's Connect V2 ID. The field will only be present for objects that - // have been created or modified by legacy APIs. - CatalogV1IDs []*CatalogV1ID `json:"catalog_v1_ids,omitempty" url:"catalog_v1_ids,omitempty"` - // If `true`, this object is present at all locations (including future locations), except where specified in - // the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - // except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - PresentAtAllLocations *bool `json:"present_at_all_locations,omitempty" url:"present_at_all_locations,omitempty"` - // A list of locations where the object is present, even if `present_at_all_locations` is `false`. - // This can include locations that are deactivated. - PresentAtLocationIDs []string `json:"present_at_location_ids,omitempty" url:"present_at_location_ids,omitempty"` - // A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - // This can include locations that are deactivated. - AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` - // Identifies the `CatalogImage` attached to this `CatalogObject`. - ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` + // Default: 3 + Precision *int `json:"precision,omitempty" url:"precision,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogObjectComponent) GetExtraProperties() map[string]interface{} { +func (c *CatalogMeasurementUnit) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogObjectComponent) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogObjectComponent +func (c *CatalogMeasurementUnit) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogMeasurementUnit var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogObjectComponent(value) + *c = CatalogMeasurementUnit(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -9114,7 +10263,7 @@ func (c *CatalogObjectComponent) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogObjectComponent) String() string { +func (c *CatalogMeasurementUnit) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -9126,73 +10275,37 @@ func (c *CatalogObjectComponent) String() string { return fmt.Sprintf("%#v", c) } -type CatalogObjectComposition struct { - // An identifier to reference this object in the catalog. When a new `CatalogObject` - // is inserted, the client should set the id to a temporary identifier starting with - // a "`#`" character. Other objects being inserted or updated within the same request - // may use this identifier to refer to the new object. - // - // When the server receives the new object, it will supply a unique identifier that - // replaces the temporary identifier for all future references. - ID string `json:"id" url:"id"` - // Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - // would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` - // The version of the object. When updating an object, the version supplied - // must match the version in the database, otherwise the write will be rejected as conflicting. - Version *int64 `json:"version,omitempty" url:"version,omitempty"` - // If `true`, the object has been deleted from the database. Must be `false` for new objects - // being inserted. When deleted, the `updated_at` field will equal the deletion time. - IsDeleted *bool `json:"is_deleted,omitempty" url:"is_deleted,omitempty"` - // A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - // is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - // value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - // object defined by the application making the request. - // - // If the `CatalogCustomAttributeDefinition` object is - // defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - // the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - // `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - // if the application making the request is different from the application defining the custom attribute definition. - // Otherwise, the key used in the map is simply `"cocoa_brand"`. - // - // Application-defined custom attributes are set at a global (location-independent) level. - // Custom attribute values are intended to store additional information about a catalog object - // or associations with an entity in another system. Do not use custom attributes - // to store any sensitive information (personally identifiable information, card details, etc.). - CustomAttributeValues map[string]*CatalogCustomAttributeValue `json:"custom_attribute_values,omitempty" url:"custom_attribute_values,omitempty"` - // The Connect v1 IDs for this object at each location where it is present, where they - // differ from the object's Connect V2 ID. The field will only be present for objects that - // have been created or modified by legacy APIs. - CatalogV1IDs []*CatalogV1ID `json:"catalog_v1_ids,omitempty" url:"catalog_v1_ids,omitempty"` - // If `true`, this object is present at all locations (including future locations), except where specified in - // the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - // except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - PresentAtAllLocations *bool `json:"present_at_all_locations,omitempty" url:"present_at_all_locations,omitempty"` - // A list of locations where the object is present, even if `present_at_all_locations` is `false`. - // This can include locations that are deactivated. - PresentAtLocationIDs []string `json:"present_at_location_ids,omitempty" url:"present_at_location_ids,omitempty"` - // A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - // This can include locations that are deactivated. - AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` - // Identifies the `CatalogImage` attached to this `CatalogObject`. +// A modifier applicable to items at the time of sale. An example of a modifier is a Cheese add-on to a Burger item. +type CatalogModifier struct { + // The modifier name. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points. + Name *string `json:"name,omitempty" url:"name,omitempty"` + // The modifier price. + PriceMoney *Money `json:"price_money,omitempty" url:"price_money,omitempty"` + // Determines where this `CatalogModifier` appears in the `CatalogModifierList`. + Ordinal *int `json:"ordinal,omitempty" url:"ordinal,omitempty"` + // The ID of the `CatalogModifierList` associated with this modifier. + ModifierListID *string `json:"modifier_list_id,omitempty" url:"modifier_list_id,omitempty"` + // Location-specific price overrides. + LocationOverrides []*ModifierLocationOverrides `json:"location_overrides,omitempty" url:"location_overrides,omitempty"` + // The ID of the image associated with this `CatalogModifier` instance. + // Currently this image is not displayed by Square, but is free to be displayed in 3rd party applications. ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogObjectComposition) GetExtraProperties() map[string]interface{} { +func (c *CatalogModifier) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogObjectComposition) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogObjectComposition +func (c *CatalogModifier) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogModifier var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogObjectComposition(value) + *c = CatalogModifier(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -9204,7 +10317,7 @@ func (c *CatalogObjectComposition) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogObjectComposition) String() string { +func (c *CatalogModifier) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -9216,75 +10329,82 @@ func (c *CatalogObjectComposition) String() string { return fmt.Sprintf("%#v", c) } -type CatalogObjectCustomAttributeDefinition struct { - // An identifier to reference this object in the catalog. When a new `CatalogObject` - // is inserted, the client should set the id to a temporary identifier starting with - // a "`#`" character. Other objects being inserted or updated within the same request - // may use this identifier to refer to the new object. +// For a text-based modifier, this encapsulates the modifier's text when its `modifier_type` is `TEXT`. +// For example, to sell T-shirts with custom prints, a text-based modifier can be used to capture the buyer-supplied +// text string to be selected for the T-shirt at the time of sale. +// +// For non text-based modifiers, this encapsulates a non-empty list of modifiers applicable to items +// at the time of sale. Each element of the modifier list is a `CatalogObject` instance of the `MODIFIER` type. +// For example, a "Condiments" modifier list applicable to a "Hot Dog" item +// may contain "Ketchup", "Mustard", and "Relish" modifiers. +// +// A non text-based modifier can be applied to the modified item once or multiple times, if the `selection_type` field +// is set to `SINGLE` or `MULTIPLE`, respectively. On the other hand, a text-based modifier can be applied to the item +// only once and the `selection_type` field is always set to `SINGLE`. +type CatalogModifierList struct { + // The name of the `CatalogModifierList` instance. This is a searchable attribute for use in applicable query filters, and its value length is of + // Unicode code points. + Name *string `json:"name,omitempty" url:"name,omitempty"` + // The position of this `CatalogModifierList` within a list of `CatalogModifierList` instances. + Ordinal *int `json:"ordinal,omitempty" url:"ordinal,omitempty"` + // Indicates whether a single (`SINGLE`) or multiple (`MULTIPLE`) modifiers from the list + // can be applied to a single `CatalogItem`. // - // When the server receives the new object, it will supply a unique identifier that - // replaces the temporary identifier for all future references. - ID string `json:"id" url:"id"` - // Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - // would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` - // The version of the object. When updating an object, the version supplied - // must match the version in the database, otherwise the write will be rejected as conflicting. - Version *int64 `json:"version,omitempty" url:"version,omitempty"` - // If `true`, the object has been deleted from the database. Must be `false` for new objects - // being inserted. When deleted, the `updated_at` field will equal the deletion time. - IsDeleted *bool `json:"is_deleted,omitempty" url:"is_deleted,omitempty"` - // A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - // is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - // value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - // object defined by the application making the request. + // For text-based modifiers, the `selection_type` attribute is always `SINGLE`. The other value is ignored. + // See [CatalogModifierListSelectionType](#type-catalogmodifierlistselectiontype) for possible values + SelectionType *CatalogModifierListSelectionType `json:"selection_type,omitempty" url:"selection_type,omitempty"` + // A non-empty list of `CatalogModifier` objects to be included in the `CatalogModifierList`, + // for non text-based modifiers when the `modifier_type` attribute is `LIST`. Each element of this list + // is a `CatalogObject` instance of the `MODIFIER` type, containing the following attributes: // - // If the `CatalogCustomAttributeDefinition` object is - // defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - // the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - // `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - // if the application making the request is different from the application defining the custom attribute definition. - // Otherwise, the key used in the map is simply `"cocoa_brand"`. + // ``` + // { + // "id": "{{catalog_modifier_id}}", + // "type": "MODIFIER", + // "modifier_data": {{a CatalogModifier instance>}} + // } + // ``` + Modifiers []*CatalogObject `json:"modifiers,omitempty" url:"modifiers,omitempty"` + // The IDs of images associated with this `CatalogModifierList` instance. + // Currently these images are not displayed on Square products, but may be displayed in 3rd-party applications. + ImageIDs []string `json:"image_ids,omitempty" url:"image_ids,omitempty"` + // The type of the modifier. // - // Application-defined custom attributes are set at a global (location-independent) level. - // Custom attribute values are intended to store additional information about a catalog object - // or associations with an entity in another system. Do not use custom attributes - // to store any sensitive information (personally identifiable information, card details, etc.). - CustomAttributeValues map[string]*CatalogCustomAttributeValue `json:"custom_attribute_values,omitempty" url:"custom_attribute_values,omitempty"` - // The Connect v1 IDs for this object at each location where it is present, where they - // differ from the object's Connect V2 ID. The field will only be present for objects that - // have been created or modified by legacy APIs. - CatalogV1IDs []*CatalogV1ID `json:"catalog_v1_ids,omitempty" url:"catalog_v1_ids,omitempty"` - // If `true`, this object is present at all locations (including future locations), except where specified in - // the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - // except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - PresentAtAllLocations *bool `json:"present_at_all_locations,omitempty" url:"present_at_all_locations,omitempty"` - // A list of locations where the object is present, even if `present_at_all_locations` is `false`. - // This can include locations that are deactivated. - PresentAtLocationIDs []string `json:"present_at_location_ids,omitempty" url:"present_at_location_ids,omitempty"` - // A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - // This can include locations that are deactivated. - AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` - // Identifies the `CatalogImage` attached to this `CatalogObject`. - ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` - // Structured data for a `CatalogCustomAttributeDefinition`, set for CatalogObjects of type `CUSTOM_ATTRIBUTE_DEFINITION`. - CustomAttributeDefinitionData *CatalogCustomAttributeDefinition `json:"custom_attribute_definition_data,omitempty" url:"custom_attribute_definition_data,omitempty"` + // When this `modifier_type` value is `TEXT`, the `CatalogModifierList` represents a text-based modifier. + // When this `modifier_type` value is `LIST`, the `CatalogModifierList` contains a list of `CatalogModifier` objects. + // See [CatalogModifierListModifierType](#type-catalogmodifierlistmodifiertype) for possible values + ModifierType *CatalogModifierListModifierType `json:"modifier_type,omitempty" url:"modifier_type,omitempty"` + // The maximum length, in Unicode points, of the text string of the text-based modifier as represented by + // this `CatalogModifierList` object with the `modifier_type` set to `TEXT`. + MaxLength *int `json:"max_length,omitempty" url:"max_length,omitempty"` + // Whether the text string must be a non-empty string (`true`) or not (`false`) for a text-based modifier + // as represented by this `CatalogModifierList` object with the `modifier_type` set to `TEXT`. + TextRequired *bool `json:"text_required,omitempty" url:"text_required,omitempty"` + // A note for internal use by the business. + // + // For example, for a text-based modifier applied to a T-shirt item, if the buyer-supplied text of "Hello, Kitty!" + // is to be printed on the T-shirt, this `internal_name` attribute can be "Use italic face" as + // an instruction for the business to follow. + // + // For non text-based modifiers, this `internal_name` attribute can be + // used to include SKUs, internal codes, or supplemental descriptions for internal use. + InternalName *string `json:"internal_name,omitempty" url:"internal_name,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogObjectCustomAttributeDefinition) GetExtraProperties() map[string]interface{} { +func (c *CatalogModifierList) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogObjectCustomAttributeDefinition) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogObjectCustomAttributeDefinition +func (c *CatalogModifierList) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogModifierList var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogObjectCustomAttributeDefinition(value) + *c = CatalogModifierList(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -9296,7 +10416,7 @@ func (c *CatalogObjectCustomAttributeDefinition) UnmarshalJSON(data []byte) erro return nil } -func (c *CatalogObjectCustomAttributeDefinition) String() string { +func (c *CatalogModifierList) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -9308,73 +10428,74 @@ func (c *CatalogObjectCustomAttributeDefinition) String() string { return fmt.Sprintf("%#v", c) } -type CatalogObjectDiningOption struct { - // An identifier to reference this object in the catalog. When a new `CatalogObject` - // is inserted, the client should set the id to a temporary identifier starting with - // a "`#`" character. Other objects being inserted or updated within the same request - // may use this identifier to refer to the new object. - // - // When the server receives the new object, it will supply a unique identifier that - // replaces the temporary identifier for all future references. - ID string `json:"id" url:"id"` - // Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - // would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` - // The version of the object. When updating an object, the version supplied - // must match the version in the database, otherwise the write will be rejected as conflicting. - Version *int64 `json:"version,omitempty" url:"version,omitempty"` - // If `true`, the object has been deleted from the database. Must be `false` for new objects - // being inserted. When deleted, the `updated_at` field will equal the deletion time. - IsDeleted *bool `json:"is_deleted,omitempty" url:"is_deleted,omitempty"` - // A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - // is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - // value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - // object defined by the application making the request. - // - // If the `CatalogCustomAttributeDefinition` object is - // defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - // the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - // `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - // if the application making the request is different from the application defining the custom attribute definition. - // Otherwise, the key used in the map is simply `"cocoa_brand"`. - // - // Application-defined custom attributes are set at a global (location-independent) level. - // Custom attribute values are intended to store additional information about a catalog object - // or associations with an entity in another system. Do not use custom attributes - // to store any sensitive information (personally identifiable information, card details, etc.). - CustomAttributeValues map[string]*CatalogCustomAttributeValue `json:"custom_attribute_values,omitempty" url:"custom_attribute_values,omitempty"` - // The Connect v1 IDs for this object at each location where it is present, where they - // differ from the object's Connect V2 ID. The field will only be present for objects that - // have been created or modified by legacy APIs. - CatalogV1IDs []*CatalogV1ID `json:"catalog_v1_ids,omitempty" url:"catalog_v1_ids,omitempty"` - // If `true`, this object is present at all locations (including future locations), except where specified in - // the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - // except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - PresentAtAllLocations *bool `json:"present_at_all_locations,omitempty" url:"present_at_all_locations,omitempty"` - // A list of locations where the object is present, even if `present_at_all_locations` is `false`. - // This can include locations that are deactivated. - PresentAtLocationIDs []string `json:"present_at_location_ids,omitempty" url:"present_at_location_ids,omitempty"` - // A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - // This can include locations that are deactivated. - AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` - // Identifies the `CatalogImage` attached to this `CatalogObject`. - ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` +// Defines the type of `CatalogModifierList`. +type CatalogModifierListModifierType string + +const ( + CatalogModifierListModifierTypeList CatalogModifierListModifierType = "LIST" + CatalogModifierListModifierTypeText CatalogModifierListModifierType = "TEXT" +) + +func NewCatalogModifierListModifierTypeFromString(s string) (CatalogModifierListModifierType, error) { + switch s { + case "LIST": + return CatalogModifierListModifierTypeList, nil + case "TEXT": + return CatalogModifierListModifierTypeText, nil + } + var t CatalogModifierListModifierType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c CatalogModifierListModifierType) Ptr() *CatalogModifierListModifierType { + return &c +} + +// Indicates whether a CatalogModifierList supports multiple selections. +type CatalogModifierListSelectionType string + +const ( + CatalogModifierListSelectionTypeSingle CatalogModifierListSelectionType = "SINGLE" + CatalogModifierListSelectionTypeMultiple CatalogModifierListSelectionType = "MULTIPLE" +) + +func NewCatalogModifierListSelectionTypeFromString(s string) (CatalogModifierListSelectionType, error) { + switch s { + case "SINGLE": + return CatalogModifierListSelectionTypeSingle, nil + case "MULTIPLE": + return CatalogModifierListSelectionTypeMultiple, nil + } + var t CatalogModifierListSelectionType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c CatalogModifierListSelectionType) Ptr() *CatalogModifierListSelectionType { + return &c +} + +// Options to control how to override the default behavior of the specified modifier. +type CatalogModifierOverride struct { + // The ID of the `CatalogModifier` whose default behavior is being overridden. + ModifierID string `json:"modifier_id" url:"modifier_id"` + // If `true`, this `CatalogModifier` should be selected by default for this `CatalogItem`. + OnByDefault *bool `json:"on_by_default,omitempty" url:"on_by_default,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogObjectDiningOption) GetExtraProperties() map[string]interface{} { +func (c *CatalogModifierOverride) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogObjectDiningOption) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogObjectDiningOption +func (c *CatalogModifierOverride) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogModifierOverride var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogObjectDiningOption(value) + *c = CatalogModifierOverride(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -9386,7 +10507,7 @@ func (c *CatalogObjectDiningOption) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogObjectDiningOption) String() string { +func (c *CatalogModifierOverride) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -9398,7 +10519,412 @@ func (c *CatalogObjectDiningOption) String() string { return fmt.Sprintf("%#v", c) } -type CatalogObjectDiscount struct { +// The wrapper object for the catalog entries of a given object type. +// +// Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object. +// +// For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance. +// +// In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance. +// +// For a more detailed discussion of the Catalog data model, please see the +// [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. +type CatalogObject struct { + Type string + Item *CatalogObjectItem + Image *CatalogObjectImage + Category *CatalogObjectCategory + ItemVariation *CatalogObjectItemVariation + Tax *CatalogObjectTax + Discount *CatalogObjectDiscount + ModifierList *CatalogObjectModifierList + Modifier *CatalogObjectModifier + DiningOption *CatalogObjectDiningOption + TaxExemption *CatalogObjectTaxExemption + ServiceCharge *CatalogObjectServiceCharge + PricingRule *CatalogObjectPricingRule + ProductSet *CatalogObjectProductSet + TimePeriod *CatalogObjectTimePeriod + MeasurementUnit *CatalogObjectMeasurementUnit + SubscriptionPlan *CatalogObjectSubscriptionPlan + ItemOption *CatalogObjectItemOption + ItemOptionVal *CatalogObjectItemOptionValue + CustomAttributeDefinition *CatalogObjectCustomAttributeDefinition + QuickAmountsSettings *CatalogObjectQuickAmountsSettings + Component *CatalogObjectComponent + Composition *CatalogObjectComposition + Resource *CatalogObjectResource + CheckoutLink *CatalogObjectCheckoutLink + Address *CatalogObjectAddress + SubscriptionProduct *CatalogObjectSubscriptionProduct +} + +func (c *CatalogObject) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + c.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", c) + } + switch unmarshaler.Type { + case "ITEM": + value := new(CatalogObjectItem) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.Item = value + case "IMAGE": + value := new(CatalogObjectImage) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.Image = value + case "CATEGORY": + value := new(CatalogObjectCategory) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.Category = value + case "ITEM_VARIATION": + value := new(CatalogObjectItemVariation) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.ItemVariation = value + case "TAX": + value := new(CatalogObjectTax) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.Tax = value + case "DISCOUNT": + value := new(CatalogObjectDiscount) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.Discount = value + case "MODIFIER_LIST": + value := new(CatalogObjectModifierList) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.ModifierList = value + case "MODIFIER": + value := new(CatalogObjectModifier) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.Modifier = value + case "DINING_OPTION": + value := new(CatalogObjectDiningOption) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.DiningOption = value + case "TAX_EXEMPTION": + value := new(CatalogObjectTaxExemption) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.TaxExemption = value + case "SERVICE_CHARGE": + value := new(CatalogObjectServiceCharge) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.ServiceCharge = value + case "PRICING_RULE": + value := new(CatalogObjectPricingRule) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.PricingRule = value + case "PRODUCT_SET": + value := new(CatalogObjectProductSet) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.ProductSet = value + case "TIME_PERIOD": + value := new(CatalogObjectTimePeriod) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.TimePeriod = value + case "MEASUREMENT_UNIT": + value := new(CatalogObjectMeasurementUnit) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.MeasurementUnit = value + case "SUBSCRIPTION_PLAN": + value := new(CatalogObjectSubscriptionPlan) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.SubscriptionPlan = value + case "ITEM_OPTION": + value := new(CatalogObjectItemOption) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.ItemOption = value + case "ITEM_OPTION_VAL": + value := new(CatalogObjectItemOptionValue) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.ItemOptionVal = value + case "CUSTOM_ATTRIBUTE_DEFINITION": + value := new(CatalogObjectCustomAttributeDefinition) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.CustomAttributeDefinition = value + case "QUICK_AMOUNTS_SETTINGS": + value := new(CatalogObjectQuickAmountsSettings) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.QuickAmountsSettings = value + case "COMPONENT": + value := new(CatalogObjectComponent) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.Component = value + case "COMPOSITION": + value := new(CatalogObjectComposition) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.Composition = value + case "RESOURCE": + value := new(CatalogObjectResource) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.Resource = value + case "CHECKOUT_LINK": + value := new(CatalogObjectCheckoutLink) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.CheckoutLink = value + case "ADDRESS": + value := new(CatalogObjectAddress) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.Address = value + case "SUBSCRIPTION_PRODUCT": + value := new(CatalogObjectSubscriptionProduct) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.SubscriptionProduct = value + } + return nil +} + +func (c CatalogObject) MarshalJSON() ([]byte, error) { + if c.Item != nil { + return core.MarshalJSONWithExtraProperty(c.Item, "type", "ITEM") + } + if c.Image != nil { + return core.MarshalJSONWithExtraProperty(c.Image, "type", "IMAGE") + } + if c.Category != nil { + return core.MarshalJSONWithExtraProperty(c.Category, "type", "CATEGORY") + } + if c.ItemVariation != nil { + return core.MarshalJSONWithExtraProperty(c.ItemVariation, "type", "ITEM_VARIATION") + } + if c.Tax != nil { + return core.MarshalJSONWithExtraProperty(c.Tax, "type", "TAX") + } + if c.Discount != nil { + return core.MarshalJSONWithExtraProperty(c.Discount, "type", "DISCOUNT") + } + if c.ModifierList != nil { + return core.MarshalJSONWithExtraProperty(c.ModifierList, "type", "MODIFIER_LIST") + } + if c.Modifier != nil { + return core.MarshalJSONWithExtraProperty(c.Modifier, "type", "MODIFIER") + } + if c.DiningOption != nil { + return core.MarshalJSONWithExtraProperty(c.DiningOption, "type", "DINING_OPTION") + } + if c.TaxExemption != nil { + return core.MarshalJSONWithExtraProperty(c.TaxExemption, "type", "TAX_EXEMPTION") + } + if c.ServiceCharge != nil { + return core.MarshalJSONWithExtraProperty(c.ServiceCharge, "type", "SERVICE_CHARGE") + } + if c.PricingRule != nil { + return core.MarshalJSONWithExtraProperty(c.PricingRule, "type", "PRICING_RULE") + } + if c.ProductSet != nil { + return core.MarshalJSONWithExtraProperty(c.ProductSet, "type", "PRODUCT_SET") + } + if c.TimePeriod != nil { + return core.MarshalJSONWithExtraProperty(c.TimePeriod, "type", "TIME_PERIOD") + } + if c.MeasurementUnit != nil { + return core.MarshalJSONWithExtraProperty(c.MeasurementUnit, "type", "MEASUREMENT_UNIT") + } + if c.SubscriptionPlan != nil { + return core.MarshalJSONWithExtraProperty(c.SubscriptionPlan, "type", "SUBSCRIPTION_PLAN") + } + if c.ItemOption != nil { + return core.MarshalJSONWithExtraProperty(c.ItemOption, "type", "ITEM_OPTION") + } + if c.ItemOptionVal != nil { + return core.MarshalJSONWithExtraProperty(c.ItemOptionVal, "type", "ITEM_OPTION_VAL") + } + if c.CustomAttributeDefinition != nil { + return core.MarshalJSONWithExtraProperty(c.CustomAttributeDefinition, "type", "CUSTOM_ATTRIBUTE_DEFINITION") + } + if c.QuickAmountsSettings != nil { + return core.MarshalJSONWithExtraProperty(c.QuickAmountsSettings, "type", "QUICK_AMOUNTS_SETTINGS") + } + if c.Component != nil { + return core.MarshalJSONWithExtraProperty(c.Component, "type", "COMPONENT") + } + if c.Composition != nil { + return core.MarshalJSONWithExtraProperty(c.Composition, "type", "COMPOSITION") + } + if c.Resource != nil { + return core.MarshalJSONWithExtraProperty(c.Resource, "type", "RESOURCE") + } + if c.CheckoutLink != nil { + return core.MarshalJSONWithExtraProperty(c.CheckoutLink, "type", "CHECKOUT_LINK") + } + if c.Address != nil { + return core.MarshalJSONWithExtraProperty(c.Address, "type", "ADDRESS") + } + if c.SubscriptionProduct != nil { + return core.MarshalJSONWithExtraProperty(c.SubscriptionProduct, "type", "SUBSCRIPTION_PRODUCT") + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", c) +} + +type CatalogObjectVisitor interface { + VisitItem(*CatalogObjectItem) error + VisitImage(*CatalogObjectImage) error + VisitCategory(*CatalogObjectCategory) error + VisitItemVariation(*CatalogObjectItemVariation) error + VisitTax(*CatalogObjectTax) error + VisitDiscount(*CatalogObjectDiscount) error + VisitModifierList(*CatalogObjectModifierList) error + VisitModifier(*CatalogObjectModifier) error + VisitDiningOption(*CatalogObjectDiningOption) error + VisitTaxExemption(*CatalogObjectTaxExemption) error + VisitServiceCharge(*CatalogObjectServiceCharge) error + VisitPricingRule(*CatalogObjectPricingRule) error + VisitProductSet(*CatalogObjectProductSet) error + VisitTimePeriod(*CatalogObjectTimePeriod) error + VisitMeasurementUnit(*CatalogObjectMeasurementUnit) error + VisitSubscriptionPlan(*CatalogObjectSubscriptionPlan) error + VisitItemOption(*CatalogObjectItemOption) error + VisitItemOptionVal(*CatalogObjectItemOptionValue) error + VisitCustomAttributeDefinition(*CatalogObjectCustomAttributeDefinition) error + VisitQuickAmountsSettings(*CatalogObjectQuickAmountsSettings) error + VisitComponent(*CatalogObjectComponent) error + VisitComposition(*CatalogObjectComposition) error + VisitResource(*CatalogObjectResource) error + VisitCheckoutLink(*CatalogObjectCheckoutLink) error + VisitAddress(*CatalogObjectAddress) error + VisitSubscriptionProduct(*CatalogObjectSubscriptionProduct) error +} + +func (c *CatalogObject) Accept(visitor CatalogObjectVisitor) error { + if c.Item != nil { + return visitor.VisitItem(c.Item) + } + if c.Image != nil { + return visitor.VisitImage(c.Image) + } + if c.Category != nil { + return visitor.VisitCategory(c.Category) + } + if c.ItemVariation != nil { + return visitor.VisitItemVariation(c.ItemVariation) + } + if c.Tax != nil { + return visitor.VisitTax(c.Tax) + } + if c.Discount != nil { + return visitor.VisitDiscount(c.Discount) + } + if c.ModifierList != nil { + return visitor.VisitModifierList(c.ModifierList) + } + if c.Modifier != nil { + return visitor.VisitModifier(c.Modifier) + } + if c.DiningOption != nil { + return visitor.VisitDiningOption(c.DiningOption) + } + if c.TaxExemption != nil { + return visitor.VisitTaxExemption(c.TaxExemption) + } + if c.ServiceCharge != nil { + return visitor.VisitServiceCharge(c.ServiceCharge) + } + if c.PricingRule != nil { + return visitor.VisitPricingRule(c.PricingRule) + } + if c.ProductSet != nil { + return visitor.VisitProductSet(c.ProductSet) + } + if c.TimePeriod != nil { + return visitor.VisitTimePeriod(c.TimePeriod) + } + if c.MeasurementUnit != nil { + return visitor.VisitMeasurementUnit(c.MeasurementUnit) + } + if c.SubscriptionPlan != nil { + return visitor.VisitSubscriptionPlan(c.SubscriptionPlan) + } + if c.ItemOption != nil { + return visitor.VisitItemOption(c.ItemOption) + } + if c.ItemOptionVal != nil { + return visitor.VisitItemOptionVal(c.ItemOptionVal) + } + if c.CustomAttributeDefinition != nil { + return visitor.VisitCustomAttributeDefinition(c.CustomAttributeDefinition) + } + if c.QuickAmountsSettings != nil { + return visitor.VisitQuickAmountsSettings(c.QuickAmountsSettings) + } + if c.Component != nil { + return visitor.VisitComponent(c.Component) + } + if c.Composition != nil { + return visitor.VisitComposition(c.Composition) + } + if c.Resource != nil { + return visitor.VisitResource(c.Resource) + } + if c.CheckoutLink != nil { + return visitor.VisitCheckoutLink(c.CheckoutLink) + } + if c.Address != nil { + return visitor.VisitAddress(c.Address) + } + if c.SubscriptionProduct != nil { + return visitor.VisitSubscriptionProduct(c.SubscriptionProduct) + } + return fmt.Errorf("type %T does not define a non-empty union type", c) +} + +type CatalogObjectAddress struct { // An identifier to reference this object in the catalog. When a new `CatalogObject` // is inserted, the client should set the id to a temporary identifier starting with // a "`#`" character. Other objects being inserted or updated within the same request @@ -9449,24 +10975,22 @@ type CatalogObjectDiscount struct { AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` // Identifies the `CatalogImage` attached to this `CatalogObject`. ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` - // Structured data for a `CatalogDiscount`, set for CatalogObjects of type `DISCOUNT`. - DiscountData *CatalogDiscount `json:"discount_data,omitempty" url:"discount_data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogObjectDiscount) GetExtraProperties() map[string]interface{} { +func (c *CatalogObjectAddress) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogObjectDiscount) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogObjectDiscount +func (c *CatalogObjectAddress) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogObjectAddress var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogObjectDiscount(value) + *c = CatalogObjectAddress(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -9478,7 +11002,7 @@ func (c *CatalogObjectDiscount) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogObjectDiscount) String() string { +func (c *CatalogObjectAddress) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -9490,7 +11014,7 @@ func (c *CatalogObjectDiscount) String() string { return fmt.Sprintf("%#v", c) } -type CatalogObjectImage struct { +type CatalogObjectBase struct { // An identifier to reference this object in the catalog. When a new `CatalogObject` // is inserted, the client should set the id to a temporary identifier starting with // a "`#`" character. Other objects being inserted or updated within the same request @@ -9541,24 +11065,22 @@ type CatalogObjectImage struct { AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` // Identifies the `CatalogImage` attached to this `CatalogObject`. ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` - // Structured data for a `CatalogImage`, set for CatalogObjects of type `IMAGE`. - ImageData *CatalogImage `json:"image_data,omitempty" url:"image_data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogObjectImage) GetExtraProperties() map[string]interface{} { +func (c *CatalogObjectBase) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogObjectImage) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogObjectImage +func (c *CatalogObjectBase) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogObjectBase var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogObjectImage(value) + *c = CatalogObjectBase(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -9570,7 +11092,7 @@ func (c *CatalogObjectImage) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogObjectImage) String() string { +func (c *CatalogObjectBase) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -9582,7 +11104,141 @@ func (c *CatalogObjectImage) String() string { return fmt.Sprintf("%#v", c) } -type CatalogObjectItem struct { +// A batch of catalog objects. +type CatalogObjectBatch struct { + // A list of CatalogObjects belonging to this batch. + Objects []*CatalogObject `json:"objects,omitempty" url:"objects,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CatalogObjectBatch) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CatalogObjectBatch) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogObjectBatch + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CatalogObjectBatch(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CatalogObjectBatch) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// A category that can be assigned to an item or a parent category that can be assigned +// to another category. For example, a clothing category can be assigned to a t-shirt item or +// be made as the parent category to the pants category. +type CatalogObjectCategory struct { + // The ID of the object's category. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The order of the object within the context of the category. + Ordinal *int64 `json:"ordinal,omitempty" url:"ordinal,omitempty"` + // Structured data for a `CatalogCategory`, set for CatalogObjects of type `CATEGORY`. + CategoryData *CatalogCategory `json:"category_data,omitempty" url:"category_data,omitempty"` + // Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` + // would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // The version of the object. When updating an object, the version supplied + // must match the version in the database, otherwise the write will be rejected as conflicting. + Version *int64 `json:"version,omitempty" url:"version,omitempty"` + // If `true`, the object has been deleted from the database. Must be `false` for new objects + // being inserted. When deleted, the `updated_at` field will equal the deletion time. + IsDeleted *bool `json:"is_deleted,omitempty" url:"is_deleted,omitempty"` + // A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair + // is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute + // value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) + // object defined by the application making the request. + // + // If the `CatalogCustomAttributeDefinition` object is + // defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by + // the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of + // `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` + // if the application making the request is different from the application defining the custom attribute definition. + // Otherwise, the key used in the map is simply `"cocoa_brand"`. + // + // Application-defined custom attributes are set at a global (location-independent) level. + // Custom attribute values are intended to store additional information about a catalog object + // or associations with an entity in another system. Do not use custom attributes + // to store any sensitive information (personally identifiable information, card details, etc.). + CustomAttributeValues map[string]*CatalogCustomAttributeValue `json:"custom_attribute_values,omitempty" url:"custom_attribute_values,omitempty"` + // The Connect v1 IDs for this object at each location where it is present, where they + // differ from the object's Connect V2 ID. The field will only be present for objects that + // have been created or modified by legacy APIs. + CatalogV1IDs []*CatalogV1ID `json:"catalog_v1_ids,omitempty" url:"catalog_v1_ids,omitempty"` + // If `true`, this object is present at all locations (including future locations), except where specified in + // the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), + // except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. + PresentAtAllLocations *bool `json:"present_at_all_locations,omitempty" url:"present_at_all_locations,omitempty"` + // A list of locations where the object is present, even if `present_at_all_locations` is `false`. + // This can include locations that are deactivated. + PresentAtLocationIDs []string `json:"present_at_location_ids,omitempty" url:"present_at_location_ids,omitempty"` + // A list of locations where the object is not present, even if `present_at_all_locations` is `true`. + // This can include locations that are deactivated. + AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` + // Identifies the `CatalogImage` attached to this `CatalogObject`. + ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CatalogObjectCategory) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CatalogObjectCategory) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogObjectCategory + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CatalogObjectCategory(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CatalogObjectCategory) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +type CatalogObjectCheckoutLink struct { // An identifier to reference this object in the catalog. When a new `CatalogObject` // is inserted, the client should set the id to a temporary identifier starting with // a "`#`" character. Other objects being inserted or updated within the same request @@ -9633,24 +11289,22 @@ type CatalogObjectItem struct { AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` // Identifies the `CatalogImage` attached to this `CatalogObject`. ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` - // Structured data for a `CatalogItem`, set for CatalogObjects of type `ITEM`. - ItemData *CatalogItem `json:"item_data,omitempty" url:"item_data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogObjectItem) GetExtraProperties() map[string]interface{} { +func (c *CatalogObjectCheckoutLink) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogObjectItem) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogObjectItem +func (c *CatalogObjectCheckoutLink) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogObjectCheckoutLink var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogObjectItem(value) + *c = CatalogObjectCheckoutLink(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -9662,7 +11316,7 @@ func (c *CatalogObjectItem) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogObjectItem) String() string { +func (c *CatalogObjectCheckoutLink) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -9674,7 +11328,7 @@ func (c *CatalogObjectItem) String() string { return fmt.Sprintf("%#v", c) } -type CatalogObjectItemOption struct { +type CatalogObjectComponent struct { // An identifier to reference this object in the catalog. When a new `CatalogObject` // is inserted, the client should set the id to a temporary identifier starting with // a "`#`" character. Other objects being inserted or updated within the same request @@ -9725,24 +11379,22 @@ type CatalogObjectItemOption struct { AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` // Identifies the `CatalogImage` attached to this `CatalogObject`. ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` - // Structured data for a `CatalogItemOption`, set for CatalogObjects of type `ITEM_OPTION`. - ItemOptionData *CatalogItemOption `json:"item_option_data,omitempty" url:"item_option_data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogObjectItemOption) GetExtraProperties() map[string]interface{} { +func (c *CatalogObjectComponent) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogObjectItemOption) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogObjectItemOption +func (c *CatalogObjectComponent) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogObjectComponent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogObjectItemOption(value) + *c = CatalogObjectComponent(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -9754,7 +11406,7 @@ func (c *CatalogObjectItemOption) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogObjectItemOption) String() string { +func (c *CatalogObjectComponent) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -9766,7 +11418,7 @@ func (c *CatalogObjectItemOption) String() string { return fmt.Sprintf("%#v", c) } -type CatalogObjectItemOptionValue struct { +type CatalogObjectComposition struct { // An identifier to reference this object in the catalog. When a new `CatalogObject` // is inserted, the client should set the id to a temporary identifier starting with // a "`#`" character. Other objects being inserted or updated within the same request @@ -9817,24 +11469,22 @@ type CatalogObjectItemOptionValue struct { AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` // Identifies the `CatalogImage` attached to this `CatalogObject`. ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` - // Structured data for a `CatalogItemOptionValue`, set for CatalogObjects of type `ITEM_OPTION_VAL`. - ItemOptionValueData *CatalogItemOptionValue `json:"item_option_value_data,omitempty" url:"item_option_value_data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogObjectItemOptionValue) GetExtraProperties() map[string]interface{} { +func (c *CatalogObjectComposition) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogObjectItemOptionValue) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogObjectItemOptionValue +func (c *CatalogObjectComposition) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogObjectComposition var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogObjectItemOptionValue(value) + *c = CatalogObjectComposition(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -9846,7 +11496,7 @@ func (c *CatalogObjectItemOptionValue) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogObjectItemOptionValue) String() string { +func (c *CatalogObjectComposition) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -9858,7 +11508,7 @@ func (c *CatalogObjectItemOptionValue) String() string { return fmt.Sprintf("%#v", c) } -type CatalogObjectItemVariation struct { +type CatalogObjectCustomAttributeDefinition struct { // An identifier to reference this object in the catalog. When a new `CatalogObject` // is inserted, the client should set the id to a temporary identifier starting with // a "`#`" character. Other objects being inserted or updated within the same request @@ -9909,24 +11559,24 @@ type CatalogObjectItemVariation struct { AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` // Identifies the `CatalogImage` attached to this `CatalogObject`. ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` - // Structured data for a `CatalogItemVariation`, set for CatalogObjects of type `ITEM_VARIATION`. - ItemVariationData *CatalogItemVariation `json:"item_variation_data,omitempty" url:"item_variation_data,omitempty"` + // Structured data for a `CatalogCustomAttributeDefinition`, set for CatalogObjects of type `CUSTOM_ATTRIBUTE_DEFINITION`. + CustomAttributeDefinitionData *CatalogCustomAttributeDefinition `json:"custom_attribute_definition_data,omitempty" url:"custom_attribute_definition_data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogObjectItemVariation) GetExtraProperties() map[string]interface{} { +func (c *CatalogObjectCustomAttributeDefinition) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogObjectItemVariation) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogObjectItemVariation +func (c *CatalogObjectCustomAttributeDefinition) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogObjectCustomAttributeDefinition var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogObjectItemVariation(value) + *c = CatalogObjectCustomAttributeDefinition(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -9938,7 +11588,7 @@ func (c *CatalogObjectItemVariation) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogObjectItemVariation) String() string { +func (c *CatalogObjectCustomAttributeDefinition) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -9950,7 +11600,7 @@ func (c *CatalogObjectItemVariation) String() string { return fmt.Sprintf("%#v", c) } -type CatalogObjectMeasurementUnit struct { +type CatalogObjectDiningOption struct { // An identifier to reference this object in the catalog. When a new `CatalogObject` // is inserted, the client should set the id to a temporary identifier starting with // a "`#`" character. Other objects being inserted or updated within the same request @@ -10001,24 +11651,22 @@ type CatalogObjectMeasurementUnit struct { AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` // Identifies the `CatalogImage` attached to this `CatalogObject`. ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` - // Structured data for a `CatalogMeasurementUnit`, set for CatalogObjects of type `MEASUREMENT_UNIT`. - MeasurementUnitData *CatalogMeasurementUnit `json:"measurement_unit_data,omitempty" url:"measurement_unit_data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogObjectMeasurementUnit) GetExtraProperties() map[string]interface{} { +func (c *CatalogObjectDiningOption) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogObjectMeasurementUnit) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogObjectMeasurementUnit +func (c *CatalogObjectDiningOption) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogObjectDiningOption var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogObjectMeasurementUnit(value) + *c = CatalogObjectDiningOption(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -10030,7 +11678,7 @@ func (c *CatalogObjectMeasurementUnit) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogObjectMeasurementUnit) String() string { +func (c *CatalogObjectDiningOption) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -10042,7 +11690,7 @@ func (c *CatalogObjectMeasurementUnit) String() string { return fmt.Sprintf("%#v", c) } -type CatalogObjectModifier struct { +type CatalogObjectDiscount struct { // An identifier to reference this object in the catalog. When a new `CatalogObject` // is inserted, the client should set the id to a temporary identifier starting with // a "`#`" character. Other objects being inserted or updated within the same request @@ -10093,24 +11741,24 @@ type CatalogObjectModifier struct { AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` // Identifies the `CatalogImage` attached to this `CatalogObject`. ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` - // Structured data for a `CatalogModifier`, set for CatalogObjects of type `MODIFIER`. - ModifierData *CatalogModifier `json:"modifier_data,omitempty" url:"modifier_data,omitempty"` + // Structured data for a `CatalogDiscount`, set for CatalogObjects of type `DISCOUNT`. + DiscountData *CatalogDiscount `json:"discount_data,omitempty" url:"discount_data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogObjectModifier) GetExtraProperties() map[string]interface{} { +func (c *CatalogObjectDiscount) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogObjectModifier) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogObjectModifier +func (c *CatalogObjectDiscount) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogObjectDiscount var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogObjectModifier(value) + *c = CatalogObjectDiscount(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -10122,7 +11770,7 @@ func (c *CatalogObjectModifier) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogObjectModifier) String() string { +func (c *CatalogObjectDiscount) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -10134,7 +11782,7 @@ func (c *CatalogObjectModifier) String() string { return fmt.Sprintf("%#v", c) } -type CatalogObjectModifierList struct { +type CatalogObjectImage struct { // An identifier to reference this object in the catalog. When a new `CatalogObject` // is inserted, the client should set the id to a temporary identifier starting with // a "`#`" character. Other objects being inserted or updated within the same request @@ -10185,24 +11833,24 @@ type CatalogObjectModifierList struct { AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` // Identifies the `CatalogImage` attached to this `CatalogObject`. ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` - // Structured data for a `CatalogModifierList`, set for CatalogObjects of type `MODIFIER_LIST`. - ModifierListData *CatalogModifierList `json:"modifier_list_data,omitempty" url:"modifier_list_data,omitempty"` + // Structured data for a `CatalogImage`, set for CatalogObjects of type `IMAGE`. + ImageData *CatalogImage `json:"image_data,omitempty" url:"image_data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogObjectModifierList) GetExtraProperties() map[string]interface{} { +func (c *CatalogObjectImage) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogObjectModifierList) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogObjectModifierList +func (c *CatalogObjectImage) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogObjectImage var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogObjectModifierList(value) + *c = CatalogObjectImage(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -10214,7 +11862,7 @@ func (c *CatalogObjectModifierList) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogObjectModifierList) String() string { +func (c *CatalogObjectImage) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -10226,7 +11874,7 @@ func (c *CatalogObjectModifierList) String() string { return fmt.Sprintf("%#v", c) } -type CatalogObjectPricingRule struct { +type CatalogObjectItem struct { // An identifier to reference this object in the catalog. When a new `CatalogObject` // is inserted, the client should set the id to a temporary identifier starting with // a "`#`" character. Other objects being inserted or updated within the same request @@ -10277,25 +11925,24 @@ type CatalogObjectPricingRule struct { AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` // Identifies the `CatalogImage` attached to this `CatalogObject`. ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` - // Structured data for a `CatalogPricingRule`, set for CatalogObjects of type `PRICING_RULE`. - // A `CatalogPricingRule` object often works with a `CatalogProductSet` object or a `CatalogTimePeriod` object. - PricingRuleData *CatalogPricingRule `json:"pricing_rule_data,omitempty" url:"pricing_rule_data,omitempty"` + // Structured data for a `CatalogItem`, set for CatalogObjects of type `ITEM`. + ItemData *CatalogItem `json:"item_data,omitempty" url:"item_data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogObjectPricingRule) GetExtraProperties() map[string]interface{} { +func (c *CatalogObjectItem) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogObjectPricingRule) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogObjectPricingRule +func (c *CatalogObjectItem) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogObjectItem var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogObjectPricingRule(value) + *c = CatalogObjectItem(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -10307,7 +11954,7 @@ func (c *CatalogObjectPricingRule) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogObjectPricingRule) String() string { +func (c *CatalogObjectItem) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -10319,7 +11966,7 @@ func (c *CatalogObjectPricingRule) String() string { return fmt.Sprintf("%#v", c) } -type CatalogObjectProductSet struct { +type CatalogObjectItemOption struct { // An identifier to reference this object in the catalog. When a new `CatalogObject` // is inserted, the client should set the id to a temporary identifier starting with // a "`#`" character. Other objects being inserted or updated within the same request @@ -10370,24 +12017,24 @@ type CatalogObjectProductSet struct { AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` // Identifies the `CatalogImage` attached to this `CatalogObject`. ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` - // Structured data for a `CatalogProductSet`, set for CatalogObjects of type `PRODUCT_SET`. - ProductSetData *CatalogProductSet `json:"product_set_data,omitempty" url:"product_set_data,omitempty"` + // Structured data for a `CatalogItemOption`, set for CatalogObjects of type `ITEM_OPTION`. + ItemOptionData *CatalogItemOption `json:"item_option_data,omitempty" url:"item_option_data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogObjectProductSet) GetExtraProperties() map[string]interface{} { +func (c *CatalogObjectItemOption) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogObjectProductSet) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogObjectProductSet +func (c *CatalogObjectItemOption) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogObjectItemOption var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogObjectProductSet(value) + *c = CatalogObjectItemOption(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -10399,7 +12046,7 @@ func (c *CatalogObjectProductSet) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogObjectProductSet) String() string { +func (c *CatalogObjectItemOption) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -10411,7 +12058,7 @@ func (c *CatalogObjectProductSet) String() string { return fmt.Sprintf("%#v", c) } -type CatalogObjectQuickAmountsSettings struct { +type CatalogObjectItemOptionValue struct { // An identifier to reference this object in the catalog. When a new `CatalogObject` // is inserted, the client should set the id to a temporary identifier starting with // a "`#`" character. Other objects being inserted or updated within the same request @@ -10462,24 +12109,24 @@ type CatalogObjectQuickAmountsSettings struct { AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` // Identifies the `CatalogImage` attached to this `CatalogObject`. ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` - // Structured data for a `CatalogQuickAmountsSettings`, set for CatalogObjects of type `QUICK_AMOUNTS_SETTINGS`. - QuickAmountsSettingsData *CatalogQuickAmountsSettings `json:"quick_amounts_settings_data,omitempty" url:"quick_amounts_settings_data,omitempty"` + // Structured data for a `CatalogItemOptionValue`, set for CatalogObjects of type `ITEM_OPTION_VAL`. + ItemOptionValueData *CatalogItemOptionValue `json:"item_option_value_data,omitempty" url:"item_option_value_data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogObjectQuickAmountsSettings) GetExtraProperties() map[string]interface{} { +func (c *CatalogObjectItemOptionValue) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogObjectQuickAmountsSettings) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogObjectQuickAmountsSettings +func (c *CatalogObjectItemOptionValue) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogObjectItemOptionValue var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogObjectQuickAmountsSettings(value) + *c = CatalogObjectItemOptionValue(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -10491,7 +12138,7 @@ func (c *CatalogObjectQuickAmountsSettings) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogObjectQuickAmountsSettings) String() string { +func (c *CatalogObjectItemOptionValue) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -10503,30 +12150,75 @@ func (c *CatalogObjectQuickAmountsSettings) String() string { return fmt.Sprintf("%#v", c) } -// A reference to a Catalog object at a specific version. In general this is -// used as an entry point into a graph of catalog objects, where the objects exist -// at a specific version. -type CatalogObjectReference struct { - // The ID of the referenced object. - ObjectID *string `json:"object_id,omitempty" url:"object_id,omitempty"` - // The version of the object. - CatalogVersion *int64 `json:"catalog_version,omitempty" url:"catalog_version,omitempty"` +type CatalogObjectItemVariation struct { + // An identifier to reference this object in the catalog. When a new `CatalogObject` + // is inserted, the client should set the id to a temporary identifier starting with + // a "`#`" character. Other objects being inserted or updated within the same request + // may use this identifier to refer to the new object. + // + // When the server receives the new object, it will supply a unique identifier that + // replaces the temporary identifier for all future references. + ID string `json:"id" url:"id"` + // Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` + // would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // The version of the object. When updating an object, the version supplied + // must match the version in the database, otherwise the write will be rejected as conflicting. + Version *int64 `json:"version,omitempty" url:"version,omitempty"` + // If `true`, the object has been deleted from the database. Must be `false` for new objects + // being inserted. When deleted, the `updated_at` field will equal the deletion time. + IsDeleted *bool `json:"is_deleted,omitempty" url:"is_deleted,omitempty"` + // A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair + // is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute + // value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) + // object defined by the application making the request. + // + // If the `CatalogCustomAttributeDefinition` object is + // defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by + // the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of + // `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` + // if the application making the request is different from the application defining the custom attribute definition. + // Otherwise, the key used in the map is simply `"cocoa_brand"`. + // + // Application-defined custom attributes are set at a global (location-independent) level. + // Custom attribute values are intended to store additional information about a catalog object + // or associations with an entity in another system. Do not use custom attributes + // to store any sensitive information (personally identifiable information, card details, etc.). + CustomAttributeValues map[string]*CatalogCustomAttributeValue `json:"custom_attribute_values,omitempty" url:"custom_attribute_values,omitempty"` + // The Connect v1 IDs for this object at each location where it is present, where they + // differ from the object's Connect V2 ID. The field will only be present for objects that + // have been created or modified by legacy APIs. + CatalogV1IDs []*CatalogV1ID `json:"catalog_v1_ids,omitempty" url:"catalog_v1_ids,omitempty"` + // If `true`, this object is present at all locations (including future locations), except where specified in + // the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), + // except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. + PresentAtAllLocations *bool `json:"present_at_all_locations,omitempty" url:"present_at_all_locations,omitempty"` + // A list of locations where the object is present, even if `present_at_all_locations` is `false`. + // This can include locations that are deactivated. + PresentAtLocationIDs []string `json:"present_at_location_ids,omitempty" url:"present_at_location_ids,omitempty"` + // A list of locations where the object is not present, even if `present_at_all_locations` is `true`. + // This can include locations that are deactivated. + AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` + // Identifies the `CatalogImage` attached to this `CatalogObject`. + ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` + // Structured data for a `CatalogItemVariation`, set for CatalogObjects of type `ITEM_VARIATION`. + ItemVariationData *CatalogItemVariation `json:"item_variation_data,omitempty" url:"item_variation_data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogObjectReference) GetExtraProperties() map[string]interface{} { +func (c *CatalogObjectItemVariation) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogObjectReference) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogObjectReference +func (c *CatalogObjectItemVariation) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogObjectItemVariation var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogObjectReference(value) + *c = CatalogObjectItemVariation(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -10538,7 +12230,7 @@ func (c *CatalogObjectReference) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogObjectReference) String() string { +func (c *CatalogObjectItemVariation) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -10550,7 +12242,7 @@ func (c *CatalogObjectReference) String() string { return fmt.Sprintf("%#v", c) } -type CatalogObjectResource struct { +type CatalogObjectMeasurementUnit struct { // An identifier to reference this object in the catalog. When a new `CatalogObject` // is inserted, the client should set the id to a temporary identifier starting with // a "`#`" character. Other objects being inserted or updated within the same request @@ -10601,22 +12293,24 @@ type CatalogObjectResource struct { AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` // Identifies the `CatalogImage` attached to this `CatalogObject`. ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` + // Structured data for a `CatalogMeasurementUnit`, set for CatalogObjects of type `MEASUREMENT_UNIT`. + MeasurementUnitData *CatalogMeasurementUnit `json:"measurement_unit_data,omitempty" url:"measurement_unit_data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogObjectResource) GetExtraProperties() map[string]interface{} { +func (c *CatalogObjectMeasurementUnit) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogObjectResource) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogObjectResource +func (c *CatalogObjectMeasurementUnit) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogObjectMeasurementUnit var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogObjectResource(value) + *c = CatalogObjectMeasurementUnit(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -10628,7 +12322,7 @@ func (c *CatalogObjectResource) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogObjectResource) String() string { +func (c *CatalogObjectMeasurementUnit) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -10640,7 +12334,7 @@ func (c *CatalogObjectResource) String() string { return fmt.Sprintf("%#v", c) } -type CatalogObjectServiceCharge struct { +type CatalogObjectModifier struct { // An identifier to reference this object in the catalog. When a new `CatalogObject` // is inserted, the client should set the id to a temporary identifier starting with // a "`#`" character. Other objects being inserted or updated within the same request @@ -10691,22 +12385,24 @@ type CatalogObjectServiceCharge struct { AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` // Identifies the `CatalogImage` attached to this `CatalogObject`. ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` + // Structured data for a `CatalogModifier`, set for CatalogObjects of type `MODIFIER`. + ModifierData *CatalogModifier `json:"modifier_data,omitempty" url:"modifier_data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogObjectServiceCharge) GetExtraProperties() map[string]interface{} { +func (c *CatalogObjectModifier) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogObjectServiceCharge) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogObjectServiceCharge +func (c *CatalogObjectModifier) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogObjectModifier var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogObjectServiceCharge(value) + *c = CatalogObjectModifier(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -10718,7 +12414,7 @@ func (c *CatalogObjectServiceCharge) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogObjectServiceCharge) String() string { +func (c *CatalogObjectModifier) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -10730,7 +12426,7 @@ func (c *CatalogObjectServiceCharge) String() string { return fmt.Sprintf("%#v", c) } -type CatalogObjectSubscriptionPlan struct { +type CatalogObjectModifierList struct { // An identifier to reference this object in the catalog. When a new `CatalogObject` // is inserted, the client should set the id to a temporary identifier starting with // a "`#`" character. Other objects being inserted or updated within the same request @@ -10781,24 +12477,24 @@ type CatalogObjectSubscriptionPlan struct { AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` // Identifies the `CatalogImage` attached to this `CatalogObject`. ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` - // Structured data for a `CatalogSubscriptionPlan`, set for CatalogObjects of type `SUBSCRIPTION_PLAN`. - SubscriptionPlanData *CatalogSubscriptionPlan `json:"subscription_plan_data,omitempty" url:"subscription_plan_data,omitempty"` + // Structured data for a `CatalogModifierList`, set for CatalogObjects of type `MODIFIER_LIST`. + ModifierListData *CatalogModifierList `json:"modifier_list_data,omitempty" url:"modifier_list_data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogObjectSubscriptionPlan) GetExtraProperties() map[string]interface{} { +func (c *CatalogObjectModifierList) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogObjectSubscriptionPlan) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogObjectSubscriptionPlan +func (c *CatalogObjectModifierList) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogObjectModifierList var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogObjectSubscriptionPlan(value) + *c = CatalogObjectModifierList(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -10810,7 +12506,7 @@ func (c *CatalogObjectSubscriptionPlan) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogObjectSubscriptionPlan) String() string { +func (c *CatalogObjectModifierList) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -10822,7 +12518,7 @@ func (c *CatalogObjectSubscriptionPlan) String() string { return fmt.Sprintf("%#v", c) } -type CatalogObjectSubscriptionProduct struct { +type CatalogObjectPricingRule struct { // An identifier to reference this object in the catalog. When a new `CatalogObject` // is inserted, the client should set the id to a temporary identifier starting with // a "`#`" character. Other objects being inserted or updated within the same request @@ -10873,22 +12569,25 @@ type CatalogObjectSubscriptionProduct struct { AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` // Identifies the `CatalogImage` attached to this `CatalogObject`. ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` + // Structured data for a `CatalogPricingRule`, set for CatalogObjects of type `PRICING_RULE`. + // A `CatalogPricingRule` object often works with a `CatalogProductSet` object or a `CatalogTimePeriod` object. + PricingRuleData *CatalogPricingRule `json:"pricing_rule_data,omitempty" url:"pricing_rule_data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogObjectSubscriptionProduct) GetExtraProperties() map[string]interface{} { +func (c *CatalogObjectPricingRule) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogObjectSubscriptionProduct) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogObjectSubscriptionProduct +func (c *CatalogObjectPricingRule) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogObjectPricingRule var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogObjectSubscriptionProduct(value) + *c = CatalogObjectPricingRule(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -10900,7 +12599,7 @@ func (c *CatalogObjectSubscriptionProduct) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogObjectSubscriptionProduct) String() string { +func (c *CatalogObjectPricingRule) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -10912,7 +12611,7 @@ func (c *CatalogObjectSubscriptionProduct) String() string { return fmt.Sprintf("%#v", c) } -type CatalogObjectTax struct { +type CatalogObjectProductSet struct { // An identifier to reference this object in the catalog. When a new `CatalogObject` // is inserted, the client should set the id to a temporary identifier starting with // a "`#`" character. Other objects being inserted or updated within the same request @@ -10963,24 +12662,24 @@ type CatalogObjectTax struct { AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` // Identifies the `CatalogImage` attached to this `CatalogObject`. ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` - // Structured data for a `CatalogTax`, set for CatalogObjects of type `TAX`. - TaxData *CatalogTax `json:"tax_data,omitempty" url:"tax_data,omitempty"` + // Structured data for a `CatalogProductSet`, set for CatalogObjects of type `PRODUCT_SET`. + ProductSetData *CatalogProductSet `json:"product_set_data,omitempty" url:"product_set_data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogObjectTax) GetExtraProperties() map[string]interface{} { +func (c *CatalogObjectProductSet) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogObjectTax) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogObjectTax +func (c *CatalogObjectProductSet) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogObjectProductSet var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogObjectTax(value) + *c = CatalogObjectProductSet(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -10992,7 +12691,7 @@ func (c *CatalogObjectTax) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogObjectTax) String() string { +func (c *CatalogObjectProductSet) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -11004,7 +12703,7 @@ func (c *CatalogObjectTax) String() string { return fmt.Sprintf("%#v", c) } -type CatalogObjectTaxExemption struct { +type CatalogObjectQuickAmountsSettings struct { // An identifier to reference this object in the catalog. When a new `CatalogObject` // is inserted, the client should set the id to a temporary identifier starting with // a "`#`" character. Other objects being inserted or updated within the same request @@ -11055,22 +12754,24 @@ type CatalogObjectTaxExemption struct { AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` // Identifies the `CatalogImage` attached to this `CatalogObject`. ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` + // Structured data for a `CatalogQuickAmountsSettings`, set for CatalogObjects of type `QUICK_AMOUNTS_SETTINGS`. + QuickAmountsSettingsData *CatalogQuickAmountsSettings `json:"quick_amounts_settings_data,omitempty" url:"quick_amounts_settings_data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogObjectTaxExemption) GetExtraProperties() map[string]interface{} { +func (c *CatalogObjectQuickAmountsSettings) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogObjectTaxExemption) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogObjectTaxExemption +func (c *CatalogObjectQuickAmountsSettings) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogObjectQuickAmountsSettings var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogObjectTaxExemption(value) + *c = CatalogObjectQuickAmountsSettings(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -11082,7 +12783,7 @@ func (c *CatalogObjectTaxExemption) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogObjectTaxExemption) String() string { +func (c *CatalogObjectQuickAmountsSettings) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -11094,7 +12795,54 @@ func (c *CatalogObjectTaxExemption) String() string { return fmt.Sprintf("%#v", c) } -type CatalogObjectTimePeriod struct { +// A reference to a Catalog object at a specific version. In general this is +// used as an entry point into a graph of catalog objects, where the objects exist +// at a specific version. +type CatalogObjectReference struct { + // The ID of the referenced object. + ObjectID *string `json:"object_id,omitempty" url:"object_id,omitempty"` + // The version of the object. + CatalogVersion *int64 `json:"catalog_version,omitempty" url:"catalog_version,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CatalogObjectReference) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CatalogObjectReference) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogObjectReference + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CatalogObjectReference(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CatalogObjectReference) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +type CatalogObjectResource struct { // An identifier to reference this object in the catalog. When a new `CatalogObject` // is inserted, the client should set the id to a temporary identifier starting with // a "`#`" character. Other objects being inserted or updated within the same request @@ -11145,24 +12893,22 @@ type CatalogObjectTimePeriod struct { AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` // Identifies the `CatalogImage` attached to this `CatalogObject`. ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` - // Structured data for a `CatalogTimePeriod`, set for CatalogObjects of type `TIME_PERIOD`. - TimePeriodData *CatalogTimePeriod `json:"time_period_data,omitempty" url:"time_period_data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogObjectTimePeriod) GetExtraProperties() map[string]interface{} { +func (c *CatalogObjectResource) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogObjectTimePeriod) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogObjectTimePeriod +func (c *CatalogObjectResource) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogObjectResource var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogObjectTimePeriod(value) + *c = CatalogObjectResource(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -11174,7 +12920,7 @@ func (c *CatalogObjectTimePeriod) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogObjectTimePeriod) String() string { +func (c *CatalogObjectResource) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -11186,154 +12932,73 @@ func (c *CatalogObjectTimePeriod) String() string { return fmt.Sprintf("%#v", c) } -// Possible types of CatalogObjects returned from the catalog, each -// containing type-specific properties in the `*_data` field corresponding to the specified object type. -type CatalogObjectType string - -const ( - CatalogObjectTypeItem CatalogObjectType = "ITEM" - CatalogObjectTypeImage CatalogObjectType = "IMAGE" - CatalogObjectTypeCategory CatalogObjectType = "CATEGORY" - CatalogObjectTypeItemVariation CatalogObjectType = "ITEM_VARIATION" - CatalogObjectTypeTax CatalogObjectType = "TAX" - CatalogObjectTypeDiscount CatalogObjectType = "DISCOUNT" - CatalogObjectTypeModifierList CatalogObjectType = "MODIFIER_LIST" - CatalogObjectTypeModifier CatalogObjectType = "MODIFIER" - CatalogObjectTypePricingRule CatalogObjectType = "PRICING_RULE" - CatalogObjectTypeProductSet CatalogObjectType = "PRODUCT_SET" - CatalogObjectTypeTimePeriod CatalogObjectType = "TIME_PERIOD" - CatalogObjectTypeMeasurementUnit CatalogObjectType = "MEASUREMENT_UNIT" - CatalogObjectTypeSubscriptionPlanVariation CatalogObjectType = "SUBSCRIPTION_PLAN_VARIATION" - CatalogObjectTypeItemOption CatalogObjectType = "ITEM_OPTION" - CatalogObjectTypeItemOptionVal CatalogObjectType = "ITEM_OPTION_VAL" - CatalogObjectTypeCustomAttributeDefinition CatalogObjectType = "CUSTOM_ATTRIBUTE_DEFINITION" - CatalogObjectTypeQuickAmountsSettings CatalogObjectType = "QUICK_AMOUNTS_SETTINGS" - CatalogObjectTypeSubscriptionPlan CatalogObjectType = "SUBSCRIPTION_PLAN" - CatalogObjectTypeAvailabilityPeriod CatalogObjectType = "AVAILABILITY_PERIOD" -) - -func NewCatalogObjectTypeFromString(s string) (CatalogObjectType, error) { - switch s { - case "ITEM": - return CatalogObjectTypeItem, nil - case "IMAGE": - return CatalogObjectTypeImage, nil - case "CATEGORY": - return CatalogObjectTypeCategory, nil - case "ITEM_VARIATION": - return CatalogObjectTypeItemVariation, nil - case "TAX": - return CatalogObjectTypeTax, nil - case "DISCOUNT": - return CatalogObjectTypeDiscount, nil - case "MODIFIER_LIST": - return CatalogObjectTypeModifierList, nil - case "MODIFIER": - return CatalogObjectTypeModifier, nil - case "PRICING_RULE": - return CatalogObjectTypePricingRule, nil - case "PRODUCT_SET": - return CatalogObjectTypeProductSet, nil - case "TIME_PERIOD": - return CatalogObjectTypeTimePeriod, nil - case "MEASUREMENT_UNIT": - return CatalogObjectTypeMeasurementUnit, nil - case "SUBSCRIPTION_PLAN_VARIATION": - return CatalogObjectTypeSubscriptionPlanVariation, nil - case "ITEM_OPTION": - return CatalogObjectTypeItemOption, nil - case "ITEM_OPTION_VAL": - return CatalogObjectTypeItemOptionVal, nil - case "CUSTOM_ATTRIBUTE_DEFINITION": - return CatalogObjectTypeCustomAttributeDefinition, nil - case "QUICK_AMOUNTS_SETTINGS": - return CatalogObjectTypeQuickAmountsSettings, nil - case "SUBSCRIPTION_PLAN": - return CatalogObjectTypeSubscriptionPlan, nil - case "AVAILABILITY_PERIOD": - return CatalogObjectTypeAvailabilityPeriod, nil - } - var t CatalogObjectType - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (c CatalogObjectType) Ptr() *CatalogObjectType { - return &c -} - -// Defines how discounts are automatically applied to a set of items that match the pricing rule -// during the active time period. -type CatalogPricingRule struct { - // User-defined name for the pricing rule. For example, "Buy one get one - // free" or "10% off". - Name *string `json:"name,omitempty" url:"name,omitempty"` - // A list of unique IDs for the catalog time periods when - // this pricing rule is in effect. If left unset, the pricing rule is always - // in effect. - TimePeriodIDs []string `json:"time_period_ids,omitempty" url:"time_period_ids,omitempty"` - // Unique ID for the `CatalogDiscount` to take off - // the price of all matched items. - DiscountID *string `json:"discount_id,omitempty" url:"discount_id,omitempty"` - // Unique ID for the `CatalogProductSet` that will be matched by this rule. A match rule - // matches within the entire cart, and can match multiple times. This field will always be set. - MatchProductsID *string `json:"match_products_id,omitempty" url:"match_products_id,omitempty"` - // **Deprecated**: Please use the `exclude_products_id` field to apply - // an exclude set instead. Exclude sets allow better control over quantity - // ranges and offer more flexibility for which matched items receive a discount. +type CatalogObjectServiceCharge struct { + // An identifier to reference this object in the catalog. When a new `CatalogObject` + // is inserted, the client should set the id to a temporary identifier starting with + // a "`#`" character. Other objects being inserted or updated within the same request + // may use this identifier to refer to the new object. // - // `CatalogProductSet` to apply the pricing to. - // An apply rule matches within the subset of the cart that fits the match rules (the match set). - // An apply rule can only match once in the match set. - // If not supplied, the pricing will be applied to all products in the match set. - // Other products retain their base price, or a price generated by other rules. - ApplyProductsID *string `json:"apply_products_id,omitempty" url:"apply_products_id,omitempty"` - // `CatalogProductSet` to exclude from the pricing rule. - // An exclude rule matches within the subset of the cart that fits the match rules (the match set). - // An exclude rule can only match once in the match set. - // If not supplied, the pricing will be applied to all products in the match set. - // Other products retain their base price, or a price generated by other rules. - ExcludeProductsID *string `json:"exclude_products_id,omitempty" url:"exclude_products_id,omitempty"` - // Represents the date the Pricing Rule is valid from. Represented in RFC 3339 full-date format (YYYY-MM-DD). - ValidFromDate *string `json:"valid_from_date,omitempty" url:"valid_from_date,omitempty"` - // Represents the local time the pricing rule should be valid from. Represented in RFC 3339 partial-time format - // (HH:MM:SS). Partial seconds will be truncated. - ValidFromLocalTime *string `json:"valid_from_local_time,omitempty" url:"valid_from_local_time,omitempty"` - // Represents the date the Pricing Rule is valid until. Represented in RFC 3339 full-date format (YYYY-MM-DD). - ValidUntilDate *string `json:"valid_until_date,omitempty" url:"valid_until_date,omitempty"` - // Represents the local time the pricing rule should be valid until. Represented in RFC 3339 partial-time format - // (HH:MM:SS). Partial seconds will be truncated. - ValidUntilLocalTime *string `json:"valid_until_local_time,omitempty" url:"valid_until_local_time,omitempty"` - // If an `exclude_products_id` was given, controls which subset of matched - // products is excluded from any discounts. + // When the server receives the new object, it will supply a unique identifier that + // replaces the temporary identifier for all future references. + ID string `json:"id" url:"id"` + // Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` + // would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // The version of the object. When updating an object, the version supplied + // must match the version in the database, otherwise the write will be rejected as conflicting. + Version *int64 `json:"version,omitempty" url:"version,omitempty"` + // If `true`, the object has been deleted from the database. Must be `false` for new objects + // being inserted. When deleted, the `updated_at` field will equal the deletion time. + IsDeleted *bool `json:"is_deleted,omitempty" url:"is_deleted,omitempty"` + // A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair + // is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute + // value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) + // object defined by the application making the request. // - // Default value: `LEAST_EXPENSIVE` - // See [ExcludeStrategy](#type-excludestrategy) for possible values - ExcludeStrategy *ExcludeStrategy `json:"exclude_strategy,omitempty" url:"exclude_strategy,omitempty"` - // The minimum order subtotal (before discounts or taxes are applied) - // that must be met before this rule may be applied. - MinimumOrderSubtotalMoney *Money `json:"minimum_order_subtotal_money,omitempty" url:"minimum_order_subtotal_money,omitempty"` - // A list of IDs of customer groups, the members of which are eligible for discounts specified in this pricing rule. - // Notice that a group ID is generated by the Customers API. - // If this field is not set, the specified discount applies to matched products sold to anyone whether the buyer - // has a customer profile created or not. If this `customer_group_ids_any` field is set, the specified discount - // applies only to matched products sold to customers belonging to the specified customer groups. - CustomerGroupIDsAny []string `json:"customer_group_ids_any,omitempty" url:"customer_group_ids_any,omitempty"` + // If the `CatalogCustomAttributeDefinition` object is + // defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by + // the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of + // `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` + // if the application making the request is different from the application defining the custom attribute definition. + // Otherwise, the key used in the map is simply `"cocoa_brand"`. + // + // Application-defined custom attributes are set at a global (location-independent) level. + // Custom attribute values are intended to store additional information about a catalog object + // or associations with an entity in another system. Do not use custom attributes + // to store any sensitive information (personally identifiable information, card details, etc.). + CustomAttributeValues map[string]*CatalogCustomAttributeValue `json:"custom_attribute_values,omitempty" url:"custom_attribute_values,omitempty"` + // The Connect v1 IDs for this object at each location where it is present, where they + // differ from the object's Connect V2 ID. The field will only be present for objects that + // have been created or modified by legacy APIs. + CatalogV1IDs []*CatalogV1ID `json:"catalog_v1_ids,omitempty" url:"catalog_v1_ids,omitempty"` + // If `true`, this object is present at all locations (including future locations), except where specified in + // the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), + // except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. + PresentAtAllLocations *bool `json:"present_at_all_locations,omitempty" url:"present_at_all_locations,omitempty"` + // A list of locations where the object is present, even if `present_at_all_locations` is `false`. + // This can include locations that are deactivated. + PresentAtLocationIDs []string `json:"present_at_location_ids,omitempty" url:"present_at_location_ids,omitempty"` + // A list of locations where the object is not present, even if `present_at_all_locations` is `true`. + // This can include locations that are deactivated. + AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` + // Identifies the `CatalogImage` attached to this `CatalogObject`. + ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogPricingRule) GetExtraProperties() map[string]interface{} { +func (c *CatalogObjectServiceCharge) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogPricingRule) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogPricingRule +func (c *CatalogObjectServiceCharge) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogObjectServiceCharge var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogPricingRule(value) + *c = CatalogObjectServiceCharge(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -11345,7 +13010,7 @@ func (c *CatalogPricingRule) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogPricingRule) String() string { +func (c *CatalogObjectServiceCharge) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -11357,87 +13022,75 @@ func (c *CatalogPricingRule) String() string { return fmt.Sprintf("%#v", c) } -// Indicates whether the price of a CatalogItemVariation should be entered manually at the time of sale. -type CatalogPricingType string - -const ( - CatalogPricingTypeFixedPricing CatalogPricingType = "FIXED_PRICING" - CatalogPricingTypeVariablePricing CatalogPricingType = "VARIABLE_PRICING" -) - -func NewCatalogPricingTypeFromString(s string) (CatalogPricingType, error) { - switch s { - case "FIXED_PRICING": - return CatalogPricingTypeFixedPricing, nil - case "VARIABLE_PRICING": - return CatalogPricingTypeVariablePricing, nil - } - var t CatalogPricingType - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (c CatalogPricingType) Ptr() *CatalogPricingType { - return &c -} - -// Represents a collection of catalog objects for the purpose of applying a -// `PricingRule`. Including a catalog object will include all of its subtypes. -// For example, including a category in a product set will include all of its -// items and associated item variations in the product set. Including an item in -// a product set will also include its item variations. -type CatalogProductSet struct { - // User-defined name for the product set. For example, "Clearance Items" - // or "Winter Sale Items". - Name *string `json:"name,omitempty" url:"name,omitempty"` - // Unique IDs for any `CatalogObject` included in this product set. Any - // number of these catalog objects can be in an order for a pricing rule to apply. - // - // This can be used with `product_ids_all` in a parent `CatalogProductSet` to - // match groups of products for a bulk discount, such as a discount for an - // entree and side combo. - // - // Only one of `product_ids_all`, `product_ids_any`, or `all_products` can be set. +type CatalogObjectSubscriptionPlan struct { + // An identifier to reference this object in the catalog. When a new `CatalogObject` + // is inserted, the client should set the id to a temporary identifier starting with + // a "`#`" character. Other objects being inserted or updated within the same request + // may use this identifier to refer to the new object. // - // Max: 500 catalog object IDs. - ProductIDsAny []string `json:"product_ids_any,omitempty" url:"product_ids_any,omitempty"` - // Unique IDs for any `CatalogObject` included in this product set. - // All objects in this set must be included in an order for a pricing rule to apply. + // When the server receives the new object, it will supply a unique identifier that + // replaces the temporary identifier for all future references. + ID string `json:"id" url:"id"` + // Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` + // would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // The version of the object. When updating an object, the version supplied + // must match the version in the database, otherwise the write will be rejected as conflicting. + Version *int64 `json:"version,omitempty" url:"version,omitempty"` + // If `true`, the object has been deleted from the database. Must be `false` for new objects + // being inserted. When deleted, the `updated_at` field will equal the deletion time. + IsDeleted *bool `json:"is_deleted,omitempty" url:"is_deleted,omitempty"` + // A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair + // is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute + // value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) + // object defined by the application making the request. // - // Only one of `product_ids_all`, `product_ids_any`, or `all_products` can be set. + // If the `CatalogCustomAttributeDefinition` object is + // defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by + // the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of + // `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` + // if the application making the request is different from the application defining the custom attribute definition. + // Otherwise, the key used in the map is simply `"cocoa_brand"`. // - // Max: 500 catalog object IDs. - ProductIDsAll []string `json:"product_ids_all,omitempty" url:"product_ids_all,omitempty"` - // If set, there must be exactly this many items from `products_any` or `products_all` - // in the cart for the discount to apply. - // - // Cannot be combined with either `quantity_min` or `quantity_max`. - QuantityExact *int64 `json:"quantity_exact,omitempty" url:"quantity_exact,omitempty"` - // If set, there must be at least this many items from `products_any` or `products_all` - // in a cart for the discount to apply. See `quantity_exact`. Defaults to 0 if - // `quantity_exact`, `quantity_min` and `quantity_max` are all unspecified. - QuantityMin *int64 `json:"quantity_min,omitempty" url:"quantity_min,omitempty"` - // If set, the pricing rule will apply to a maximum of this many items from - // `products_any` or `products_all`. - QuantityMax *int64 `json:"quantity_max,omitempty" url:"quantity_max,omitempty"` - // If set to `true`, the product set will include every item in the catalog. - // Only one of `product_ids_all`, `product_ids_any`, or `all_products` can be set. - AllProducts *bool `json:"all_products,omitempty" url:"all_products,omitempty"` + // Application-defined custom attributes are set at a global (location-independent) level. + // Custom attribute values are intended to store additional information about a catalog object + // or associations with an entity in another system. Do not use custom attributes + // to store any sensitive information (personally identifiable information, card details, etc.). + CustomAttributeValues map[string]*CatalogCustomAttributeValue `json:"custom_attribute_values,omitempty" url:"custom_attribute_values,omitempty"` + // The Connect v1 IDs for this object at each location where it is present, where they + // differ from the object's Connect V2 ID. The field will only be present for objects that + // have been created or modified by legacy APIs. + CatalogV1IDs []*CatalogV1ID `json:"catalog_v1_ids,omitempty" url:"catalog_v1_ids,omitempty"` + // If `true`, this object is present at all locations (including future locations), except where specified in + // the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), + // except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. + PresentAtAllLocations *bool `json:"present_at_all_locations,omitempty" url:"present_at_all_locations,omitempty"` + // A list of locations where the object is present, even if `present_at_all_locations` is `false`. + // This can include locations that are deactivated. + PresentAtLocationIDs []string `json:"present_at_location_ids,omitempty" url:"present_at_location_ids,omitempty"` + // A list of locations where the object is not present, even if `present_at_all_locations` is `true`. + // This can include locations that are deactivated. + AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` + // Identifies the `CatalogImage` attached to this `CatalogObject`. + ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` + // Structured data for a `CatalogSubscriptionPlan`, set for CatalogObjects of type `SUBSCRIPTION_PLAN`. + SubscriptionPlanData *CatalogSubscriptionPlan `json:"subscription_plan_data,omitempty" url:"subscription_plan_data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogProductSet) GetExtraProperties() map[string]interface{} { +func (c *CatalogObjectSubscriptionPlan) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogProductSet) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogProductSet +func (c *CatalogObjectSubscriptionPlan) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogObjectSubscriptionPlan var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogProductSet(value) + *c = CatalogObjectSubscriptionPlan(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -11449,7 +13102,7 @@ func (c *CatalogProductSet) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogProductSet) String() string { +func (c *CatalogObjectSubscriptionPlan) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -11461,80 +13114,73 @@ func (c *CatalogProductSet) String() string { return fmt.Sprintf("%#v", c) } -// A query composed of one or more different types of filters to narrow the scope of targeted objects when calling the `SearchCatalogObjects` endpoint. -// -// Although a query can have multiple filters, only certain query types can be combined per call to [SearchCatalogObjects]($e/Catalog/SearchCatalogObjects). -// Any combination of the following types may be used together: -// -// - [exact_query]($m/CatalogQueryExact) -// - [prefix_query]($m/CatalogQueryPrefix) -// - [range_query]($m/CatalogQueryRange) -// - [sorted_attribute_query]($m/CatalogQuerySortedAttribute) -// - [text_query]($m/CatalogQueryText) -// -// All other query types cannot be combined with any others. -// -// When a query filter is based on an attribute, the attribute must be searchable. -// Searchable attributes are listed as follows, along their parent types that can be searched for with applicable query filters. -// -// Searchable attribute and objects queryable by searchable attributes: -// -// - `name`: `CatalogItem`, `CatalogItemVariation`, `CatalogCategory`, `CatalogTax`, `CatalogDiscount`, `CatalogModifier`, `CatalogModifierList`, `CatalogItemOption`, `CatalogItemOptionValue` -// - `description`: `CatalogItem`, `CatalogItemOptionValue` -// - `abbreviation`: `CatalogItem` -// - `upc`: `CatalogItemVariation` -// - `sku`: `CatalogItemVariation` -// - `caption`: `CatalogImage` -// - `display_name`: `CatalogItemOption` -// -// For example, to search for [CatalogItem]($m/CatalogItem) objects by searchable attributes, you can use -// the `"name"`, `"description"`, or `"abbreviation"` attribute in an applicable query filter. -type CatalogQuery struct { - // A query expression to sort returned query result by the given attribute. - SortedAttributeQuery *CatalogQuerySortedAttribute `json:"sorted_attribute_query,omitempty" url:"sorted_attribute_query,omitempty"` - // An exact query expression to return objects with attribute name and value - // matching the specified attribute name and value exactly. Value matching is case insensitive. - ExactQuery *CatalogQueryExact `json:"exact_query,omitempty" url:"exact_query,omitempty"` - // A set query expression to return objects with attribute name and value - // matching the specified attribute name and any of the specified attribute values exactly. - // Value matching is case insensitive. - SetQuery *CatalogQuerySet `json:"set_query,omitempty" url:"set_query,omitempty"` - // A prefix query expression to return objects with attribute values - // that have a prefix matching the specified string value. Value matching is case insensitive. - PrefixQuery *CatalogQueryPrefix `json:"prefix_query,omitempty" url:"prefix_query,omitempty"` - // A range query expression to return objects with numeric values - // that lie in the specified range. - RangeQuery *CatalogQueryRange `json:"range_query,omitempty" url:"range_query,omitempty"` - // A text query expression to return objects whose searchable attributes contain all of the given - // keywords, irrespective of their order. For example, if a `CatalogItem` contains custom attribute values of - // `{"name": "t-shirt"}` and `{"description": "Small, Purple"}`, the query filter of `{"keywords": ["shirt", "sma", "purp"]}` - // returns this item. - TextQuery *CatalogQueryText `json:"text_query,omitempty" url:"text_query,omitempty"` - // A query expression to return items that have any of the specified taxes (as identified by the corresponding `CatalogTax` object IDs) enabled. - ItemsForTaxQuery *CatalogQueryItemsForTax `json:"items_for_tax_query,omitempty" url:"items_for_tax_query,omitempty"` - // A query expression to return items that have any of the given modifier list (as identified by the corresponding `CatalogModifierList`s IDs) enabled. - ItemsForModifierListQuery *CatalogQueryItemsForModifierList `json:"items_for_modifier_list_query,omitempty" url:"items_for_modifier_list_query,omitempty"` - // A query expression to return items that contains the specified item options (as identified the corresponding `CatalogItemOption` IDs). - ItemsForItemOptionsQuery *CatalogQueryItemsForItemOptions `json:"items_for_item_options_query,omitempty" url:"items_for_item_options_query,omitempty"` - // A query expression to return item variations (of the [CatalogItemVariation](entity:CatalogItemVariation) type) that - // contain all of the specified `CatalogItemOption` IDs. - ItemVariationsForItemOptionValuesQuery *CatalogQueryItemVariationsForItemOptionValues `json:"item_variations_for_item_option_values_query,omitempty" url:"item_variations_for_item_option_values_query,omitempty"` +type CatalogObjectSubscriptionProduct struct { + // An identifier to reference this object in the catalog. When a new `CatalogObject` + // is inserted, the client should set the id to a temporary identifier starting with + // a "`#`" character. Other objects being inserted or updated within the same request + // may use this identifier to refer to the new object. + // + // When the server receives the new object, it will supply a unique identifier that + // replaces the temporary identifier for all future references. + ID string `json:"id" url:"id"` + // Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` + // would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // The version of the object. When updating an object, the version supplied + // must match the version in the database, otherwise the write will be rejected as conflicting. + Version *int64 `json:"version,omitempty" url:"version,omitempty"` + // If `true`, the object has been deleted from the database. Must be `false` for new objects + // being inserted. When deleted, the `updated_at` field will equal the deletion time. + IsDeleted *bool `json:"is_deleted,omitempty" url:"is_deleted,omitempty"` + // A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair + // is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute + // value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) + // object defined by the application making the request. + // + // If the `CatalogCustomAttributeDefinition` object is + // defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by + // the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of + // `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` + // if the application making the request is different from the application defining the custom attribute definition. + // Otherwise, the key used in the map is simply `"cocoa_brand"`. + // + // Application-defined custom attributes are set at a global (location-independent) level. + // Custom attribute values are intended to store additional information about a catalog object + // or associations with an entity in another system. Do not use custom attributes + // to store any sensitive information (personally identifiable information, card details, etc.). + CustomAttributeValues map[string]*CatalogCustomAttributeValue `json:"custom_attribute_values,omitempty" url:"custom_attribute_values,omitempty"` + // The Connect v1 IDs for this object at each location where it is present, where they + // differ from the object's Connect V2 ID. The field will only be present for objects that + // have been created or modified by legacy APIs. + CatalogV1IDs []*CatalogV1ID `json:"catalog_v1_ids,omitempty" url:"catalog_v1_ids,omitempty"` + // If `true`, this object is present at all locations (including future locations), except where specified in + // the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), + // except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. + PresentAtAllLocations *bool `json:"present_at_all_locations,omitempty" url:"present_at_all_locations,omitempty"` + // A list of locations where the object is present, even if `present_at_all_locations` is `false`. + // This can include locations that are deactivated. + PresentAtLocationIDs []string `json:"present_at_location_ids,omitempty" url:"present_at_location_ids,omitempty"` + // A list of locations where the object is not present, even if `present_at_all_locations` is `true`. + // This can include locations that are deactivated. + AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` + // Identifies the `CatalogImage` attached to this `CatalogObject`. + ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogQuery) GetExtraProperties() map[string]interface{} { +func (c *CatalogObjectSubscriptionProduct) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogQuery) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogQuery +func (c *CatalogObjectSubscriptionProduct) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogObjectSubscriptionProduct var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogQuery(value) + *c = CatalogObjectSubscriptionProduct(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -11546,7 +13192,7 @@ func (c *CatalogQuery) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogQuery) String() string { +func (c *CatalogObjectSubscriptionProduct) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -11558,29 +13204,75 @@ func (c *CatalogQuery) String() string { return fmt.Sprintf("%#v", c) } -// The query filter to return the search result by exact match of the specified attribute name and value. -type CatalogQueryExact struct { - // The name of the attribute to be searched. Matching of the attribute name is exact. - AttributeName string `json:"attribute_name" url:"attribute_name"` - // The desired value of the search attribute. Matching of the attribute value is case insensitive and can be partial. - // For example, if a specified value of "sma", objects with the named attribute value of "Small", "small" are both matched. - AttributeValue string `json:"attribute_value" url:"attribute_value"` +type CatalogObjectTax struct { + // An identifier to reference this object in the catalog. When a new `CatalogObject` + // is inserted, the client should set the id to a temporary identifier starting with + // a "`#`" character. Other objects being inserted or updated within the same request + // may use this identifier to refer to the new object. + // + // When the server receives the new object, it will supply a unique identifier that + // replaces the temporary identifier for all future references. + ID string `json:"id" url:"id"` + // Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` + // would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // The version of the object. When updating an object, the version supplied + // must match the version in the database, otherwise the write will be rejected as conflicting. + Version *int64 `json:"version,omitempty" url:"version,omitempty"` + // If `true`, the object has been deleted from the database. Must be `false` for new objects + // being inserted. When deleted, the `updated_at` field will equal the deletion time. + IsDeleted *bool `json:"is_deleted,omitempty" url:"is_deleted,omitempty"` + // A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair + // is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute + // value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) + // object defined by the application making the request. + // + // If the `CatalogCustomAttributeDefinition` object is + // defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by + // the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of + // `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` + // if the application making the request is different from the application defining the custom attribute definition. + // Otherwise, the key used in the map is simply `"cocoa_brand"`. + // + // Application-defined custom attributes are set at a global (location-independent) level. + // Custom attribute values are intended to store additional information about a catalog object + // or associations with an entity in another system. Do not use custom attributes + // to store any sensitive information (personally identifiable information, card details, etc.). + CustomAttributeValues map[string]*CatalogCustomAttributeValue `json:"custom_attribute_values,omitempty" url:"custom_attribute_values,omitempty"` + // The Connect v1 IDs for this object at each location where it is present, where they + // differ from the object's Connect V2 ID. The field will only be present for objects that + // have been created or modified by legacy APIs. + CatalogV1IDs []*CatalogV1ID `json:"catalog_v1_ids,omitempty" url:"catalog_v1_ids,omitempty"` + // If `true`, this object is present at all locations (including future locations), except where specified in + // the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), + // except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. + PresentAtAllLocations *bool `json:"present_at_all_locations,omitempty" url:"present_at_all_locations,omitempty"` + // A list of locations where the object is present, even if `present_at_all_locations` is `false`. + // This can include locations that are deactivated. + PresentAtLocationIDs []string `json:"present_at_location_ids,omitempty" url:"present_at_location_ids,omitempty"` + // A list of locations where the object is not present, even if `present_at_all_locations` is `true`. + // This can include locations that are deactivated. + AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` + // Identifies the `CatalogImage` attached to this `CatalogObject`. + ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` + // Structured data for a `CatalogTax`, set for CatalogObjects of type `TAX`. + TaxData *CatalogTax `json:"tax_data,omitempty" url:"tax_data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogQueryExact) GetExtraProperties() map[string]interface{} { +func (c *CatalogObjectTax) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogQueryExact) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogQueryExact +func (c *CatalogObjectTax) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogObjectTax var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogQueryExact(value) + *c = CatalogObjectTax(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -11592,7 +13284,7 @@ func (c *CatalogQueryExact) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogQueryExact) String() string { +func (c *CatalogObjectTax) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -11604,28 +13296,73 @@ func (c *CatalogQueryExact) String() string { return fmt.Sprintf("%#v", c) } -// The query filter to return the item variations containing the specified item option value IDs. -type CatalogQueryItemVariationsForItemOptionValues struct { - // A set of `CatalogItemOptionValue` IDs to be used to find associated - // `CatalogItemVariation`s. All ItemVariations that contain all of the given - // Item Option Values (in any order) will be returned. - ItemOptionValueIDs []string `json:"item_option_value_ids,omitempty" url:"item_option_value_ids,omitempty"` +type CatalogObjectTaxExemption struct { + // An identifier to reference this object in the catalog. When a new `CatalogObject` + // is inserted, the client should set the id to a temporary identifier starting with + // a "`#`" character. Other objects being inserted or updated within the same request + // may use this identifier to refer to the new object. + // + // When the server receives the new object, it will supply a unique identifier that + // replaces the temporary identifier for all future references. + ID string `json:"id" url:"id"` + // Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` + // would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // The version of the object. When updating an object, the version supplied + // must match the version in the database, otherwise the write will be rejected as conflicting. + Version *int64 `json:"version,omitempty" url:"version,omitempty"` + // If `true`, the object has been deleted from the database. Must be `false` for new objects + // being inserted. When deleted, the `updated_at` field will equal the deletion time. + IsDeleted *bool `json:"is_deleted,omitempty" url:"is_deleted,omitempty"` + // A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair + // is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute + // value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) + // object defined by the application making the request. + // + // If the `CatalogCustomAttributeDefinition` object is + // defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by + // the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of + // `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` + // if the application making the request is different from the application defining the custom attribute definition. + // Otherwise, the key used in the map is simply `"cocoa_brand"`. + // + // Application-defined custom attributes are set at a global (location-independent) level. + // Custom attribute values are intended to store additional information about a catalog object + // or associations with an entity in another system. Do not use custom attributes + // to store any sensitive information (personally identifiable information, card details, etc.). + CustomAttributeValues map[string]*CatalogCustomAttributeValue `json:"custom_attribute_values,omitempty" url:"custom_attribute_values,omitempty"` + // The Connect v1 IDs for this object at each location where it is present, where they + // differ from the object's Connect V2 ID. The field will only be present for objects that + // have been created or modified by legacy APIs. + CatalogV1IDs []*CatalogV1ID `json:"catalog_v1_ids,omitempty" url:"catalog_v1_ids,omitempty"` + // If `true`, this object is present at all locations (including future locations), except where specified in + // the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), + // except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. + PresentAtAllLocations *bool `json:"present_at_all_locations,omitempty" url:"present_at_all_locations,omitempty"` + // A list of locations where the object is present, even if `present_at_all_locations` is `false`. + // This can include locations that are deactivated. + PresentAtLocationIDs []string `json:"present_at_location_ids,omitempty" url:"present_at_location_ids,omitempty"` + // A list of locations where the object is not present, even if `present_at_all_locations` is `true`. + // This can include locations that are deactivated. + AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` + // Identifies the `CatalogImage` attached to this `CatalogObject`. + ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogQueryItemVariationsForItemOptionValues) GetExtraProperties() map[string]interface{} { +func (c *CatalogObjectTaxExemption) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogQueryItemVariationsForItemOptionValues) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogQueryItemVariationsForItemOptionValues +func (c *CatalogObjectTaxExemption) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogObjectTaxExemption var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogQueryItemVariationsForItemOptionValues(value) + *c = CatalogObjectTaxExemption(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -11637,7 +13374,7 @@ func (c *CatalogQueryItemVariationsForItemOptionValues) UnmarshalJSON(data []byt return nil } -func (c *CatalogQueryItemVariationsForItemOptionValues) String() string { +func (c *CatalogObjectTaxExemption) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -11649,28 +13386,75 @@ func (c *CatalogQueryItemVariationsForItemOptionValues) String() string { return fmt.Sprintf("%#v", c) } -// The query filter to return the items containing the specified item option IDs. -type CatalogQueryItemsForItemOptions struct { - // A set of `CatalogItemOption` IDs to be used to find associated - // `CatalogItem`s. All Items that contain all of the given Item Options (in any order) - // will be returned. - ItemOptionIDs []string `json:"item_option_ids,omitempty" url:"item_option_ids,omitempty"` +type CatalogObjectTimePeriod struct { + // An identifier to reference this object in the catalog. When a new `CatalogObject` + // is inserted, the client should set the id to a temporary identifier starting with + // a "`#`" character. Other objects being inserted or updated within the same request + // may use this identifier to refer to the new object. + // + // When the server receives the new object, it will supply a unique identifier that + // replaces the temporary identifier for all future references. + ID string `json:"id" url:"id"` + // Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` + // would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // The version of the object. When updating an object, the version supplied + // must match the version in the database, otherwise the write will be rejected as conflicting. + Version *int64 `json:"version,omitempty" url:"version,omitempty"` + // If `true`, the object has been deleted from the database. Must be `false` for new objects + // being inserted. When deleted, the `updated_at` field will equal the deletion time. + IsDeleted *bool `json:"is_deleted,omitempty" url:"is_deleted,omitempty"` + // A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair + // is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute + // value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) + // object defined by the application making the request. + // + // If the `CatalogCustomAttributeDefinition` object is + // defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by + // the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of + // `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` + // if the application making the request is different from the application defining the custom attribute definition. + // Otherwise, the key used in the map is simply `"cocoa_brand"`. + // + // Application-defined custom attributes are set at a global (location-independent) level. + // Custom attribute values are intended to store additional information about a catalog object + // or associations with an entity in another system. Do not use custom attributes + // to store any sensitive information (personally identifiable information, card details, etc.). + CustomAttributeValues map[string]*CatalogCustomAttributeValue `json:"custom_attribute_values,omitempty" url:"custom_attribute_values,omitempty"` + // The Connect v1 IDs for this object at each location where it is present, where they + // differ from the object's Connect V2 ID. The field will only be present for objects that + // have been created or modified by legacy APIs. + CatalogV1IDs []*CatalogV1ID `json:"catalog_v1_ids,omitempty" url:"catalog_v1_ids,omitempty"` + // If `true`, this object is present at all locations (including future locations), except where specified in + // the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), + // except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. + PresentAtAllLocations *bool `json:"present_at_all_locations,omitempty" url:"present_at_all_locations,omitempty"` + // A list of locations where the object is present, even if `present_at_all_locations` is `false`. + // This can include locations that are deactivated. + PresentAtLocationIDs []string `json:"present_at_location_ids,omitempty" url:"present_at_location_ids,omitempty"` + // A list of locations where the object is not present, even if `present_at_all_locations` is `true`. + // This can include locations that are deactivated. + AbsentAtLocationIDs []string `json:"absent_at_location_ids,omitempty" url:"absent_at_location_ids,omitempty"` + // Identifies the `CatalogImage` attached to this `CatalogObject`. + ImageID *string `json:"image_id,omitempty" url:"image_id,omitempty"` + // Structured data for a `CatalogTimePeriod`, set for CatalogObjects of type `TIME_PERIOD`. + TimePeriodData *CatalogTimePeriod `json:"time_period_data,omitempty" url:"time_period_data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CatalogQueryItemsForItemOptions) GetExtraProperties() map[string]interface{} { +func (c *CatalogObjectTimePeriod) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *CatalogQueryItemsForItemOptions) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogQueryItemsForItemOptions +func (c *CatalogObjectTimePeriod) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogObjectTimePeriod var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CatalogQueryItemsForItemOptions(value) + *c = CatalogObjectTimePeriod(value) extraProperties, err := core.ExtractExtraProperties(data, *c) if err != nil { @@ -11682,7 +13466,7 @@ func (c *CatalogQueryItemsForItemOptions) UnmarshalJSON(data []byte) error { return nil } -func (c *CatalogQueryItemsForItemOptions) String() string { +func (c *CatalogObjectTimePeriod) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -11694,81 +13478,670 @@ func (c *CatalogQueryItemsForItemOptions) String() string { return fmt.Sprintf("%#v", c) } -// The query filter to return the items containing the specified modifier list IDs. -type CatalogQueryItemsForModifierList struct { - // A set of `CatalogModifierList` IDs to be used to find associated `CatalogItem`s. - ModifierListIDs []string `json:"modifier_list_ids,omitempty" url:"modifier_list_ids,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (c *CatalogQueryItemsForModifierList) GetExtraProperties() map[string]interface{} { - return c.extraProperties -} - -func (c *CatalogQueryItemsForModifierList) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogQueryItemsForModifierList - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *c = CatalogQueryItemsForModifierList(value) - - extraProperties, err := core.ExtractExtraProperties(data, *c) - if err != nil { - return err - } - c.extraProperties = extraProperties +// Possible types of CatalogObjects returned from the catalog, each +// containing type-specific properties in the `*_data` field corresponding to the specified object type. +type CatalogObjectType string - c._rawJSON = json.RawMessage(data) - return nil -} +const ( + CatalogObjectTypeCatalogObjectTypeDoNotUse CatalogObjectType = "CATALOG_OBJECT_TYPE_DO_NOT_USE" + CatalogObjectTypeItem CatalogObjectType = "ITEM" + CatalogObjectTypeImage CatalogObjectType = "IMAGE" + CatalogObjectTypePageTile CatalogObjectType = "PAGE_TILE" + CatalogObjectTypeCategory CatalogObjectType = "CATEGORY" + CatalogObjectTypeItemVariation CatalogObjectType = "ITEM_VARIATION" + CatalogObjectTypeTax CatalogObjectType = "TAX" + CatalogObjectTypePlaceholder CatalogObjectType = "PLACEHOLDER" + CatalogObjectTypeDiscount CatalogObjectType = "DISCOUNT" + CatalogObjectTypeModifierList CatalogObjectType = "MODIFIER_LIST" + CatalogObjectTypeModifier CatalogObjectType = "MODIFIER" + CatalogObjectTypeDiningOption CatalogObjectType = "DINING_OPTION" + CatalogObjectTypeTaxExemption CatalogObjectType = "TAX_EXEMPTION" + CatalogObjectTypeConfiguration CatalogObjectType = "CONFIGURATION" + CatalogObjectTypeTicketGroup CatalogObjectType = "TICKET_GROUP" + CatalogObjectTypeTicketTemplate CatalogObjectType = "TICKET_TEMPLATE" + CatalogObjectTypePage CatalogObjectType = "PAGE" + CatalogObjectTypeMenu CatalogObjectType = "MENU" + CatalogObjectTypeTag CatalogObjectType = "TAG" + CatalogObjectTypeFloorPlan CatalogObjectType = "FLOOR_PLAN" + CatalogObjectTypeFloorPlanTile CatalogObjectType = "FLOOR_PLAN_TILE" + CatalogObjectTypeVoidReason CatalogObjectType = "VOID_REASON" + CatalogObjectTypeFavoritesListPosition CatalogObjectType = "FAVORITES_LIST_POSITION" + CatalogObjectTypeMenuGroup CatalogObjectType = "MENU_GROUP" + CatalogObjectTypeItemVariationVendorInfo CatalogObjectType = "ITEM_VARIATION_VENDOR_INFO" + CatalogObjectTypeServiceCharge CatalogObjectType = "SERVICE_CHARGE" + CatalogObjectTypePricingRule CatalogObjectType = "PRICING_RULE" + CatalogObjectTypeProductSet CatalogObjectType = "PRODUCT_SET" + CatalogObjectTypeTimePeriod CatalogObjectType = "TIME_PERIOD" + CatalogObjectTypeMeasurementUnit CatalogObjectType = "MEASUREMENT_UNIT" + CatalogObjectTypeSubscriptionPlanVariation CatalogObjectType = "SUBSCRIPTION_PLAN_VARIATION" + CatalogObjectTypeItemOption CatalogObjectType = "ITEM_OPTION" + CatalogObjectTypeItemOptionVal CatalogObjectType = "ITEM_OPTION_VAL" + CatalogObjectTypeCustomAttributeDefinition CatalogObjectType = "CUSTOM_ATTRIBUTE_DEFINITION" + CatalogObjectTypeQuickAmountsSettings CatalogObjectType = "QUICK_AMOUNTS_SETTINGS" + CatalogObjectTypeComponent CatalogObjectType = "COMPONENT" + CatalogObjectTypeComposition CatalogObjectType = "COMPOSITION" + CatalogObjectTypeResource CatalogObjectType = "RESOURCE" + CatalogObjectTypeCheckoutLink CatalogObjectType = "CHECKOUT_LINK" + CatalogObjectTypeAddress CatalogObjectType = "ADDRESS" + CatalogObjectTypeSubscriptionPlan CatalogObjectType = "SUBSCRIPTION_PLAN" + CatalogObjectTypeAvailabilityPeriod CatalogObjectType = "AVAILABILITY_PERIOD" + CatalogObjectTypeCreditRedemptionPolicy CatalogObjectType = "CREDIT_REDEMPTION_POLICY" + CatalogObjectTypeAgeRestriction CatalogObjectType = "AGE_RESTRICTION" + CatalogObjectTypeSalePrice CatalogObjectType = "SALE_PRICE" + CatalogObjectTypeTaxCategory CatalogObjectType = "TAX_CATEGORY" +) -func (c *CatalogQueryItemsForModifierList) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(c); err == nil { - return value +func NewCatalogObjectTypeFromString(s string) (CatalogObjectType, error) { + switch s { + case "CATALOG_OBJECT_TYPE_DO_NOT_USE": + return CatalogObjectTypeCatalogObjectTypeDoNotUse, nil + case "ITEM": + return CatalogObjectTypeItem, nil + case "IMAGE": + return CatalogObjectTypeImage, nil + case "PAGE_TILE": + return CatalogObjectTypePageTile, nil + case "CATEGORY": + return CatalogObjectTypeCategory, nil + case "ITEM_VARIATION": + return CatalogObjectTypeItemVariation, nil + case "TAX": + return CatalogObjectTypeTax, nil + case "PLACEHOLDER": + return CatalogObjectTypePlaceholder, nil + case "DISCOUNT": + return CatalogObjectTypeDiscount, nil + case "MODIFIER_LIST": + return CatalogObjectTypeModifierList, nil + case "MODIFIER": + return CatalogObjectTypeModifier, nil + case "DINING_OPTION": + return CatalogObjectTypeDiningOption, nil + case "TAX_EXEMPTION": + return CatalogObjectTypeTaxExemption, nil + case "CONFIGURATION": + return CatalogObjectTypeConfiguration, nil + case "TICKET_GROUP": + return CatalogObjectTypeTicketGroup, nil + case "TICKET_TEMPLATE": + return CatalogObjectTypeTicketTemplate, nil + case "PAGE": + return CatalogObjectTypePage, nil + case "MENU": + return CatalogObjectTypeMenu, nil + case "TAG": + return CatalogObjectTypeTag, nil + case "FLOOR_PLAN": + return CatalogObjectTypeFloorPlan, nil + case "FLOOR_PLAN_TILE": + return CatalogObjectTypeFloorPlanTile, nil + case "VOID_REASON": + return CatalogObjectTypeVoidReason, nil + case "FAVORITES_LIST_POSITION": + return CatalogObjectTypeFavoritesListPosition, nil + case "MENU_GROUP": + return CatalogObjectTypeMenuGroup, nil + case "ITEM_VARIATION_VENDOR_INFO": + return CatalogObjectTypeItemVariationVendorInfo, nil + case "SERVICE_CHARGE": + return CatalogObjectTypeServiceCharge, nil + case "PRICING_RULE": + return CatalogObjectTypePricingRule, nil + case "PRODUCT_SET": + return CatalogObjectTypeProductSet, nil + case "TIME_PERIOD": + return CatalogObjectTypeTimePeriod, nil + case "MEASUREMENT_UNIT": + return CatalogObjectTypeMeasurementUnit, nil + case "SUBSCRIPTION_PLAN_VARIATION": + return CatalogObjectTypeSubscriptionPlanVariation, nil + case "ITEM_OPTION": + return CatalogObjectTypeItemOption, nil + case "ITEM_OPTION_VAL": + return CatalogObjectTypeItemOptionVal, nil + case "CUSTOM_ATTRIBUTE_DEFINITION": + return CatalogObjectTypeCustomAttributeDefinition, nil + case "QUICK_AMOUNTS_SETTINGS": + return CatalogObjectTypeQuickAmountsSettings, nil + case "COMPONENT": + return CatalogObjectTypeComponent, nil + case "COMPOSITION": + return CatalogObjectTypeComposition, nil + case "RESOURCE": + return CatalogObjectTypeResource, nil + case "CHECKOUT_LINK": + return CatalogObjectTypeCheckoutLink, nil + case "ADDRESS": + return CatalogObjectTypeAddress, nil + case "SUBSCRIPTION_PLAN": + return CatalogObjectTypeSubscriptionPlan, nil + case "AVAILABILITY_PERIOD": + return CatalogObjectTypeAvailabilityPeriod, nil + case "CREDIT_REDEMPTION_POLICY": + return CatalogObjectTypeCreditRedemptionPolicy, nil + case "AGE_RESTRICTION": + return CatalogObjectTypeAgeRestriction, nil + case "SALE_PRICE": + return CatalogObjectTypeSalePrice, nil + case "TAX_CATEGORY": + return CatalogObjectTypeTaxCategory, nil } - return fmt.Sprintf("%#v", c) -} - -// The query filter to return the items containing the specified tax IDs. -type CatalogQueryItemsForTax struct { - // A set of `CatalogTax` IDs to be used to find associated `CatalogItem`s. - TaxIDs []string `json:"tax_ids,omitempty" url:"tax_ids,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (c *CatalogQueryItemsForTax) GetExtraProperties() map[string]interface{} { - return c.extraProperties + var t CatalogObjectType + return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (c *CatalogQueryItemsForTax) UnmarshalJSON(data []byte) error { - type unmarshaler CatalogQueryItemsForTax - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *c = CatalogQueryItemsForTax(value) - - extraProperties, err := core.ExtractExtraProperties(data, *c) - if err != nil { - return err - } - c.extraProperties = extraProperties - - c._rawJSON = json.RawMessage(data) - return nil +func (c CatalogObjectType) Ptr() *CatalogObjectType { + return &c } -func (c *CatalogQueryItemsForTax) String() string { +// Defines how discounts are automatically applied to a set of items that match the pricing rule +// during the active time period. +type CatalogPricingRule struct { + // User-defined name for the pricing rule. For example, "Buy one get one + // free" or "10% off". + Name *string `json:"name,omitempty" url:"name,omitempty"` + // A list of unique IDs for the catalog time periods when + // this pricing rule is in effect. If left unset, the pricing rule is always + // in effect. + TimePeriodIDs []string `json:"time_period_ids,omitempty" url:"time_period_ids,omitempty"` + // Unique ID for the `CatalogDiscount` to take off + // the price of all matched items. + DiscountID *string `json:"discount_id,omitempty" url:"discount_id,omitempty"` + // Unique ID for the `CatalogProductSet` that will be matched by this rule. A match rule + // matches within the entire cart, and can match multiple times. This field will always be set. + MatchProductsID *string `json:"match_products_id,omitempty" url:"match_products_id,omitempty"` + // **Deprecated**: Please use the `exclude_products_id` field to apply + // an exclude set instead. Exclude sets allow better control over quantity + // ranges and offer more flexibility for which matched items receive a discount. + // + // `CatalogProductSet` to apply the pricing to. + // An apply rule matches within the subset of the cart that fits the match rules (the match set). + // An apply rule can only match once in the match set. + // If not supplied, the pricing will be applied to all products in the match set. + // Other products retain their base price, or a price generated by other rules. + ApplyProductsID *string `json:"apply_products_id,omitempty" url:"apply_products_id,omitempty"` + // `CatalogProductSet` to exclude from the pricing rule. + // An exclude rule matches within the subset of the cart that fits the match rules (the match set). + // An exclude rule can only match once in the match set. + // If not supplied, the pricing will be applied to all products in the match set. + // Other products retain their base price, or a price generated by other rules. + ExcludeProductsID *string `json:"exclude_products_id,omitempty" url:"exclude_products_id,omitempty"` + // Represents the date the Pricing Rule is valid from. Represented in RFC 3339 full-date format (YYYY-MM-DD). + ValidFromDate *string `json:"valid_from_date,omitempty" url:"valid_from_date,omitempty"` + // Represents the local time the pricing rule should be valid from. Represented in RFC 3339 partial-time format + // (HH:MM:SS). Partial seconds will be truncated. + ValidFromLocalTime *string `json:"valid_from_local_time,omitempty" url:"valid_from_local_time,omitempty"` + // Represents the date the Pricing Rule is valid until. Represented in RFC 3339 full-date format (YYYY-MM-DD). + ValidUntilDate *string `json:"valid_until_date,omitempty" url:"valid_until_date,omitempty"` + // Represents the local time the pricing rule should be valid until. Represented in RFC 3339 partial-time format + // (HH:MM:SS). Partial seconds will be truncated. + ValidUntilLocalTime *string `json:"valid_until_local_time,omitempty" url:"valid_until_local_time,omitempty"` + // If an `exclude_products_id` was given, controls which subset of matched + // products is excluded from any discounts. + // + // Default value: `LEAST_EXPENSIVE` + // See [ExcludeStrategy](#type-excludestrategy) for possible values + ExcludeStrategy *ExcludeStrategy `json:"exclude_strategy,omitempty" url:"exclude_strategy,omitempty"` + // The minimum order subtotal (before discounts or taxes are applied) + // that must be met before this rule may be applied. + MinimumOrderSubtotalMoney *Money `json:"minimum_order_subtotal_money,omitempty" url:"minimum_order_subtotal_money,omitempty"` + // A list of IDs of customer groups, the members of which are eligible for discounts specified in this pricing rule. + // Notice that a group ID is generated by the Customers API. + // If this field is not set, the specified discount applies to matched products sold to anyone whether the buyer + // has a customer profile created or not. If this `customer_group_ids_any` field is set, the specified discount + // applies only to matched products sold to customers belonging to the specified customer groups. + CustomerGroupIDsAny []string `json:"customer_group_ids_any,omitempty" url:"customer_group_ids_any,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CatalogPricingRule) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CatalogPricingRule) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogPricingRule + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CatalogPricingRule(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CatalogPricingRule) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Indicates whether the price of a CatalogItemVariation should be entered manually at the time of sale. +type CatalogPricingType string + +const ( + CatalogPricingTypeFixedPricing CatalogPricingType = "FIXED_PRICING" + CatalogPricingTypeVariablePricing CatalogPricingType = "VARIABLE_PRICING" +) + +func NewCatalogPricingTypeFromString(s string) (CatalogPricingType, error) { + switch s { + case "FIXED_PRICING": + return CatalogPricingTypeFixedPricing, nil + case "VARIABLE_PRICING": + return CatalogPricingTypeVariablePricing, nil + } + var t CatalogPricingType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c CatalogPricingType) Ptr() *CatalogPricingType { + return &c +} + +// Represents a collection of catalog objects for the purpose of applying a +// `PricingRule`. Including a catalog object will include all of its subtypes. +// For example, including a category in a product set will include all of its +// items and associated item variations in the product set. Including an item in +// a product set will also include its item variations. +type CatalogProductSet struct { + // User-defined name for the product set. For example, "Clearance Items" + // or "Winter Sale Items". + Name *string `json:"name,omitempty" url:"name,omitempty"` + // Unique IDs for any `CatalogObject` included in this product set. Any + // number of these catalog objects can be in an order for a pricing rule to apply. + // + // This can be used with `product_ids_all` in a parent `CatalogProductSet` to + // match groups of products for a bulk discount, such as a discount for an + // entree and side combo. + // + // Only one of `product_ids_all`, `product_ids_any`, or `all_products` can be set. + // + // Max: 500 catalog object IDs. + ProductIDsAny []string `json:"product_ids_any,omitempty" url:"product_ids_any,omitempty"` + // Unique IDs for any `CatalogObject` included in this product set. + // All objects in this set must be included in an order for a pricing rule to apply. + // + // Only one of `product_ids_all`, `product_ids_any`, or `all_products` can be set. + // + // Max: 500 catalog object IDs. + ProductIDsAll []string `json:"product_ids_all,omitempty" url:"product_ids_all,omitempty"` + // If set, there must be exactly this many items from `products_any` or `products_all` + // in the cart for the discount to apply. + // + // Cannot be combined with either `quantity_min` or `quantity_max`. + QuantityExact *int64 `json:"quantity_exact,omitempty" url:"quantity_exact,omitempty"` + // If set, there must be at least this many items from `products_any` or `products_all` + // in a cart for the discount to apply. See `quantity_exact`. Defaults to 0 if + // `quantity_exact`, `quantity_min` and `quantity_max` are all unspecified. + QuantityMin *int64 `json:"quantity_min,omitempty" url:"quantity_min,omitempty"` + // If set, the pricing rule will apply to a maximum of this many items from + // `products_any` or `products_all`. + QuantityMax *int64 `json:"quantity_max,omitempty" url:"quantity_max,omitempty"` + // If set to `true`, the product set will include every item in the catalog. + // Only one of `product_ids_all`, `product_ids_any`, or `all_products` can be set. + AllProducts *bool `json:"all_products,omitempty" url:"all_products,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CatalogProductSet) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CatalogProductSet) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogProductSet + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CatalogProductSet(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CatalogProductSet) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// A query composed of one or more different types of filters to narrow the scope of targeted objects when calling the `SearchCatalogObjects` endpoint. +// +// Although a query can have multiple filters, only certain query types can be combined per call to [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects). +// Any combination of the following types may be used together: +// +// - [exact_query](entity:CatalogQueryExact) +// - [prefix_query](entity:CatalogQueryPrefix) +// - [range_query](entity:CatalogQueryRange) +// - [sorted_attribute_query](entity:CatalogQuerySortedAttribute) +// - [text_query](entity:CatalogQueryText) +// +// All other query types cannot be combined with any others. +// +// When a query filter is based on an attribute, the attribute must be searchable. +// Searchable attributes are listed as follows, along their parent types that can be searched for with applicable query filters. +// +// Searchable attribute and objects queryable by searchable attributes: +// +// - `name`: `CatalogItem`, `CatalogItemVariation`, `CatalogCategory`, `CatalogTax`, `CatalogDiscount`, `CatalogModifier`, `CatalogModifierList`, `CatalogItemOption`, `CatalogItemOptionValue` +// - `description`: `CatalogItem`, `CatalogItemOptionValue` +// - `abbreviation`: `CatalogItem` +// - `upc`: `CatalogItemVariation` +// - `sku`: `CatalogItemVariation` +// - `caption`: `CatalogImage` +// - `display_name`: `CatalogItemOption` +// +// For example, to search for [CatalogItem](entity:CatalogItem) objects by searchable attributes, you can use +// the `"name"`, `"description"`, or `"abbreviation"` attribute in an applicable query filter. +type CatalogQuery struct { + // A query expression to sort returned query result by the given attribute. + SortedAttributeQuery *CatalogQuerySortedAttribute `json:"sorted_attribute_query,omitempty" url:"sorted_attribute_query,omitempty"` + // An exact query expression to return objects with attribute name and value + // matching the specified attribute name and value exactly. Value matching is case insensitive. + ExactQuery *CatalogQueryExact `json:"exact_query,omitempty" url:"exact_query,omitempty"` + // A set query expression to return objects with attribute name and value + // matching the specified attribute name and any of the specified attribute values exactly. + // Value matching is case insensitive. + SetQuery *CatalogQuerySet `json:"set_query,omitempty" url:"set_query,omitempty"` + // A prefix query expression to return objects with attribute values + // that have a prefix matching the specified string value. Value matching is case insensitive. + PrefixQuery *CatalogQueryPrefix `json:"prefix_query,omitempty" url:"prefix_query,omitempty"` + // A range query expression to return objects with numeric values + // that lie in the specified range. + RangeQuery *CatalogQueryRange `json:"range_query,omitempty" url:"range_query,omitempty"` + // A text query expression to return objects whose searchable attributes contain all of the given + // keywords, irrespective of their order. For example, if a `CatalogItem` contains custom attribute values of + // `{"name": "t-shirt"}` and `{"description": "Small, Purple"}`, the query filter of `{"keywords": ["shirt", "sma", "purp"]}` + // returns this item. + TextQuery *CatalogQueryText `json:"text_query,omitempty" url:"text_query,omitempty"` + // A query expression to return items that have any of the specified taxes (as identified by the corresponding `CatalogTax` object IDs) enabled. + ItemsForTaxQuery *CatalogQueryItemsForTax `json:"items_for_tax_query,omitempty" url:"items_for_tax_query,omitempty"` + // A query expression to return items that have any of the given modifier list (as identified by the corresponding `CatalogModifierList`s IDs) enabled. + ItemsForModifierListQuery *CatalogQueryItemsForModifierList `json:"items_for_modifier_list_query,omitempty" url:"items_for_modifier_list_query,omitempty"` + // A query expression to return items that contains the specified item options (as identified the corresponding `CatalogItemOption` IDs). + ItemsForItemOptionsQuery *CatalogQueryItemsForItemOptions `json:"items_for_item_options_query,omitempty" url:"items_for_item_options_query,omitempty"` + // A query expression to return item variations (of the [CatalogItemVariation](entity:CatalogItemVariation) type) that + // contain all of the specified `CatalogItemOption` IDs. + ItemVariationsForItemOptionValuesQuery *CatalogQueryItemVariationsForItemOptionValues `json:"item_variations_for_item_option_values_query,omitempty" url:"item_variations_for_item_option_values_query,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CatalogQuery) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CatalogQuery) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogQuery + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CatalogQuery(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CatalogQuery) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// The query filter to return the search result by exact match of the specified attribute name and value. +type CatalogQueryExact struct { + // The name of the attribute to be searched. Matching of the attribute name is exact. + AttributeName string `json:"attribute_name" url:"attribute_name"` + // The desired value of the search attribute. Matching of the attribute value is case insensitive and can be partial. + // For example, if a specified value of "sma", objects with the named attribute value of "Small", "small" are both matched. + AttributeValue string `json:"attribute_value" url:"attribute_value"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CatalogQueryExact) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CatalogQueryExact) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogQueryExact + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CatalogQueryExact(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CatalogQueryExact) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// The query filter to return the item variations containing the specified item option value IDs. +type CatalogQueryItemVariationsForItemOptionValues struct { + // A set of `CatalogItemOptionValue` IDs to be used to find associated + // `CatalogItemVariation`s. All ItemVariations that contain all of the given + // Item Option Values (in any order) will be returned. + ItemOptionValueIDs []string `json:"item_option_value_ids,omitempty" url:"item_option_value_ids,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CatalogQueryItemVariationsForItemOptionValues) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CatalogQueryItemVariationsForItemOptionValues) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogQueryItemVariationsForItemOptionValues + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CatalogQueryItemVariationsForItemOptionValues(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CatalogQueryItemVariationsForItemOptionValues) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// The query filter to return the items containing the specified item option IDs. +type CatalogQueryItemsForItemOptions struct { + // A set of `CatalogItemOption` IDs to be used to find associated + // `CatalogItem`s. All Items that contain all of the given Item Options (in any order) + // will be returned. + ItemOptionIDs []string `json:"item_option_ids,omitempty" url:"item_option_ids,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CatalogQueryItemsForItemOptions) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CatalogQueryItemsForItemOptions) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogQueryItemsForItemOptions + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CatalogQueryItemsForItemOptions(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CatalogQueryItemsForItemOptions) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// The query filter to return the items containing the specified modifier list IDs. +type CatalogQueryItemsForModifierList struct { + // A set of `CatalogModifierList` IDs to be used to find associated `CatalogItem`s. + ModifierListIDs []string `json:"modifier_list_ids,omitempty" url:"modifier_list_ids,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CatalogQueryItemsForModifierList) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CatalogQueryItemsForModifierList) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogQueryItemsForModifierList + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CatalogQueryItemsForModifierList(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CatalogQueryItemsForModifierList) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// The query filter to return the items containing the specified tax IDs. +type CatalogQueryItemsForTax struct { + // A set of `CatalogTax` IDs to be used to find associated `CatalogItem`s. + TaxIDs []string `json:"tax_ids,omitempty" url:"tax_ids,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CatalogQueryItemsForTax) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CatalogQueryItemsForTax) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogQueryItemsForTax + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CatalogQueryItemsForTax(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CatalogQueryItemsForTax) String() string { if len(c._rawJSON) > 0 { if value, err := core.StringifyJSON(c._rawJSON); err == nil { return value @@ -12067,12 +14440,15 @@ func (c *CatalogQuickAmount) String() string { type CatalogQuickAmountType string const ( - CatalogQuickAmountTypeQuickAmountTypeManual CatalogQuickAmountType = "QUICK_AMOUNT_TYPE_MANUAL" - CatalogQuickAmountTypeQuickAmountTypeAuto CatalogQuickAmountType = "QUICK_AMOUNT_TYPE_AUTO" + CatalogQuickAmountTypeQuickAmountTypeDoNotUse CatalogQuickAmountType = "QUICK_AMOUNT_TYPE_DO_NOT_USE" + CatalogQuickAmountTypeQuickAmountTypeManual CatalogQuickAmountType = "QUICK_AMOUNT_TYPE_MANUAL" + CatalogQuickAmountTypeQuickAmountTypeAuto CatalogQuickAmountType = "QUICK_AMOUNT_TYPE_AUTO" ) func NewCatalogQuickAmountTypeFromString(s string) (CatalogQuickAmountType, error) { switch s { + case "QUICK_AMOUNT_TYPE_DO_NOT_USE": + return CatalogQuickAmountTypeQuickAmountTypeDoNotUse, nil case "QUICK_AMOUNT_TYPE_MANUAL": return CatalogQuickAmountTypeQuickAmountTypeManual, nil case "QUICK_AMOUNT_TYPE_AUTO": @@ -12139,13 +14515,16 @@ func (c *CatalogQuickAmountsSettings) String() string { type CatalogQuickAmountsSettingsOption string const ( - CatalogQuickAmountsSettingsOptionDisabled CatalogQuickAmountsSettingsOption = "DISABLED" - CatalogQuickAmountsSettingsOptionManual CatalogQuickAmountsSettingsOption = "MANUAL" - CatalogQuickAmountsSettingsOptionAuto CatalogQuickAmountsSettingsOption = "AUTO" + CatalogQuickAmountsSettingsOptionQuickAmountsSettingsOptionDoNotUse CatalogQuickAmountsSettingsOption = "QUICK_AMOUNTS_SETTINGS_OPTION_DO_NOT_USE" + CatalogQuickAmountsSettingsOptionDisabled CatalogQuickAmountsSettingsOption = "DISABLED" + CatalogQuickAmountsSettingsOptionManual CatalogQuickAmountsSettingsOption = "MANUAL" + CatalogQuickAmountsSettingsOptionAuto CatalogQuickAmountsSettingsOption = "AUTO" ) func NewCatalogQuickAmountsSettingsOptionFromString(s string) (CatalogQuickAmountsSettingsOption, error) { switch s { + case "QUICK_AMOUNTS_SETTINGS_OPTION_DO_NOT_USE": + return CatalogQuickAmountsSettingsOptionQuickAmountsSettingsOptionDoNotUse, nil case "DISABLED": return CatalogQuickAmountsSettingsOptionDisabled, nil case "MANUAL": @@ -12161,7 +14540,7 @@ func (c CatalogQuickAmountsSettingsOption) Ptr() *CatalogQuickAmountsSettingsOpt return &c } -// Represents the rule of conversion between a stockable [CatalogItemVariation]($m/CatalogItemVariation) +// Represents the rule of conversion between a stockable [CatalogItemVariation](entity:CatalogItemVariation) // and a non-stockable sell-by or receive-by `CatalogItemVariation` that // share the same underlying stock. type CatalogStockConversion struct { @@ -12229,6 +14608,14 @@ type CatalogSubscriptionPlan struct { // A list of SubscriptionPhase containing the [SubscriptionPhase](entity:SubscriptionPhase) for this plan. // This field it required. Not including this field will throw a REQUIRED_FIELD_MISSING error Phases []*SubscriptionPhase `json:"phases,omitempty" url:"phases,omitempty"` + // The day of the month the billing period starts. + // + // Retired in favour of the corresponding plan variation field. + MonthlyBillingAnchorDate *int64 `json:"monthly_billing_anchor_date,omitempty" url:"monthly_billing_anchor_date,omitempty"` + // Whether bills for this plan can be split for proration. + // + // Retired in favour of the corresponding plan variation field. + CanProrate *bool `json:"can_prorate,omitempty" url:"can_prorate,omitempty"` // The list of subscription plan variations available for this product SubscriptionPlanVariations []*CatalogObject `json:"subscription_plan_variations,omitempty" url:"subscription_plan_variations,omitempty"` // The list of IDs of `CatalogItems` that are eligible for subscription by this SubscriptionPlan's variations. @@ -12493,12 +14880,191 @@ func (c *CatalogV1ID) String() string { return fmt.Sprintf("%#v", c) } -// A node in the path from a retrieved category to its root node. -type CategoryPathToRootNode struct { - // The category's ID. - CategoryID *string `json:"category_id,omitempty" url:"category_id,omitempty"` - // The category's name. - CategoryName *string `json:"category_name,omitempty" url:"category_name,omitempty"` +// Published when the catalog is updated. +type CatalogVersionUpdatedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *CatalogVersionUpdatedEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CatalogVersionUpdatedEvent) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CatalogVersionUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogVersionUpdatedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CatalogVersionUpdatedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CatalogVersionUpdatedEvent) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +type CatalogVersionUpdatedEventCatalogVersion struct { + // Last modification timestamp in RFC 3339 format. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CatalogVersionUpdatedEventCatalogVersion) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CatalogVersionUpdatedEventCatalogVersion) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogVersionUpdatedEventCatalogVersion + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CatalogVersionUpdatedEventCatalogVersion(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CatalogVersionUpdatedEventCatalogVersion) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +type CatalogVersionUpdatedEventData struct { + // Name of the affected object’s type. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // An object containing fields and values relevant to the event. Is absent if affected object was deleted. + Object *CatalogVersionUpdatedEventObject `json:"object,omitempty" url:"object,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CatalogVersionUpdatedEventData) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CatalogVersionUpdatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogVersionUpdatedEventData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CatalogVersionUpdatedEventData(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CatalogVersionUpdatedEventData) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +type CatalogVersionUpdatedEventObject struct { + // The version of the object. + CatalogVersion *CatalogVersionUpdatedEventCatalogVersion `json:"catalog_version,omitempty" url:"catalog_version,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CatalogVersionUpdatedEventObject) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CatalogVersionUpdatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler CatalogVersionUpdatedEventObject + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CatalogVersionUpdatedEventObject(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CatalogVersionUpdatedEventObject) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// A node in the path from a retrieved category to its root node. +type CategoryPathToRootNode struct { + // The category's ID. + CategoryID *string `json:"category_id,omitempty" url:"category_id,omitempty"` + // The category's name. + CategoryName *string `json:"category_name,omitempty" url:"category_name,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage @@ -12539,7 +15105,7 @@ func (c *CategoryPathToRootNode) String() string { } // Defines output parameters in a request to the -// [ChangeBillingAnchorDate]($e/Subscriptions/ChangeBillingAnchorDate) endpoint. +// [ChangeBillingAnchorDate](api-endpoint:Subscriptions-ChangeBillingAnchorDate) endpoint. type ChangeBillingAnchorDateResponse struct { // Errors encountered during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` @@ -12590,12 +15156,15 @@ func (c *ChangeBillingAnchorDateResponse) String() string { type ChangeTiming string const ( - ChangeTimingImmediate ChangeTiming = "IMMEDIATE" - ChangeTimingEndOfBillingCycle ChangeTiming = "END_OF_BILLING_CYCLE" + ChangeTimingDefaultChangeTimingTypeDoNotUse ChangeTiming = "DEFAULT_CHANGE_TIMING_TYPE_DO_NOT_USE" + ChangeTimingImmediate ChangeTiming = "IMMEDIATE" + ChangeTimingEndOfBillingCycle ChangeTiming = "END_OF_BILLING_CYCLE" ) func NewChangeTimingFromString(s string) (ChangeTiming, error) { switch s { + case "DEFAULT_CHANGE_TIMING_TYPE_DO_NOT_USE": + return ChangeTimingDefaultChangeTimingTypeDoNotUse, nil case "IMMEDIATE": return ChangeTimingImmediate, nil case "END_OF_BILLING_CYCLE": @@ -13036,13 +15605,16 @@ func (c *CheckoutLocationSettingsBranding) String() string { type CheckoutLocationSettingsBrandingButtonShape string const ( - CheckoutLocationSettingsBrandingButtonShapeSquared CheckoutLocationSettingsBrandingButtonShape = "SQUARED" - CheckoutLocationSettingsBrandingButtonShapeRounded CheckoutLocationSettingsBrandingButtonShape = "ROUNDED" - CheckoutLocationSettingsBrandingButtonShapePill CheckoutLocationSettingsBrandingButtonShape = "PILL" + CheckoutLocationSettingsBrandingButtonShapeButtonShapeDoNotUse CheckoutLocationSettingsBrandingButtonShape = "BUTTON_SHAPE_DO_NOT_USE" + CheckoutLocationSettingsBrandingButtonShapeSquared CheckoutLocationSettingsBrandingButtonShape = "SQUARED" + CheckoutLocationSettingsBrandingButtonShapeRounded CheckoutLocationSettingsBrandingButtonShape = "ROUNDED" + CheckoutLocationSettingsBrandingButtonShapePill CheckoutLocationSettingsBrandingButtonShape = "PILL" ) func NewCheckoutLocationSettingsBrandingButtonShapeFromString(s string) (CheckoutLocationSettingsBrandingButtonShape, error) { switch s { + case "BUTTON_SHAPE_DO_NOT_USE": + return CheckoutLocationSettingsBrandingButtonShapeButtonShapeDoNotUse, nil case "SQUARED": return CheckoutLocationSettingsBrandingButtonShapeSquared, nil case "ROUNDED": @@ -13061,13 +15633,16 @@ func (c CheckoutLocationSettingsBrandingButtonShape) Ptr() *CheckoutLocationSett type CheckoutLocationSettingsBrandingHeaderType string const ( - CheckoutLocationSettingsBrandingHeaderTypeBusinessName CheckoutLocationSettingsBrandingHeaderType = "BUSINESS_NAME" - CheckoutLocationSettingsBrandingHeaderTypeFramedLogo CheckoutLocationSettingsBrandingHeaderType = "FRAMED_LOGO" - CheckoutLocationSettingsBrandingHeaderTypeFullWidthLogo CheckoutLocationSettingsBrandingHeaderType = "FULL_WIDTH_LOGO" + CheckoutLocationSettingsBrandingHeaderTypeHeaderTypeDoNotUse CheckoutLocationSettingsBrandingHeaderType = "HEADER_TYPE_DO_NOT_USE" + CheckoutLocationSettingsBrandingHeaderTypeBusinessName CheckoutLocationSettingsBrandingHeaderType = "BUSINESS_NAME" + CheckoutLocationSettingsBrandingHeaderTypeFramedLogo CheckoutLocationSettingsBrandingHeaderType = "FRAMED_LOGO" + CheckoutLocationSettingsBrandingHeaderTypeFullWidthLogo CheckoutLocationSettingsBrandingHeaderType = "FULL_WIDTH_LOGO" ) func NewCheckoutLocationSettingsBrandingHeaderTypeFromString(s string) (CheckoutLocationSettingsBrandingHeaderType, error) { switch s { + case "HEADER_TYPE_DO_NOT_USE": + return CheckoutLocationSettingsBrandingHeaderTypeHeaderTypeDoNotUse, nil case "BUSINESS_NAME": return CheckoutLocationSettingsBrandingHeaderTypeBusinessName, nil case "FRAMED_LOGO": @@ -13522,6 +16097,7 @@ func (c *CheckoutOptions) String() string { type CheckoutOptionsPaymentType string const ( + CheckoutOptionsPaymentTypePaymentTypeDoNotUse CheckoutOptionsPaymentType = "PAYMENT_TYPE_DO_NOT_USE" CheckoutOptionsPaymentTypeCardPresent CheckoutOptionsPaymentType = "CARD_PRESENT" CheckoutOptionsPaymentTypeManualCardEntry CheckoutOptionsPaymentType = "MANUAL_CARD_ENTRY" CheckoutOptionsPaymentTypeFelicaID CheckoutOptionsPaymentType = "FELICA_ID" @@ -13529,10 +16105,13 @@ const ( CheckoutOptionsPaymentTypeFelicaTransportationGroup CheckoutOptionsPaymentType = "FELICA_TRANSPORTATION_GROUP" CheckoutOptionsPaymentTypeFelicaAll CheckoutOptionsPaymentType = "FELICA_ALL" CheckoutOptionsPaymentTypePaypay CheckoutOptionsPaymentType = "PAYPAY" + CheckoutOptionsPaymentTypeCashApp CheckoutOptionsPaymentType = "CASH_APP" ) func NewCheckoutOptionsPaymentTypeFromString(s string) (CheckoutOptionsPaymentType, error) { switch s { + case "PAYMENT_TYPE_DO_NOT_USE": + return CheckoutOptionsPaymentTypePaymentTypeDoNotUse, nil case "CARD_PRESENT": return CheckoutOptionsPaymentTypeCardPresent, nil case "MANUAL_CARD_ENTRY": @@ -13547,6 +16126,8 @@ func NewCheckoutOptionsPaymentTypeFromString(s string) (CheckoutOptionsPaymentTy return CheckoutOptionsPaymentTypeFelicaAll, nil case "PAYPAY": return CheckoutOptionsPaymentTypePaypay, nil + case "CASH_APP": + return CheckoutOptionsPaymentTypeCashApp, nil } var t CheckoutOptionsPaymentType return "", fmt.Errorf("%s is not a valid %T", s, t) @@ -13600,7 +16181,7 @@ func (c *ClearpayDetails) String() string { } // Defines the fields that are included in the response body of -// a request to the [CloneOrder]($e/Orders/CloneOrder) endpoint. +// a request to the [CloneOrder](api-endpoint:Orders-CloneOrder) endpoint. type CloneOrderResponse struct { // The cloned order. Order *Order `json:"order,omitempty" url:"order,omitempty"` @@ -13687,7 +16268,7 @@ func (c *CollectedData) String() string { return fmt.Sprintf("%#v", c) } -// Defines the response returned by[CompletePayment]($e/Payments/CompletePayment). +// Defines the response returned by[CompletePayment](api-endpoint:Payments-CompletePayment). type CompletePaymentResponse struct { // Information about errors encountered during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` @@ -13791,16 +16372,29 @@ func (c *Component) String() string { type ComponentComponentType string const ( - ComponentComponentTypeApplication ComponentComponentType = "APPLICATION" - ComponentComponentTypeCardReader ComponentComponentType = "CARD_READER" - ComponentComponentTypeBattery ComponentComponentType = "BATTERY" - ComponentComponentTypeWifi ComponentComponentType = "WIFI" - ComponentComponentTypeEthernet ComponentComponentType = "ETHERNET" - ComponentComponentTypePrinter ComponentComponentType = "PRINTER" + ComponentComponentTypeComponentInvalidType ComponentComponentType = "COMPONENT_INVALID_TYPE" + ComponentComponentTypeApplication ComponentComponentType = "APPLICATION" + ComponentComponentTypeCardReader ComponentComponentType = "CARD_READER" + ComponentComponentTypeBattery ComponentComponentType = "BATTERY" + ComponentComponentTypeWifi ComponentComponentType = "WIFI" + ComponentComponentTypeEthernet ComponentComponentType = "ETHERNET" + ComponentComponentTypePrinter ComponentComponentType = "PRINTER" + ComponentComponentTypeScale ComponentComponentType = "SCALE" + ComponentComponentTypeBarcodeScanner ComponentComponentType = "BARCODE_SCANNER" + ComponentComponentTypeUsbInterface ComponentComponentType = "USB_INTERFACE" + ComponentComponentTypeBluetoothInterface ComponentComponentType = "BLUETOOTH_INTERFACE" + ComponentComponentTypeNetworkInterface ComponentComponentType = "NETWORK_INTERFACE" + ComponentComponentTypeAirprintInterface ComponentComponentType = "AIRPRINT_INTERFACE" + ComponentComponentTypeAudioInterface ComponentComponentType = "AUDIO_INTERFACE" + ComponentComponentTypeCellularData ComponentComponentType = "CELLULAR_DATA" + ComponentComponentTypeStand ComponentComponentType = "STAND" + ComponentComponentTypeScannerScale ComponentComponentType = "SCANNER_SCALE" ) func NewComponentComponentTypeFromString(s string) (ComponentComponentType, error) { switch s { + case "COMPONENT_INVALID_TYPE": + return ComponentComponentTypeComponentInvalidType, nil case "APPLICATION": return ComponentComponentTypeApplication, nil case "CARD_READER": @@ -13813,6 +16407,26 @@ func NewComponentComponentTypeFromString(s string) (ComponentComponentType, erro return ComponentComponentTypeEthernet, nil case "PRINTER": return ComponentComponentTypePrinter, nil + case "SCALE": + return ComponentComponentTypeScale, nil + case "BARCODE_SCANNER": + return ComponentComponentTypeBarcodeScanner, nil + case "USB_INTERFACE": + return ComponentComponentTypeUsbInterface, nil + case "BLUETOOTH_INTERFACE": + return ComponentComponentTypeBluetoothInterface, nil + case "NETWORK_INTERFACE": + return ComponentComponentTypeNetworkInterface, nil + case "AIRPRINT_INTERFACE": + return ComponentComponentTypeAirprintInterface, nil + case "AUDIO_INTERFACE": + return ComponentComponentTypeAudioInterface, nil + case "CELLULAR_DATA": + return ComponentComponentTypeCellularData, nil + case "STAND": + return ComponentComponentTypeStand, nil + case "SCANNER_SCALE": + return ComponentComponentTypeScannerScale, nil } var t ComponentComponentType return "", fmt.Errorf("%s is not a valid %T", s, t) @@ -14727,7 +17341,7 @@ func (c Country) Ptr() *Country { return &c } -// Represents a [CreateBookingCustomAttributeDefinition]($e/BookingCustomAttributes/CreateBookingCustomAttributeDefinition) response. +// Represents a [CreateBookingCustomAttributeDefinition](api-endpoint:BookingCustomAttributes-CreateBookingCustomAttributeDefinition) response. // Either `custom_attribute_definition` or `errors` is present in the response. type CreateBookingCustomAttributeDefinitionResponse struct { // The newly created custom attribute definition. @@ -14865,7 +17479,7 @@ func (c *CreateBreakTypeResponse) String() string { } // Defines the fields that are included in the response body of -// a request to the [CreateCard]($e/Cards/CreateCard) endpoint. +// a request to the [CreateCard](api-endpoint:Cards-CreateCard) endpoint. // // Note: if there are errors processing the request, the card field will not be // present. @@ -15109,7 +17723,7 @@ func (c *CreateCustomerCardResponse) String() string { return fmt.Sprintf("%#v", c) } -// Represents a [CreateCustomerCustomAttributeDefinition]($e/CustomerCustomAttributes/CreateCustomerCustomAttributeDefinition) response. +// Represents a [CreateCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-CreateCustomerCustomAttributeDefinition) response. // Either `custom_attribute_definition` or `errors` is present in the response. type CreateCustomerCustomAttributeDefinitionResponse struct { // The new custom attribute definition. @@ -15156,7 +17770,7 @@ func (c *CreateCustomerCustomAttributeDefinitionResponse) String() string { } // Defines the fields that are included in the response body of -// a request to the [CreateCustomerGroup]($e/CustomerGroups/CreateCustomerGroup) endpoint. +// a request to the [CreateCustomerGroup](api-endpoint:CustomerGroups-CreateCustomerGroup) endpoint. // // Either `errors` or `group` is present in a given response (never both). type CreateCustomerGroupResponse struct { @@ -15204,8 +17818,8 @@ func (c *CreateCustomerGroupResponse) String() string { } // Defines the fields that are included in the response body of -// a request to the [CreateCustomer]($e/Customers/CreateCustomer) or -// [BulkCreateCustomers]($e/Customers/BulkCreateCustomers) endpoint. +// a request to the [CreateCustomer](api-endpoint:Customers-CreateCustomer) or +// [BulkCreateCustomers](api-endpoint:Customers-BulkCreateCustomers) endpoint. // // Either `errors` or `customer` is present in a given response (never both). type CreateCustomerResponse struct { @@ -15527,7 +18141,7 @@ func (c *CreateGiftCardResponse) String() string { return fmt.Sprintf("%#v", c) } -// Represents a [CreateInvoiceAttachment]($e/Invoices/CreateInvoiceAttachment) response. +// Represents a [CreateInvoiceAttachment](api-endpoint:Invoices-CreateInvoiceAttachment) response. type CreateInvoiceAttachmentResponse struct { // Metadata about the attachment that was added to the invoice. Attachment *InvoiceAttachment `json:"attachment,omitempty" url:"attachment,omitempty"` @@ -15617,7 +18231,7 @@ func (c *CreateInvoiceResponse) String() string { return fmt.Sprintf("%#v", c) } -// Represents a [CreateLocationCustomAttributeDefinition]($e/LocationCustomAttributes/CreateLocationCustomAttributeDefinition) response. +// Represents a [CreateLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-CreateLocationCustomAttributeDefinition) response. // Either `custom_attribute_definition` or `errors` is present in the response. type CreateLocationCustomAttributeDefinitionResponse struct { // The new custom attribute definition. @@ -15663,7 +18277,7 @@ func (c *CreateLocationCustomAttributeDefinitionResponse) String() string { return fmt.Sprintf("%#v", c) } -// The response object returned by the [CreateLocation]($e/Locations/CreateLocation) endpoint. +// The response object returned by the [CreateLocation](api-endpoint:Locations-CreateLocation) endpoint. type CreateLocationResponse struct { // Information about [errors](https://developer.squareup.com/docs/build-basics/handling-errors) encountered during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` @@ -15753,7 +18367,7 @@ func (c *CreateLoyaltyAccountResponse) String() string { return fmt.Sprintf("%#v", c) } -// Represents a [CreateLoyaltyPromotion]($e/Loyalty/CreateLoyaltyPromotion) response. +// Represents a [CreateLoyaltyPromotion](api-endpoint:Loyalty-CreateLoyaltyPromotion) response. // Either `loyalty_promotion` or `errors` is present in the response. type CreateLoyaltyPromotionResponse struct { // Any errors that occurred during the request. @@ -15844,7 +18458,7 @@ func (c *CreateLoyaltyRewardResponse) String() string { return fmt.Sprintf("%#v", c) } -// Represents a [CreateMerchantCustomAttributeDefinition]($e/MerchantCustomAttributes/CreateMerchantCustomAttributeDefinition) response. +// Represents a [CreateMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-CreateMerchantCustomAttributeDefinition) response. // Either `custom_attribute_definition` or `errors` is present in the response. type CreateMerchantCustomAttributeDefinitionResponse struct { // The new custom attribute definition. @@ -15899,6 +18513,9 @@ type CreateMobileAuthorizationCodeResponse struct { // The timestamp when `authorization_code` expires, in // [RFC 3339](https://tools.ietf.org/html/rfc3339) format (for example, "2016-09-04T23:59:33.123Z"). ExpiresAt *string `json:"expires_at,omitempty" url:"expires_at,omitempty"` + // An error object that provides details about how creation of the authorization + // code failed. + Error *Error `json:"error,omitempty" url:"error,omitempty"` // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` @@ -16131,7 +18748,7 @@ func (c *CreatePaymentLinkResponse) String() string { return fmt.Sprintf("%#v", c) } -// Defines the response returned by [CreatePayment]($e/Payments/CreatePayment). +// Defines the response returned by [CreatePayment](api-endpoint:Payments-CreatePayment). // // If there are errors processing the request, the `payment` field might not be // present, or it might be present with a status of `FAILED`. @@ -16348,7 +18965,7 @@ func (c *CreateShiftResponse) String() string { } // Defines output parameters in a response from the -// [CreateSubscription]($e/Subscriptions/CreateSubscription) endpoint. +// [CreateSubscription](api-endpoint:Subscriptions-CreateSubscription) endpoint. type CreateSubscriptionResponse struct { // Errors encountered during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` @@ -16622,7 +19239,7 @@ func (c *CreateTerminalRefundResponse) String() string { return fmt.Sprintf("%#v", c) } -// Represents an output from a call to [CreateVendor]($e/Vendors/CreateVendor). +// Represents an output from a call to [CreateVendor](api-endpoint:Vendors-CreateVendor). type CreateVendorResponse struct { // Errors encountered when the request fails. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` @@ -16668,9 +19285,9 @@ func (c *CreateVendorResponse) String() string { } // Defines the fields that are included in the response body of -// a request to the [CreateWebhookSubscription]($e/WebhookSubscriptions/CreateWebhookSubscription) endpoint. +// a request to the [CreateWebhookSubscription](api-endpoint:WebhookSubscriptions-CreateWebhookSubscription) endpoint. // -// Note: if there are errors processing the request, the [Subscription]($m/WebhookSubscription) will not be +// Note: if there are errors processing the request, the [Subscription](entity:WebhookSubscription) will not be // present. type CreateWebhookSubscriptionResponse struct { // Information on errors encountered during the request. @@ -17412,1599 +20029,14278 @@ func (c *CustomAttributeDefinition) GetExtraProperties() map[string]interface{} return c.extraProperties } -func (c *CustomAttributeDefinition) UnmarshalJSON(data []byte) error { - type unmarshaler CustomAttributeDefinition +func (c *CustomAttributeDefinition) UnmarshalJSON(data []byte) error { + type unmarshaler CustomAttributeDefinition + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomAttributeDefinition(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomAttributeDefinition) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Represents an object in the CustomAttributeDefinition event notification +// payload that contains the affected custom attribute definition. +type CustomAttributeDefinitionEventData struct { + // The type of the event data object. The value is `"custom_attribute_definition"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The ID of the event data object. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the custom attribute definition. + Object *CustomAttributeDefinitionEventDataObject `json:"object,omitempty" url:"object,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomAttributeDefinitionEventData) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomAttributeDefinitionEventData) UnmarshalJSON(data []byte) error { + type unmarshaler CustomAttributeDefinitionEventData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomAttributeDefinitionEventData(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomAttributeDefinitionEventData) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +type CustomAttributeDefinitionEventDataObject struct { + // The custom attribute definition. + CustomAttributeDefinition *CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"custom_attribute_definition,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomAttributeDefinitionEventDataObject) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomAttributeDefinitionEventDataObject) UnmarshalJSON(data []byte) error { + type unmarshaler CustomAttributeDefinitionEventDataObject + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomAttributeDefinitionEventDataObject(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomAttributeDefinitionEventDataObject) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// The level of permission that a seller or other applications requires to +// view this custom attribute definition. +// The `Visibility` field controls who can read and write the custom attribute values +// and custom attribute definition. +type CustomAttributeDefinitionVisibility string + +const ( + CustomAttributeDefinitionVisibilityVisibilityDoNotUse CustomAttributeDefinitionVisibility = "VISIBILITY_DO_NOT_USE" + CustomAttributeDefinitionVisibilityVisibilityHidden CustomAttributeDefinitionVisibility = "VISIBILITY_HIDDEN" + CustomAttributeDefinitionVisibilityVisibilityReadOnly CustomAttributeDefinitionVisibility = "VISIBILITY_READ_ONLY" + CustomAttributeDefinitionVisibilityVisibilityReadWriteValues CustomAttributeDefinitionVisibility = "VISIBILITY_READ_WRITE_VALUES" +) + +func NewCustomAttributeDefinitionVisibilityFromString(s string) (CustomAttributeDefinitionVisibility, error) { + switch s { + case "VISIBILITY_DO_NOT_USE": + return CustomAttributeDefinitionVisibilityVisibilityDoNotUse, nil + case "VISIBILITY_HIDDEN": + return CustomAttributeDefinitionVisibilityVisibilityHidden, nil + case "VISIBILITY_READ_ONLY": + return CustomAttributeDefinitionVisibilityVisibilityReadOnly, nil + case "VISIBILITY_READ_WRITE_VALUES": + return CustomAttributeDefinitionVisibilityVisibilityReadWriteValues, nil + } + var t CustomAttributeDefinitionVisibility + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c CustomAttributeDefinitionVisibility) Ptr() *CustomAttributeDefinitionVisibility { + return &c +} + +type CustomAttributeEventData struct { + // The type of the event data object. The value is `"custom_attribute"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The ID of the event data object. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the custom attribute. + Object *CustomAttributeEventDataObject `json:"object,omitempty" url:"object,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomAttributeEventData) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomAttributeEventData) UnmarshalJSON(data []byte) error { + type unmarshaler CustomAttributeEventData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomAttributeEventData(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomAttributeEventData) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +type CustomAttributeEventDataObject struct { + // The custom attribute. + CustomAttribute *CustomAttribute `json:"custom_attribute,omitempty" url:"custom_attribute,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomAttributeEventDataObject) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomAttributeEventDataObject) UnmarshalJSON(data []byte) error { + type unmarshaler CustomAttributeEventDataObject + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomAttributeEventDataObject(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomAttributeEventDataObject) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Supported custom attribute query expressions for calling the +// [SearchCatalogItems](api-endpoint:Catalog-SearchCatalogItems) +// endpoint to search for items or item variations. +type CustomAttributeFilter struct { + // A query expression to filter items or item variations by matching their custom attributes' + // `custom_attribute_definition_id` property value against the the specified id. + // Exactly one of `custom_attribute_definition_id` or `key` must be specified. + CustomAttributeDefinitionID *string `json:"custom_attribute_definition_id,omitempty" url:"custom_attribute_definition_id,omitempty"` + // A query expression to filter items or item variations by matching their custom attributes' + // `key` property value against the specified key. + // Exactly one of `custom_attribute_definition_id` or `key` must be specified. + Key *string `json:"key,omitempty" url:"key,omitempty"` + // A query expression to filter items or item variations by matching their custom attributes' + // `string_value` property value against the specified text. + // Exactly one of `string_filter`, `number_filter`, `selection_uids_filter`, or `bool_filter` must be specified. + StringFilter *string `json:"string_filter,omitempty" url:"string_filter,omitempty"` + // A query expression to filter items or item variations with their custom attributes + // containing a number value within the specified range. + // Exactly one of `string_filter`, `number_filter`, `selection_uids_filter`, or `bool_filter` must be specified. + NumberFilter *Range `json:"number_filter,omitempty" url:"number_filter,omitempty"` + // A query expression to filter items or item variations by matching their custom attributes' + // `selection_uid_values` values against the specified selection uids. + // Exactly one of `string_filter`, `number_filter`, `selection_uids_filter`, or `bool_filter` must be specified. + SelectionUIDsFilter []string `json:"selection_uids_filter,omitempty" url:"selection_uids_filter,omitempty"` + // A query expression to filter items or item variations by matching their custom attributes' + // `boolean_value` property values against the specified Boolean expression. + // Exactly one of `string_filter`, `number_filter`, `selection_uids_filter`, or `bool_filter` must be specified. + BoolFilter *bool `json:"bool_filter,omitempty" url:"bool_filter,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomAttributeFilter) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomAttributeFilter) UnmarshalJSON(data []byte) error { + type unmarshaler CustomAttributeFilter + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomAttributeFilter(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomAttributeFilter) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Describes a custom form field to add to the checkout page to collect more information from buyers during checkout. +// For more information, +// see [Specify checkout options](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations#specify-checkout-options-1). +type CustomField struct { + // The title of the custom field. + Title string `json:"title" url:"title"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomField) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomField) UnmarshalJSON(data []byte) error { + type unmarshaler CustomField + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomField(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomField) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Represents a Square customer profile in the Customer Directory of a Square seller. +type Customer struct { + // A unique Square-assigned ID for the customer profile. + // + // If you need this ID for an API request, use the ID returned when you created the customer profile or call the [SearchCustomers](api-endpoint:Customers-SearchCustomers) + // or [ListCustomers](api-endpoint:Customers-ListCustomers) endpoint. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The timestamp when the customer profile was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The timestamp when the customer profile was last updated, in RFC 3339 format. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // Payment details of the credit, debit, and gift cards stored on file for the customer profile. + // + // DEPRECATED at version 2021-06-16 and will be RETIRED at version 2024-12-18. Replaced by calling [ListCards](api-endpoint:Cards-ListCards) (for credit and debit cards on file) + // or [ListGiftCards](api-endpoint:GiftCards-ListGiftCards) (for gift cards on file) and including the `customer_id` query parameter. + // For more information, see [Migration notes](https://developer.squareup.com/docs/customers-api/what-it-does#migrate-customer-cards). + Cards []*Card `json:"cards,omitempty" url:"cards,omitempty"` + // The given name (that is, the first name) associated with the customer profile. + GivenName *string `json:"given_name,omitempty" url:"given_name,omitempty"` + // The family name (that is, the last name) associated with the customer profile. + FamilyName *string `json:"family_name,omitempty" url:"family_name,omitempty"` + // A nickname for the customer profile. + Nickname *string `json:"nickname,omitempty" url:"nickname,omitempty"` + // A business name associated with the customer profile. + CompanyName *string `json:"company_name,omitempty" url:"company_name,omitempty"` + // The email address associated with the customer profile. + EmailAddress *string `json:"email_address,omitempty" url:"email_address,omitempty"` + // The physical address associated with the customer profile. + Address *Address `json:"address,omitempty" url:"address,omitempty"` + // The phone number associated with the customer profile. + PhoneNumber *string `json:"phone_number,omitempty" url:"phone_number,omitempty"` + // The birthday associated with the customer profile, in `YYYY-MM-DD` format. For example, `1998-09-21` + // represents September 21, 1998, and `0000-09-21` represents September 21 (without a birth year). + Birthday *string `json:"birthday,omitempty" url:"birthday,omitempty"` + // An optional second ID used to associate the customer profile with an + // entity in another system. + ReferenceID *string `json:"reference_id,omitempty" url:"reference_id,omitempty"` + // A custom note associated with the customer profile. + Note *string `json:"note,omitempty" url:"note,omitempty"` + // Represents general customer preferences. + Preferences *CustomerPreferences `json:"preferences,omitempty" url:"preferences,omitempty"` + // The customer groups and segments the customer belongs to. This deprecated field has been replaced with the dedicated `group_ids` for customer groups and the dedicated `segment_ids` field for customer segments. You can retrieve information about a given customer group and segment respectively using the Customer Groups API and Customer Segments API. + Groups []*CustomerGroupInfo `json:"groups,omitempty" url:"groups,omitempty"` + // The method used to create the customer profile. + // See [CustomerCreationSource](#type-customercreationsource) for possible values + CreationSource *CustomerCreationSource `json:"creation_source,omitempty" url:"creation_source,omitempty"` + // The IDs of [customer groups](entity:CustomerGroup) the customer belongs to. + GroupIDs []string `json:"group_ids,omitempty" url:"group_ids,omitempty"` + // The IDs of [customer segments](entity:CustomerSegment) the customer belongs to. + SegmentIDs []string `json:"segment_ids,omitempty" url:"segment_ids,omitempty"` + // The Square-assigned version number of the customer profile. The version number is incremented each time an update is committed to the customer profile, except for changes to customer segment membership and cards on file. + Version *int64 `json:"version,omitempty" url:"version,omitempty"` + // The tax ID associated with the customer profile. This field is present only for customers of sellers in EU countries or the United Kingdom. + // For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids). + TaxIDs *CustomerTaxIDs `json:"tax_ids,omitempty" url:"tax_ids,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *Customer) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *Customer) UnmarshalJSON(data []byte) error { + type unmarshaler Customer + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = Customer(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *Customer) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// The customer address filter. This filter is used in a [CustomerCustomAttributeFilterValue](entity:CustomerCustomAttributeFilterValue) filter when +// searching by an `Address`-type custom attribute. +type CustomerAddressFilter struct { + // The postal code to search for. Only an `exact` match is supported. + PostalCode *CustomerTextFilter `json:"postal_code,omitempty" url:"postal_code,omitempty"` + // The country code to search for. + // See [Country](#type-country) for possible values + Country *Country `json:"country,omitempty" url:"country,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerAddressFilter) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerAddressFilter) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerAddressFilter + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerAddressFilter(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerAddressFilter) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Published when a [customer](entity:Customer) is created. Subscribe to this event to track customer profiles affected by a merge operation. +// For more information, see [Use Customer Webhooks](https://developer.squareup.com/docs/customers-api/use-the-api/customer-webhooks). +// +// The `customer` object in the event notification does not include the following fields: `cards` (deprecated) and `segment_ids`. +type CustomerCreatedEvent struct { + // The ID of the seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event. For this object, the value is `customer.created`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The unique ID of the event, which is used for [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *CustomerCreatedEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerCreatedEvent) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerCreatedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerCreatedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerCreatedEvent) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// The data associated with the event. +type CustomerCreatedEventData struct { + // The type of object affected by the event. For this event, the value is `customer`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The ID of the new customer. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object that contains the new customer. + Object *CustomerCreatedEventObject `json:"object,omitempty" url:"object,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerCreatedEventData) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerCreatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerCreatedEventData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerCreatedEventData(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerCreatedEventData) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Information about the change that triggered the event. +type CustomerCreatedEventEventContext struct { + // Information about the merge operation associated with the event. + Merge *CustomerCreatedEventEventContextMerge `json:"merge,omitempty" url:"merge,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerCreatedEventEventContext) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerCreatedEventEventContext) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerCreatedEventEventContext + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerCreatedEventEventContext(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerCreatedEventEventContext) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Information about a merge operation, which creates a new customer using aggregated properties from two or more existing customers. +type CustomerCreatedEventEventContextMerge struct { + // The IDs of the existing customers that were merged and then deleted. + FromCustomerIDs []string `json:"from_customer_ids,omitempty" url:"from_customer_ids,omitempty"` + // The ID of the new customer created by the merge. + ToCustomerID *string `json:"to_customer_id,omitempty" url:"to_customer_id,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerCreatedEventEventContextMerge) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerCreatedEventEventContextMerge) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerCreatedEventEventContextMerge + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerCreatedEventEventContextMerge(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerCreatedEventEventContextMerge) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// An object that contains the customer associated with the event. +type CustomerCreatedEventObject struct { + // The new customer. + Customer *Customer `json:"customer,omitempty" url:"customer,omitempty"` + // Information about the change that triggered the event. This field is returned only if the customer is created by a merge operation. + EventContext *CustomerCreatedEventEventContext `json:"event_context,omitempty" url:"event_context,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerCreatedEventObject) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerCreatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerCreatedEventObject + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerCreatedEventObject(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerCreatedEventObject) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Indicates the method used to create the customer profile. +type CustomerCreationSource string + +const ( + CustomerCreationSourceOther CustomerCreationSource = "OTHER" + CustomerCreationSourceAppointments CustomerCreationSource = "APPOINTMENTS" + CustomerCreationSourceCoupon CustomerCreationSource = "COUPON" + CustomerCreationSourceDeletionRecovery CustomerCreationSource = "DELETION_RECOVERY" + CustomerCreationSourceDirectory CustomerCreationSource = "DIRECTORY" + CustomerCreationSourceEgifting CustomerCreationSource = "EGIFTING" + CustomerCreationSourceEmailCollection CustomerCreationSource = "EMAIL_COLLECTION" + CustomerCreationSourceFeedback CustomerCreationSource = "FEEDBACK" + CustomerCreationSourceImport CustomerCreationSource = "IMPORT" + CustomerCreationSourceInvoices CustomerCreationSource = "INVOICES" + CustomerCreationSourceLoyalty CustomerCreationSource = "LOYALTY" + CustomerCreationSourceMarketing CustomerCreationSource = "MARKETING" + CustomerCreationSourceMerge CustomerCreationSource = "MERGE" + CustomerCreationSourceOnlineStore CustomerCreationSource = "ONLINE_STORE" + CustomerCreationSourceInstantProfile CustomerCreationSource = "INSTANT_PROFILE" + CustomerCreationSourceTerminal CustomerCreationSource = "TERMINAL" + CustomerCreationSourceThirdParty CustomerCreationSource = "THIRD_PARTY" + CustomerCreationSourceThirdPartyImport CustomerCreationSource = "THIRD_PARTY_IMPORT" + CustomerCreationSourceUnmergeRecovery CustomerCreationSource = "UNMERGE_RECOVERY" +) + +func NewCustomerCreationSourceFromString(s string) (CustomerCreationSource, error) { + switch s { + case "OTHER": + return CustomerCreationSourceOther, nil + case "APPOINTMENTS": + return CustomerCreationSourceAppointments, nil + case "COUPON": + return CustomerCreationSourceCoupon, nil + case "DELETION_RECOVERY": + return CustomerCreationSourceDeletionRecovery, nil + case "DIRECTORY": + return CustomerCreationSourceDirectory, nil + case "EGIFTING": + return CustomerCreationSourceEgifting, nil + case "EMAIL_COLLECTION": + return CustomerCreationSourceEmailCollection, nil + case "FEEDBACK": + return CustomerCreationSourceFeedback, nil + case "IMPORT": + return CustomerCreationSourceImport, nil + case "INVOICES": + return CustomerCreationSourceInvoices, nil + case "LOYALTY": + return CustomerCreationSourceLoyalty, nil + case "MARKETING": + return CustomerCreationSourceMarketing, nil + case "MERGE": + return CustomerCreationSourceMerge, nil + case "ONLINE_STORE": + return CustomerCreationSourceOnlineStore, nil + case "INSTANT_PROFILE": + return CustomerCreationSourceInstantProfile, nil + case "TERMINAL": + return CustomerCreationSourceTerminal, nil + case "THIRD_PARTY": + return CustomerCreationSourceThirdParty, nil + case "THIRD_PARTY_IMPORT": + return CustomerCreationSourceThirdPartyImport, nil + case "UNMERGE_RECOVERY": + return CustomerCreationSourceUnmergeRecovery, nil + } + var t CustomerCreationSource + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c CustomerCreationSource) Ptr() *CustomerCreationSource { + return &c +} + +// The creation source filter. +// +// If one or more creation sources are set, customer profiles are included in, +// or excluded from, the result if they match at least one of the filter criteria. +type CustomerCreationSourceFilter struct { + // The list of creation sources used as filtering criteria. + // See [CustomerCreationSource](#type-customercreationsource) for possible values + Values []CustomerCreationSource `json:"values,omitempty" url:"values,omitempty"` + // Indicates whether a customer profile matching the filter criteria + // should be included in the result or excluded from the result. + // + // Default: `INCLUDE`. + // See [CustomerInclusionExclusion](#type-customerinclusionexclusion) for possible values + Rule *CustomerInclusionExclusion `json:"rule,omitempty" url:"rule,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerCreationSourceFilter) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerCreationSourceFilter) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerCreationSourceFilter + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerCreationSourceFilter(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerCreationSourceFilter) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) +// is created by the subscribing application. +// +// This event is replaced by +// [customer.custom_attribute_definition.owned.created](webhook:customer.custom_attribute_definition.owned.created). +type CustomerCustomAttributeDefinitionCreatedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"customer.custom_attribute_definition.created"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerCustomAttributeDefinitionCreatedEvent) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerCustomAttributeDefinitionCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerCustomAttributeDefinitionCreatedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerCustomAttributeDefinitionCreatedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerCustomAttributeDefinitionCreatedEvent) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) +// that is visible to all applications is created. A notification is sent when any application creates a custom +// attribute definition whose `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. +// +// This event is replaced by +// [customer.custom_attribute_definition.visible.created](webhook:customer.custom_attribute_definition.visible.created), +// which applies to custom attribute definitions that are visible to the subscribing application. +type CustomerCustomAttributeDefinitionCreatedPublicEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"customer.custom_attribute_definition.public.created"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerCustomAttributeDefinitionCreatedPublicEvent) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerCustomAttributeDefinitionCreatedPublicEvent) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerCustomAttributeDefinitionCreatedPublicEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerCustomAttributeDefinitionCreatedPublicEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerCustomAttributeDefinitionCreatedPublicEvent) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) +// created by the subscribing application is deleted. A custom attribute definition can only be deleted by +// the application that created it. +// +// This event is replaced by +// [customer.custom_attribute_definition.owned.deleted](webhook:customer.custom_attribute_definition.owned.deleted). +type CustomerCustomAttributeDefinitionDeletedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"customer.custom_attribute_definition.deleted"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerCustomAttributeDefinitionDeletedEvent) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerCustomAttributeDefinitionDeletedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerCustomAttributeDefinitionDeletedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerCustomAttributeDefinitionDeletedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerCustomAttributeDefinitionDeletedEvent) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) +// that is visible to all applications is deleted. A notification is sent when any application deletes a custom +// attribute definition whose `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. +// +// This event is replaced by +// [customer.custom_attribute_definition.visible.deleted](webhook:customer.custom_attribute_definition.visible.deleted), +// which applies to custom attribute definitions that are visible to the subscribing application. +type CustomerCustomAttributeDefinitionDeletedPublicEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"customer.custom_attribute_definition.public.deleted"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerCustomAttributeDefinitionDeletedPublicEvent) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerCustomAttributeDefinitionDeletedPublicEvent) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerCustomAttributeDefinitionDeletedPublicEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerCustomAttributeDefinitionDeletedPublicEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerCustomAttributeDefinitionDeletedPublicEvent) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) +// is created by the subscribing application. +type CustomerCustomAttributeDefinitionOwnedCreatedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"customer.custom_attribute_definition.owned.created"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerCustomAttributeDefinitionOwnedCreatedEvent) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerCustomAttributeDefinitionOwnedCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerCustomAttributeDefinitionOwnedCreatedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerCustomAttributeDefinitionOwnedCreatedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerCustomAttributeDefinitionOwnedCreatedEvent) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) +// created by the subscribing application is deleted. A custom attribute definition can only be deleted by +// the application that created it. +type CustomerCustomAttributeDefinitionOwnedDeletedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"customer.custom_attribute_definition.owned.deleted"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerCustomAttributeDefinitionOwnedDeletedEvent) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerCustomAttributeDefinitionOwnedDeletedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerCustomAttributeDefinitionOwnedDeletedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerCustomAttributeDefinitionOwnedDeletedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerCustomAttributeDefinitionOwnedDeletedEvent) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) +// created by the subscribing application is updated. A custom attribute definition can only be updated by +// the application that created it. +type CustomerCustomAttributeDefinitionOwnedUpdatedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"customer.custom_attribute_definition.owned.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerCustomAttributeDefinitionOwnedUpdatedEvent) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerCustomAttributeDefinitionOwnedUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerCustomAttributeDefinitionOwnedUpdatedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerCustomAttributeDefinitionOwnedUpdatedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerCustomAttributeDefinitionOwnedUpdatedEvent) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) +// created by the subscribing application is updated. A custom attribute definition can only be updated by +// the application that created it. +// +// This event is replaced by +// [customer.custom_attribute_definition.owned.updated](webhook:customer.custom_attribute_definition.owned.updated). +type CustomerCustomAttributeDefinitionUpdatedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"customer.custom_attribute_definition.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerCustomAttributeDefinitionUpdatedEvent) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerCustomAttributeDefinitionUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerCustomAttributeDefinitionUpdatedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerCustomAttributeDefinitionUpdatedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerCustomAttributeDefinitionUpdatedEvent) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) +// that is visible to all applications is updated. A notification is sent when any application updates a custom +// attribute definition whose `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. +// +// This event is replaced by +// [customer.custom_attribute_definition.visible.updated](webhook:customer.custom_attribute_definition.visible.updated), +// which applies to custom attribute definitions that are visible to the subscribing application. +type CustomerCustomAttributeDefinitionUpdatedPublicEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"customer.custom_attribute_definition.public.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerCustomAttributeDefinitionUpdatedPublicEvent) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerCustomAttributeDefinitionUpdatedPublicEvent) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerCustomAttributeDefinitionUpdatedPublicEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerCustomAttributeDefinitionUpdatedPublicEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerCustomAttributeDefinitionUpdatedPublicEvent) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) +// that is visible to the subscribing application is created. A notification is sent when your application +// creates a custom attribute definition or another application creates a custom attribute definition whose +// `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. +type CustomerCustomAttributeDefinitionVisibleCreatedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"customer.custom_attribute_definition.visible.created"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerCustomAttributeDefinitionVisibleCreatedEvent) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerCustomAttributeDefinitionVisibleCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerCustomAttributeDefinitionVisibleCreatedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerCustomAttributeDefinitionVisibleCreatedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerCustomAttributeDefinitionVisibleCreatedEvent) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) +// that is visible to the subscribing application is deleted. A custom attribute definition can only be deleted +// by the application that created it. A notification is sent when your application deletes a custom attribute +// definition or when another application deletes a custom attribute definition whose `visibility` is +// `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. +type CustomerCustomAttributeDefinitionVisibleDeletedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"customer.custom_attribute_definition.visible.deleted"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerCustomAttributeDefinitionVisibleDeletedEvent) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerCustomAttributeDefinitionVisibleDeletedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerCustomAttributeDefinitionVisibleDeletedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerCustomAttributeDefinitionVisibleDeletedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerCustomAttributeDefinitionVisibleDeletedEvent) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) +// that is visible to the subscribing application is updated. A custom attribute definition can only be updated +// by the application that created it. A notification is sent when your application updates a custom +// attribute definition or when another application updates a custom attribute definition whose `visibility` is +// `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. +type CustomerCustomAttributeDefinitionVisibleUpdatedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"customer.custom_attribute_definition.visible.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerCustomAttributeDefinitionVisibleUpdatedEvent) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerCustomAttributeDefinitionVisibleUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerCustomAttributeDefinitionVisibleUpdatedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerCustomAttributeDefinitionVisibleUpdatedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerCustomAttributeDefinitionVisibleUpdatedEvent) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Published when a customer [custom attribute](entity:CustomAttribute) owned by the +// subscribing application is deleted. Custom attributes are owned by the application that created the +// corresponding [custom attribute definition](entity:CustomAttributeDefinition). Custom attributes whose +// `visibility` is `VISIBILITY_READ_WRITE_VALUES` can be deleted by any application. +// +// This event is replaced by +// [customer.custom_attribute.owned.deleted](webhook:customer.custom_attribute.owned.deleted). +type CustomerCustomAttributeDeletedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"customer.custom_attribute.deleted"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerCustomAttributeDeletedEvent) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerCustomAttributeDeletedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerCustomAttributeDeletedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerCustomAttributeDeletedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerCustomAttributeDeletedEvent) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Published when a customer [custom attribute](entity:CustomAttribute) that is visible +// to all applications is deleted. A notification is sent when any application deletes a custom attribute +// whose `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. +// +// This event is replaced by +// [customer.custom_attribute.visible.deleted](webhook:customer.custom_attribute.visible.deleted), +// which applies to custom attributes that are visible to the subscribing application. +type CustomerCustomAttributeDeletedPublicEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"customer.custom_attribute.public.deleted"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerCustomAttributeDeletedPublicEvent) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerCustomAttributeDeletedPublicEvent) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerCustomAttributeDeletedPublicEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerCustomAttributeDeletedPublicEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerCustomAttributeDeletedPublicEvent) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// The custom attribute filter. Use this filter in a set of [custom attribute filters](entity:CustomerCustomAttributeFilters) to search +// based on the value or last updated date of a customer-related [custom attribute](entity:CustomAttribute). +type CustomerCustomAttributeFilter struct { + // The `key` of the [custom attribute](entity:CustomAttribute) to filter by. The key is the identifier of the custom attribute + // (and the corresponding custom attribute definition) and can be retrieved using the [Customer Custom Attributes API](api:CustomerCustomAttributes). + Key string `json:"key" url:"key"` + // A filter that corresponds to the data type of the target custom attribute. For example, provide the `phone` filter to + // search based on the value of a `PhoneNumber`-type custom attribute. The data type is specified by the schema field of the custom attribute definition, + // which can be retrieved using the [Customer Custom Attributes API](api:CustomerCustomAttributes). + // + // You must provide this `filter` field, the `updated_at` field, or both. + Filter *CustomerCustomAttributeFilterValue `json:"filter,omitempty" url:"filter,omitempty"` + // The date range for when the custom attribute was last updated. The date range can include `start_at`, `end_at`, or + // both. Range boundaries are inclusive. Dates are specified as RFC 3339 timestamps. + // + // You must provide this `updated_at` field, the `filter` field, or both. + UpdatedAt *TimeRange `json:"updated_at,omitempty" url:"updated_at,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerCustomAttributeFilter) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerCustomAttributeFilter) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerCustomAttributeFilter + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerCustomAttributeFilter(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerCustomAttributeFilter) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// A type-specific filter used in a [custom attribute filter](entity:CustomerCustomAttributeFilter) to search based on the value +// of a customer-related [custom attribute](entity:CustomAttribute). +type CustomerCustomAttributeFilterValue struct { + // A filter for a query based on the value of an `Email`-type custom attribute. This filter is case-insensitive and can + // include `exact` or `fuzzy`, but not both. + // + // For an `exact` match, provide the complete email address. + // + // For a `fuzzy` match, provide a query expression containing one or more query tokens to match against the email address. Square removes + // any punctuation (including periods (.), underscores (\_), and the @ symbol) and tokenizes the email addresses on spaces. A match is found + // if a tokenized email address contains all the tokens in the search query, irrespective of the token order. For example, `Steven gmail` + // matches steven.jones@gmail.com and mygmail@stevensbakery.com. + Email *CustomerTextFilter `json:"email,omitempty" url:"email,omitempty"` + // A filter for a query based on the value of a `PhoneNumber`-type custom attribute. This filter is case-insensitive and + // can include `exact` or `fuzzy`, but not both. + // + // For an `exact` match, provide the complete phone number. This is always an E.164-compliant phone number that starts + // with the + sign followed by the country code and subscriber number. For example, the format for a US phone number is +12061112222. + // + // For a `fuzzy` match, provide a query expression containing one or more query tokens to match against the phone number. + // Square removes any punctuation and tokenizes the expression on spaces. A match is found if a tokenized phone number contains + // all the tokens in the search query, irrespective of the token order. For example, `415 123 45` is tokenized to `415`, `123`, and `45`, + // which matches +14151234567 and +12345674158, but does not match +1234156780. Similarly, the expression `415` matches + // +14151234567, +12345674158, and +1234156780. + Phone *CustomerTextFilter `json:"phone,omitempty" url:"phone,omitempty"` + // A filter for a query based on the value of a `String`-type custom attribute. This filter is case-insensitive and + // can include `exact` or `fuzzy`, but not both. + // + // For an `exact` match, provide the complete string. + // + // For a `fuzzy` match, provide a query expression containing one or more query tokens in any order that contain complete words + // to match against the string. Square tokenizes the expression using a grammar-based tokenizer. For example, the expressions `quick brown`, + // `brown quick`, and `quick fox` match "The quick brown fox jumps over the lazy dog". However, `quick foxes` and `qui` do not match. + Text *CustomerTextFilter `json:"text,omitempty" url:"text,omitempty"` + // A filter for a query based on the display name for a `Selection`-type custom attribute value. This filter is case-sensitive + // and can contain `any`, `all`, or both. The `none` condition is not supported. + // + // Provide the display name of each item that you want to search for. To find the display names for the selection, use the + // [Customer Custom Attributes API](api:CustomerCustomAttributes) to retrieve the corresponding custom attribute definition + // and then check the `schema.items.names` field. For more information, see + // [Search based on selection](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#custom-attribute-value-filter-selection). + // + // Note that when a `Selection`-type custom attribute is assigned to a customer profile, the custom attribute value is a list of one + // or more UUIDs (sourced from the `schema.items.enum` field) that map to the item names. These UUIDs are unique per seller. + Selection *FilterValue `json:"selection,omitempty" url:"selection,omitempty"` + // A filter for a query based on the value of a `Date`-type custom attribute. + // + // Provide a date range for this filter using `start_at`, `end_at`, or both. Range boundaries are inclusive. Dates can be specified + // in `YYYY-MM-DD` format or as RFC 3339 timestamps. + Date *TimeRange `json:"date,omitempty" url:"date,omitempty"` + // A filter for a query based on the value of a `Number`-type custom attribute, which can be an integer or a decimal with up to + // 5 digits of precision. + // + // Provide a numerical range for this filter using `start_at`, `end_at`, or both. Range boundaries are inclusive. Numbers are specified + // as decimals or integers. The absolute value of range boundaries must not exceed `(2^63-1)/10^5`, or 92233720368547. + Number *FloatNumberRange `json:"number,omitempty" url:"number,omitempty"` + // A filter for a query based on the value of a `Boolean`-type custom attribute. + Boolean *bool `json:"boolean,omitempty" url:"boolean,omitempty"` + // A filter for a query based on the value of an `Address`-type custom attribute. The filter can include `postal_code`, `country`, or both. + Address *CustomerAddressFilter `json:"address,omitempty" url:"address,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerCustomAttributeFilterValue) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerCustomAttributeFilterValue) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerCustomAttributeFilterValue + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerCustomAttributeFilterValue(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerCustomAttributeFilterValue) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// The custom attribute filters in a set of [customer filters](entity:CustomerFilter) used in a search query. Use this filter +// to search based on [custom attributes](entity:CustomAttribute) that are assigned to customer profiles. For more information, see +// [Search by custom attribute](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#search-by-custom-attribute). +type CustomerCustomAttributeFilters struct { + // The custom attribute filters. Each filter must specify `key` and include the `filter` field with a type-specific filter, + // the `updated_at` field, or both. The provided keys must be unique within the list of custom attribute filters. + Filters []*CustomerCustomAttributeFilter `json:"filters,omitempty" url:"filters,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerCustomAttributeFilters) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerCustomAttributeFilters) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerCustomAttributeFilters + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerCustomAttributeFilters(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerCustomAttributeFilters) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Published when a customer [custom attribute](entity:CustomAttribute) owned by the +// subscribing application is deleted. Custom attributes are owned by the application that created the +// corresponding [custom attribute definition](entity:CustomAttributeDefinition). Custom attributes whose +// `visibility` is `VISIBILITY_READ_WRITE_VALUES` can be deleted by any application. +type CustomerCustomAttributeOwnedDeletedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"customer.custom_attribute.owned.deleted"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerCustomAttributeOwnedDeletedEvent) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerCustomAttributeOwnedDeletedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerCustomAttributeOwnedDeletedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerCustomAttributeOwnedDeletedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerCustomAttributeOwnedDeletedEvent) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Published when a customer [custom attribute](entity:CustomAttribute) owned by the +// subscribing application is created or updated. Custom attributes are owned by the application that created +// the corresponding [custom attribute definition](entity:CustomAttributeDefinition). Custom attributes whose +// `visibility` is `VISIBILITY_READ_WRITE_VALUES` can be created or updated by any application. +type CustomerCustomAttributeOwnedUpdatedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"customer.custom_attribute.owned.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerCustomAttributeOwnedUpdatedEvent) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerCustomAttributeOwnedUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerCustomAttributeOwnedUpdatedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerCustomAttributeOwnedUpdatedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerCustomAttributeOwnedUpdatedEvent) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Published when a customer [custom attribute](entity:CustomAttribute) owned by the +// subscribing application is created or updated. Custom attributes are owned by the application that created +// the corresponding [custom attribute definition](entity:CustomAttributeDefinition). Custom attributes whose +// `visibility` is `VISIBILITY_READ_WRITE_VALUES` can be created or updated by any application. +// +// This event is replaced by +// [customer.custom_attribute.owned.updated](webhook:customer.custom_attribute.owned.updated). +type CustomerCustomAttributeUpdatedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"customer.custom_attribute.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerCustomAttributeUpdatedEvent) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerCustomAttributeUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerCustomAttributeUpdatedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerCustomAttributeUpdatedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerCustomAttributeUpdatedEvent) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Published when a customer [custom attribute](entity:CustomAttribute) that is visible +// to all applications is created or updated. A notification is sent when any application creates or updates +// a custom attribute whose `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. +// +// This event is replaced by +// [customer.custom_attribute.visible.updated](webhook:customer.custom_attribute.visible.updated), +// which applies to custom attributes that are visible to the subscribing application. +type CustomerCustomAttributeUpdatedPublicEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"customer.custom_attribute.public.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerCustomAttributeUpdatedPublicEvent) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerCustomAttributeUpdatedPublicEvent) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerCustomAttributeUpdatedPublicEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerCustomAttributeUpdatedPublicEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerCustomAttributeUpdatedPublicEvent) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Published when a customer [custom attribute](entity:CustomAttribute) that is visible to the +// subscribing application is deleted. A notification is sent when: +// +// - Your application deletes a custom attribute owned by your application, regardless of the `visibility` setting. +// - Any application deletes a custom attribute whose `visibility` is `VISIBILITY_READ_ONLY` +// or `VISIBILITY_READ_WRITE_VALUES`. +// +// Custom attributes set to `VISIBILITY_READ_WRITE_VALUES` can be deleted by any application, but those set to +// `VISIBILITY_READ_ONLY` or `VISIBILITY_HIDDEN` can only be deleted by the owner. Custom attributes are owned +// by the application that created the corresponding [custom attribute definition](entity:CustomAttributeDefinition). +type CustomerCustomAttributeVisibleDeletedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"customer.custom_attribute.visible.deleted"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerCustomAttributeVisibleDeletedEvent) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerCustomAttributeVisibleDeletedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerCustomAttributeVisibleDeletedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerCustomAttributeVisibleDeletedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerCustomAttributeVisibleDeletedEvent) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Published when a customer [custom attribute](entity:CustomAttribute) that is visible to the +// subscribing application is created or updated. A notification is sent when: +// +// - Your application creates or updates a custom attribute owned by your application, regardless of the `visibility` setting. +// - Any application creates or updates a custom attribute whose `visibility` is `VISIBILITY_READ_ONLY` +// or `VISIBILITY_READ_WRITE_VALUES`. +// +// Custom attributes set to `VISIBILITY_READ_WRITE_VALUES` can be created or updated by any application, but those set to +// `VISIBILITY_READ_ONLY` or `VISIBILITY_HIDDEN` can only be created or updated by the owner. Custom attributes are owned +// by the application that created the corresponding [custom attribute definition](entity:CustomAttributeDefinition). +type CustomerCustomAttributeVisibleUpdatedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"customer.custom_attribute.visible.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerCustomAttributeVisibleUpdatedEvent) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerCustomAttributeVisibleUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerCustomAttributeVisibleUpdatedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerCustomAttributeVisibleUpdatedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerCustomAttributeVisibleUpdatedEvent) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Published when a [customer](entity:Customer) is deleted. For more information, see [Use Customer Webhooks](https://developer.squareup.com/docs/customers-api/use-the-api/customer-webhooks). +// +// The `customer` object in the event notification does not include the following fields: `cards` (deprecated), `group_ids`, and `segment_ids`. +type CustomerDeletedEvent struct { + // The ID of the seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event. For this object, the value is `customer.deleted`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The unique ID of the event, which is used for [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *CustomerDeletedEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerDeletedEvent) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerDeletedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerDeletedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerDeletedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerDeletedEvent) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// The data associated with the event. +type CustomerDeletedEventData struct { + // The type of object affected by the event. For this event, the value is `customer`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The ID of the deleted customer. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object that contains the deleted customer. + Object *CustomerDeletedEventObject `json:"object,omitempty" url:"object,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerDeletedEventData) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerDeletedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerDeletedEventData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerDeletedEventData(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerDeletedEventData) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Information about the change that triggered the event. +type CustomerDeletedEventEventContext struct { + // Information about the merge operation associated with the event. + Merge *CustomerDeletedEventEventContextMerge `json:"merge,omitempty" url:"merge,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerDeletedEventEventContext) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerDeletedEventEventContext) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerDeletedEventEventContext + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerDeletedEventEventContext(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerDeletedEventEventContext) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Information about a merge operation, which creates a new customer using aggregated properties from two or more existing customers. +type CustomerDeletedEventEventContextMerge struct { + // The IDs of the existing customers that were merged and then deleted. + FromCustomerIDs []string `json:"from_customer_ids,omitempty" url:"from_customer_ids,omitempty"` + // The ID of the new customer created by the merge. + ToCustomerID *string `json:"to_customer_id,omitempty" url:"to_customer_id,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerDeletedEventEventContextMerge) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerDeletedEventEventContextMerge) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerDeletedEventEventContextMerge + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerDeletedEventEventContextMerge(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerDeletedEventEventContextMerge) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// An object that contains the customer associated with the event. +type CustomerDeletedEventObject struct { + // The deleted customer. + Customer *Customer `json:"customer,omitempty" url:"customer,omitempty"` + // Information about the change that triggered the event. This field is returned only if the customer is deleted by a merge operation. + EventContext *CustomerDeletedEventEventContext `json:"event_context,omitempty" url:"event_context,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerDeletedEventObject) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerDeletedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerDeletedEventObject + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerDeletedEventObject(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerDeletedEventObject) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Details about the customer making the payment. +type CustomerDetails struct { + // Indicates whether the customer initiated the payment. + CustomerInitiated *bool `json:"customer_initiated,omitempty" url:"customer_initiated,omitempty"` + // Indicates that the seller keyed in payment details on behalf of the customer. + // This is used to flag a payment as Mail Order / Telephone Order (MOTO). + SellerKeyedIn *bool `json:"seller_keyed_in,omitempty" url:"seller_keyed_in,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerDetails) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerDetails) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerDetails + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerDetails(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerDetails) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Represents the filtering criteria in a [search query](entity:CustomerQuery) that defines how to filter +// customer profiles returned in [SearchCustomers](api-endpoint:Customers-SearchCustomers) results. +type CustomerFilter struct { + // A filter to select customers based on their creation source. + CreationSource *CustomerCreationSourceFilter `json:"creation_source,omitempty" url:"creation_source,omitempty"` + // A filter to select customers based on when they were created. + CreatedAt *TimeRange `json:"created_at,omitempty" url:"created_at,omitempty"` + // A filter to select customers based on when they were last updated. + UpdatedAt *TimeRange `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // A filter to [select customers by their email address](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#search-by-email-address) + // visible to the seller. + // This filter is case-insensitive. + // + // For [exact matching](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#exact-search-by-email-address), this + // filter causes the search to return customer profiles + // whose `email_address` field value are identical to the email address provided + // in the query. + // + // For [fuzzy matching](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#fuzzy-search-by-email-address), + // this filter causes the search to return customer profiles + // whose `email_address` field value has a token-wise partial match against the filtering + // expression in the query. For example, with `Steven gmail` provided in a search + // query, the search returns customers whose email address is `steven.johnson@gmail.com` + // or `mygmail@stevensbakery.com`. Square removes any punctuation (including periods (.), + // underscores (\_), and the @ symbol) and tokenizes the email addresses on spaces. A match is + // found if a tokenized email address contains all the tokens in the search query, + // irrespective of the token order. + EmailAddress *CustomerTextFilter `json:"email_address,omitempty" url:"email_address,omitempty"` + // A filter to [select customers by their phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#search-by-phone-number) + // visible to the seller. + // + // For [exact matching](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#exact-search-by-phone-number), + // this filter returns customers whose phone number matches the specified query expression. The number in the query must be of an + // E.164-compliant form. In particular, it must include the leading `+` sign followed by a country code and then a subscriber number. + // For example, the standard E.164 form of a US phone number is `+12062223333` and an E.164-compliant variation is `+1 (206) 222-3333`. + // To match the query expression, stored customer phone numbers are converted to the standard E.164 form. + // + // For [fuzzy matching](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#fuzzy-search-by-phone-number), + // this filter returns customers whose phone number matches the token or tokens provided in the query expression. For example, with `415` + // provided in a search query, the search returns customers with the phone numbers `+1-415-212-1200`, `+1-212-415-1234`, and `+1 (551) 234-1567`. + // Similarly, a search query of `415 123` returns customers with the phone numbers `+1-212-415-1234` and `+1 (551) 234-1567` but not + // `+1-212-415-1200`. A match is found if a tokenized phone number contains all the tokens in the search query, irrespective of the token order. + PhoneNumber *CustomerTextFilter `json:"phone_number,omitempty" url:"phone_number,omitempty"` + // A filter to [select customers by their reference IDs](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#search-by-reference-id). + // This filter is case-insensitive. + // + // [Exact matching](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#exact-search-by-reference-id) + // of a customer's reference ID against a query's reference ID is evaluated as an + // exact match between two strings, character by character in the given order. + // + // [Fuzzy matching](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#fuzzy-search-by-reference-id) + // of stored reference IDs against queried reference IDs works + // exactly the same as fuzzy matching on email addresses. Non-alphanumeric characters + // are replaced by spaces to tokenize stored and queried reference IDs. A match is found + // if a tokenized stored reference ID contains all tokens specified in any order in the query. For example, + // a query of `NYC M` matches customer profiles with the `reference_id` value of `NYC_M_35_JOHNSON` + // and `NYC_27_MURRAY`. + ReferenceID *CustomerTextFilter `json:"reference_id,omitempty" url:"reference_id,omitempty"` + // A filter to select customers based on the [groups](entity:CustomerGroup) they belong to. + // Group membership is controlled by sellers and developers. + // + // The `group_ids` filter has the following syntax: + // + // ``` + // "group_ids": { + // "any": ["{group_a_id}", "{group_b_id}", ...], + // "all": ["{group_1_id}", "{group_2_id}", ...], + // "none": ["{group_i_id}", "{group_ii_id}", ...] + // } + // ``` + // + // You can use any combination of the `any`, `all`, and `none` fields in the filter. + // With `any`, the search returns customers in groups `a` or `b` or any other group specified in the list. + // With `all`, the search returns customers in groups `1` and `2` and all other groups specified in the list. + // With `none`, the search returns customers not in groups `i` or `ii` or any other group specified in the list. + // + // If any of the search conditions are not met, including when an invalid or non-existent group ID is provided, + // the result is an empty object (`{}`). + GroupIDs *FilterValue `json:"group_ids,omitempty" url:"group_ids,omitempty"` + // A filter to select customers based on one or more custom attributes. + // This filter can contain up to 10 custom attribute filters. Each custom attribute filter specifies filtering criteria for a target custom + // attribute. If multiple custom attribute filters are provided, they are combined as an `AND` operation. + // + // To be valid for a search, the custom attributes must be visible to the requesting application. For more information, including example queries, + // see [Search by custom attribute](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#search-by-custom-attribute). + // + // Square returns matching customer profiles, which do not contain custom attributes. To retrieve customer-related custom attributes, + // use the [Customer Custom Attributes API](api:CustomerCustomAttributes). For example, you can call + // [RetrieveCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-RetrieveCustomerCustomAttribute) using a customer ID from the result set. + CustomAttribute *CustomerCustomAttributeFilters `json:"custom_attribute,omitempty" url:"custom_attribute,omitempty"` + // A filter to select customers based on the [segments](entity:CustomerSegment) they belong to. + // Segment membership is dynamic and adjusts automatically based on whether customers meet the segment criteria. + // + // You can provide up to three segment IDs in the filter, using any combination of the `all`, `any`, and `none` fields. + // For the following example, the results include customers who belong to both segment A and segment B but do not belong to segment C. + // + // ``` + // "segment_ids": { + // "all": ["{segment_A_id}", "{segment_B_id}"], + // "none": ["{segment_C_id}"] + // } + // ``` + // + // If an invalid or non-existent segment ID is provided in the filter, Square stops processing the request + // and returns a `400 BAD_REQUEST` error that includes the segment ID. + SegmentIDs *FilterValue `json:"segment_ids,omitempty" url:"segment_ids,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerFilter) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerFilter) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerFilter + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerFilter(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerFilter) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Represents a group of customer profiles. +// +// Customer groups can be created, be modified, and have their membership defined using +// the Customers API or within the Customer Directory in the Square Seller Dashboard or Point of Sale. +type CustomerGroup struct { + // A unique Square-generated ID for the customer group. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The name of the customer group. + Name string `json:"name" url:"name"` + // The timestamp when the customer group was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The timestamp when the customer group was last updated, in RFC 3339 format. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerGroup) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerGroup) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerGroup + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerGroup(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerGroup) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Contains some brief information about a Customer Group with its identifier included. +type CustomerGroupInfo struct { + // The ID of the Customer Group. + ID string `json:"id" url:"id"` + // The name of the Customer Group. + Name string `json:"name" url:"name"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerGroupInfo) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerGroupInfo) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerGroupInfo + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerGroupInfo(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerGroupInfo) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Indicates whether customers should be included in, or excluded from, +// the result set when they match the filtering criteria. +type CustomerInclusionExclusion string + +const ( + CustomerInclusionExclusionInclude CustomerInclusionExclusion = "INCLUDE" + CustomerInclusionExclusionExclude CustomerInclusionExclusion = "EXCLUDE" +) + +func NewCustomerInclusionExclusionFromString(s string) (CustomerInclusionExclusion, error) { + switch s { + case "INCLUDE": + return CustomerInclusionExclusionInclude, nil + case "EXCLUDE": + return CustomerInclusionExclusionExclude, nil + } + var t CustomerInclusionExclusion + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c CustomerInclusionExclusion) Ptr() *CustomerInclusionExclusion { + return &c +} + +// Represents communication preferences for the customer profile. +type CustomerPreferences struct { + // Indicates whether the customer has unsubscribed from marketing campaign emails. A value of `true` means that the customer chose to opt out of email marketing from the current Square seller or from all Square sellers. This value is read-only from the Customers API. + EmailUnsubscribed *bool `json:"email_unsubscribed,omitempty" url:"email_unsubscribed,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerPreferences) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerPreferences) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerPreferences + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerPreferences(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerPreferences) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Represents filtering and sorting criteria for a [SearchCustomers](api-endpoint:Customers-SearchCustomers) request. +type CustomerQuery struct { + // The filtering criteria for the search query. A query can contain multiple filters in any combination. + // Multiple filters are combined as `AND` statements. + // + // **Note:** Combining multiple filters as `OR` statements is not supported. Instead, send multiple single-filter + // searches and join the result sets. + Filter *CustomerFilter `json:"filter,omitempty" url:"filter,omitempty"` + // Sorting criteria for query results. The default behavior is to sort + // customers alphabetically by `given_name` and `family_name`. + Sort *CustomerSort `json:"sort,omitempty" url:"sort,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerQuery) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerQuery) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerQuery + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerQuery(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerQuery) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Represents a group of customer profiles that match one or more predefined filter criteria. +// +// Segments (also known as Smart Groups) are defined and created within the Customer Directory in the +// Square Seller Dashboard or Point of Sale. +type CustomerSegment struct { + // A unique Square-generated ID for the segment. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The name of the segment. + Name string `json:"name" url:"name"` + // The timestamp when the segment was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The timestamp when the segment was last updated, in RFC 3339 format. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerSegment) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerSegment) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerSegment + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerSegment(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerSegment) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Represents the sorting criteria in a [search query](entity:CustomerQuery) that defines how to sort +// customer profiles returned in [SearchCustomers](api-endpoint:Customers-SearchCustomers) results. +type CustomerSort struct { + // Indicates the fields to use as the sort key, which is either the default set of fields or `created_at`. + // + // The default value is `DEFAULT`. + // See [CustomerSortField](#type-customersortfield) for possible values + Field *CustomerSortField `json:"field,omitempty" url:"field,omitempty"` + // Indicates the order in which results should be sorted based on the + // sort field value. Strings use standard alphabetic comparison + // to determine order. Strings representing numbers are sorted as strings. + // + // The default value is `ASC`. + // See [SortOrder](#type-sortorder) for possible values + Order *SortOrder `json:"order,omitempty" url:"order,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerSort) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerSort) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerSort + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerSort(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerSort) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Specifies customer attributes as the sort key to customer profiles returned from a search. +type CustomerSortField string + +const ( + CustomerSortFieldDefault CustomerSortField = "DEFAULT" + CustomerSortFieldCreatedAt CustomerSortField = "CREATED_AT" +) + +func NewCustomerSortFieldFromString(s string) (CustomerSortField, error) { + switch s { + case "DEFAULT": + return CustomerSortFieldDefault, nil + case "CREATED_AT": + return CustomerSortFieldCreatedAt, nil + } + var t CustomerSortField + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c CustomerSortField) Ptr() *CustomerSortField { + return &c +} + +// Represents the tax ID associated with a [customer profile](entity:Customer). The corresponding `tax_ids` field is available only for customers of sellers in EU countries or the United Kingdom. +// For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids). +type CustomerTaxIDs struct { + // The EU VAT identification number for the customer. For example, `IE3426675K`. The ID can contain alphanumeric characters only. + EuVat *string `json:"eu_vat,omitempty" url:"eu_vat,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerTaxIDs) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerTaxIDs) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerTaxIDs + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerTaxIDs(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerTaxIDs) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// A filter to select customers based on exact or fuzzy matching of +// customer attributes against a specified query. Depending on the customer attributes, +// the filter can be case-sensitive. This filter can be exact or fuzzy, but it cannot be both. +type CustomerTextFilter struct { + // Use the exact filter to select customers whose attributes match exactly the specified query. + Exact *string `json:"exact,omitempty" url:"exact,omitempty"` + // Use the fuzzy filter to select customers whose attributes match the specified query + // in a fuzzy manner. When the fuzzy option is used, search queries are tokenized, and then + // each query token must be matched somewhere in the searched attribute. For single token queries, + // this is effectively the same behavior as a partial match operation. + Fuzzy *string `json:"fuzzy,omitempty" url:"fuzzy,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerTextFilter) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerTextFilter) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerTextFilter + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerTextFilter(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerTextFilter) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Published when a [customer](entity:Customer) is updated. For more information, see [Use Customer Webhooks](https://developer.squareup.com/docs/customers-api/use-the-api/customer-webhooks). +// +// Updates to the following customer fields do not invoke a `customer.updated` event: `cards` (deprecated) and `segment_ids`. In addition, the `customer` object in the event notification does not include these fields. +type CustomerUpdatedEvent struct { + // The ID of the seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event. For this object, the value is `customer.updated`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The unique ID of the event, which is used for [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *CustomerUpdatedEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerUpdatedEvent) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerUpdatedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerUpdatedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerUpdatedEvent) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// The data associated with the event. +type CustomerUpdatedEventData struct { + // The type of object affected by the event. For this event, the value is `customer`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The ID of the updated customer. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object that contains the updated customer. + Object *CustomerUpdatedEventObject `json:"object,omitempty" url:"object,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerUpdatedEventData) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerUpdatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerUpdatedEventData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerUpdatedEventData(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerUpdatedEventData) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// An object that contains the customer associated with the event. +type CustomerUpdatedEventObject struct { + // The updated customer. + Customer *Customer `json:"customer,omitempty" url:"customer,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (c *CustomerUpdatedEventObject) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CustomerUpdatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler CustomerUpdatedEventObject + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomerUpdatedEventObject(value) + + extraProperties, err := core.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomerUpdatedEventObject) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +type DataCollectionOptions struct { + // The title text to display in the data collection flow on the Terminal. + Title string `json:"title" url:"title"` + // The body text to display under the title in the data collection screen flow on the + // Terminal. + Body string `json:"body" url:"body"` + // Represents the type of the input text. + // See [InputType](#type-inputtype) for possible values + InputType DataCollectionOptionsInputType `json:"input_type" url:"input_type"` + // The buyer’s input text from the data collection screen. + CollectedData *CollectedData `json:"collected_data,omitempty" url:"collected_data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DataCollectionOptions) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DataCollectionOptions) UnmarshalJSON(data []byte) error { + type unmarshaler DataCollectionOptions + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DataCollectionOptions(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DataCollectionOptions) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Describes the input type of the data. +type DataCollectionOptionsInputType string + +const ( + DataCollectionOptionsInputTypeInvalidType DataCollectionOptionsInputType = "INVALID_TYPE" + DataCollectionOptionsInputTypeEmail DataCollectionOptionsInputType = "EMAIL" + DataCollectionOptionsInputTypePhoneNumber DataCollectionOptionsInputType = "PHONE_NUMBER" +) + +func NewDataCollectionOptionsInputTypeFromString(s string) (DataCollectionOptionsInputType, error) { + switch s { + case "INVALID_TYPE": + return DataCollectionOptionsInputTypeInvalidType, nil + case "EMAIL": + return DataCollectionOptionsInputTypeEmail, nil + case "PHONE_NUMBER": + return DataCollectionOptionsInputTypePhoneNumber, nil + } + var t DataCollectionOptionsInputType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (d DataCollectionOptionsInputType) Ptr() *DataCollectionOptionsInputType { + return &d +} + +// A range defined by two dates. Used for filtering a query for Connect v2 +// objects that have date properties. +type DateRange struct { + // A string in `YYYY-MM-DD` format, such as `2017-10-31`, per the ISO 8601 + // extended format for calendar dates. + // The beginning of a date range (inclusive). + StartDate *string `json:"start_date,omitempty" url:"start_date,omitempty"` + // A string in `YYYY-MM-DD` format, such as `2017-10-31`, per the ISO 8601 + // extended format for calendar dates. + // The end of a date range (inclusive). + EndDate *string `json:"end_date,omitempty" url:"end_date,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DateRange) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DateRange) UnmarshalJSON(data []byte) error { + type unmarshaler DateRange + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DateRange(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DateRange) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Indicates the specific day of the week. +type DayOfWeek string + +const ( + DayOfWeekSun DayOfWeek = "SUN" + DayOfWeekMon DayOfWeek = "MON" + DayOfWeekTue DayOfWeek = "TUE" + DayOfWeekWed DayOfWeek = "WED" + DayOfWeekThu DayOfWeek = "THU" + DayOfWeekFri DayOfWeek = "FRI" + DayOfWeekSat DayOfWeek = "SAT" +) + +func NewDayOfWeekFromString(s string) (DayOfWeek, error) { + switch s { + case "SUN": + return DayOfWeekSun, nil + case "MON": + return DayOfWeekMon, nil + case "TUE": + return DayOfWeekTue, nil + case "WED": + return DayOfWeekWed, nil + case "THU": + return DayOfWeekThu, nil + case "FRI": + return DayOfWeekFri, nil + case "SAT": + return DayOfWeekSat, nil + } + var t DayOfWeek + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (d DayOfWeek) Ptr() *DayOfWeek { + return &d +} + +// Represents a [DeleteBookingCustomAttributeDefinition](api-endpoint:BookingCustomAttributes-DeleteBookingCustomAttributeDefinition) request. +type DeleteBookingCustomAttributeDefinitionRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteBookingCustomAttributeDefinitionRequest) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteBookingCustomAttributeDefinitionRequest) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteBookingCustomAttributeDefinitionRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteBookingCustomAttributeDefinitionRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteBookingCustomAttributeDefinitionRequest) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Represents a [DeleteBookingCustomAttributeDefinition](api-endpoint:BookingCustomAttributes-DeleteBookingCustomAttributeDefinition) response +// containing error messages when errors occurred during the request. The successful response does not contain any payload. +type DeleteBookingCustomAttributeDefinitionResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteBookingCustomAttributeDefinitionResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteBookingCustomAttributeDefinitionResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteBookingCustomAttributeDefinitionResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteBookingCustomAttributeDefinitionResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteBookingCustomAttributeDefinitionResponse) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Represents a [DeleteBookingCustomAttribute](api-endpoint:BookingCustomAttributes-DeleteBookingCustomAttribute) request. +type DeleteBookingCustomAttributeRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteBookingCustomAttributeRequest) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteBookingCustomAttributeRequest) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteBookingCustomAttributeRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteBookingCustomAttributeRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteBookingCustomAttributeRequest) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Represents a [DeleteBookingCustomAttribute](api-endpoint:BookingCustomAttributes-DeleteBookingCustomAttribute) response. +// Either an empty object `{}` (for a successful deletion) or `errors` is present in the response. +type DeleteBookingCustomAttributeResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteBookingCustomAttributeResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteBookingCustomAttributeResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteBookingCustomAttributeResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteBookingCustomAttributeResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteBookingCustomAttributeResponse) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// A request to delete a `BreakType`. +type DeleteBreakTypeRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteBreakTypeRequest) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteBreakTypeRequest) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteBreakTypeRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteBreakTypeRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteBreakTypeRequest) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// The response to a request to delete a `BreakType`. The response might contain a set +// of `Error` objects if the request resulted in errors. +type DeleteBreakTypeResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteBreakTypeResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteBreakTypeResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteBreakTypeResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteBreakTypeResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteBreakTypeResponse) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DeleteCatalogObjectRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteCatalogObjectRequest) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteCatalogObjectRequest) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteCatalogObjectRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteCatalogObjectRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteCatalogObjectRequest) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DeleteCatalogObjectResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The IDs of all catalog objects deleted by this request. + // Multiple IDs may be returned when associated objects are also deleted, for example + // a catalog item variation will be deleted (and its ID included in this field) + // when its parent catalog item is deleted. + DeletedObjectIDs []string `json:"deleted_object_ids,omitempty" url:"deleted_object_ids,omitempty"` + // The database [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // of this deletion in RFC 3339 format, e.g., `2016-09-04T23:59:33.123Z`. + DeletedAt *string `json:"deleted_at,omitempty" url:"deleted_at,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteCatalogObjectResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteCatalogObjectResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteCatalogObjectResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteCatalogObjectResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteCatalogObjectResponse) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Defines the fields that are included in requests to the +// `DeleteCustomerCard` endpoint. +type DeleteCustomerCardRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteCustomerCardRequest) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteCustomerCardRequest) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteCustomerCardRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteCustomerCardRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteCustomerCardRequest) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Defines the fields that are included in the response body of +// a request to the `DeleteCustomerCard` endpoint. +type DeleteCustomerCardResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteCustomerCardResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteCustomerCardResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteCustomerCardResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteCustomerCardResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteCustomerCardResponse) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Represents a [DeleteCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-DeleteCustomerCustomAttributeDefinition) request. +type DeleteCustomerCustomAttributeDefinitionRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteCustomerCustomAttributeDefinitionRequest) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteCustomerCustomAttributeDefinitionRequest) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteCustomerCustomAttributeDefinitionRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteCustomerCustomAttributeDefinitionRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteCustomerCustomAttributeDefinitionRequest) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Represents a response from a delete request containing error messages if there are any. +type DeleteCustomerCustomAttributeDefinitionResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteCustomerCustomAttributeDefinitionResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteCustomerCustomAttributeDefinitionResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteCustomerCustomAttributeDefinitionResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteCustomerCustomAttributeDefinitionResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteCustomerCustomAttributeDefinitionResponse) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Represents a [DeleteCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-DeleteCustomerCustomAttribute) request. +type DeleteCustomerCustomAttributeRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteCustomerCustomAttributeRequest) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteCustomerCustomAttributeRequest) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteCustomerCustomAttributeRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteCustomerCustomAttributeRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteCustomerCustomAttributeRequest) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Represents a [DeleteCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-DeleteCustomerCustomAttribute) response. +// Either an empty object `{}` (for a successful deletion) or `errors` is present in the response. +type DeleteCustomerCustomAttributeResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteCustomerCustomAttributeResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteCustomerCustomAttributeResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteCustomerCustomAttributeResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteCustomerCustomAttributeResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteCustomerCustomAttributeResponse) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Defines the fields that can be included in a request to the +// [DeleteCustomerGroup](api-endpoint:CustomerGroups-DeleteCustomerGroup) endpoint. +type DeleteCustomerGroupRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteCustomerGroupRequest) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteCustomerGroupRequest) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteCustomerGroupRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteCustomerGroupRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteCustomerGroupRequest) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Defines the fields that are included in the response body of +// a request to the [DeleteCustomerGroup](api-endpoint:CustomerGroups-DeleteCustomerGroup) endpoint. +type DeleteCustomerGroupResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteCustomerGroupResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteCustomerGroupResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteCustomerGroupResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteCustomerGroupResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteCustomerGroupResponse) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Defines the fields that are included in a request to the `DeleteCustomer` +// endpoint. +type DeleteCustomerRequest struct { + // The current version of the customer profile. + // + // As a best practice, you should include this parameter to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control. For more information, see [Delete a customer profile](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#delete-customer-profile). + Version *int64 `json:"version,omitempty" url:"version,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteCustomerRequest) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteCustomerRequest) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteCustomerRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteCustomerRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteCustomerRequest) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Defines the fields that are included in the response body of +// a request to the `DeleteCustomer` endpoint. +type DeleteCustomerResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteCustomerResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteCustomerResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteCustomerResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteCustomerResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteCustomerResponse) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Defines the parameters for a `DeleteDisputeEvidence` request. +type DeleteDisputeEvidenceRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteDisputeEvidenceRequest) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteDisputeEvidenceRequest) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteDisputeEvidenceRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteDisputeEvidenceRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteDisputeEvidenceRequest) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Defines the fields in a `DeleteDisputeEvidence` response. +type DeleteDisputeEvidenceResponse struct { + // Information about errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteDisputeEvidenceResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteDisputeEvidenceResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteDisputeEvidenceResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteDisputeEvidenceResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteDisputeEvidenceResponse) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Represents a [DeleteInvoiceAttachment](api-endpoint:Invoices-DeleteInvoiceAttachment) request. +type DeleteInvoiceAttachmentRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteInvoiceAttachmentRequest) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteInvoiceAttachmentRequest) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteInvoiceAttachmentRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteInvoiceAttachmentRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteInvoiceAttachmentRequest) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Represents a [DeleteInvoiceAttachment](api-endpoint:Invoices-DeleteInvoiceAttachment) response. +type DeleteInvoiceAttachmentResponse struct { + // Information about errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteInvoiceAttachmentResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteInvoiceAttachmentResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteInvoiceAttachmentResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteInvoiceAttachmentResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteInvoiceAttachmentResponse) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Describes a `DeleteInvoice` request. +type DeleteInvoiceRequest struct { + // The version of the [invoice](entity:Invoice) to delete. + // If you do not know the version, you can call [GetInvoice](api-endpoint:Invoices-GetInvoice) or + // [ListInvoices](api-endpoint:Invoices-ListInvoices). + Version *int `json:"version,omitempty" url:"version,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteInvoiceRequest) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteInvoiceRequest) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteInvoiceRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteInvoiceRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteInvoiceRequest) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Describes a `DeleteInvoice` response. +type DeleteInvoiceResponse struct { + // Information about errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteInvoiceResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteInvoiceResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteInvoiceResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteInvoiceResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteInvoiceResponse) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Represents a [DeleteLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-DeleteLocationCustomAttributeDefinition) request. +type DeleteLocationCustomAttributeDefinitionRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteLocationCustomAttributeDefinitionRequest) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteLocationCustomAttributeDefinitionRequest) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteLocationCustomAttributeDefinitionRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteLocationCustomAttributeDefinitionRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteLocationCustomAttributeDefinitionRequest) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Represents a response from a delete request containing error messages if there are any. +type DeleteLocationCustomAttributeDefinitionResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteLocationCustomAttributeDefinitionResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteLocationCustomAttributeDefinitionResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteLocationCustomAttributeDefinitionResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteLocationCustomAttributeDefinitionResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteLocationCustomAttributeDefinitionResponse) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Represents a [DeleteLocationCustomAttribute](api-endpoint:LocationCustomAttributes-DeleteLocationCustomAttribute) request. +type DeleteLocationCustomAttributeRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteLocationCustomAttributeRequest) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteLocationCustomAttributeRequest) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteLocationCustomAttributeRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteLocationCustomAttributeRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteLocationCustomAttributeRequest) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Represents a [DeleteLocationCustomAttribute](api-endpoint:LocationCustomAttributes-DeleteLocationCustomAttribute) response. +// Either an empty object `{}` (for a successful deletion) or `errors` is present in the response. +type DeleteLocationCustomAttributeResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteLocationCustomAttributeResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteLocationCustomAttributeResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteLocationCustomAttributeResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteLocationCustomAttributeResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteLocationCustomAttributeResponse) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// A request to delete a loyalty reward. +type DeleteLoyaltyRewardRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteLoyaltyRewardRequest) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteLoyaltyRewardRequest) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteLoyaltyRewardRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteLoyaltyRewardRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteLoyaltyRewardRequest) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// A response returned by the API call. +type DeleteLoyaltyRewardResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteLoyaltyRewardResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteLoyaltyRewardResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteLoyaltyRewardResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteLoyaltyRewardResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteLoyaltyRewardResponse) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Represents a [DeleteMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-DeleteMerchantCustomAttributeDefinition) request. +type DeleteMerchantCustomAttributeDefinitionRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteMerchantCustomAttributeDefinitionRequest) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteMerchantCustomAttributeDefinitionRequest) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteMerchantCustomAttributeDefinitionRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteMerchantCustomAttributeDefinitionRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteMerchantCustomAttributeDefinitionRequest) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Represents a response from a delete request containing error messages if there are any. +type DeleteMerchantCustomAttributeDefinitionResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteMerchantCustomAttributeDefinitionResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteMerchantCustomAttributeDefinitionResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteMerchantCustomAttributeDefinitionResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteMerchantCustomAttributeDefinitionResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteMerchantCustomAttributeDefinitionResponse) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Represents a [DeleteMerchantCustomAttribute](api-endpoint:MerchantCustomAttributes-DeleteMerchantCustomAttribute) request. +type DeleteMerchantCustomAttributeRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteMerchantCustomAttributeRequest) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteMerchantCustomAttributeRequest) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteMerchantCustomAttributeRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteMerchantCustomAttributeRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteMerchantCustomAttributeRequest) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Represents a [DeleteMerchantCustomAttribute](api-endpoint:MerchantCustomAttributes-DeleteMerchantCustomAttribute) response. +// Either an empty object `{}` (for a successful deletion) or `errors` is present in the response. +type DeleteMerchantCustomAttributeResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteMerchantCustomAttributeResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteMerchantCustomAttributeResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteMerchantCustomAttributeResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteMerchantCustomAttributeResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteMerchantCustomAttributeResponse) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Represents a delete request for an order custom attribute definition. +type DeleteOrderCustomAttributeDefinitionRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteOrderCustomAttributeDefinitionRequest) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteOrderCustomAttributeDefinitionRequest) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteOrderCustomAttributeDefinitionRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteOrderCustomAttributeDefinitionRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteOrderCustomAttributeDefinitionRequest) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Represents a response from deleting an order custom attribute definition. +type DeleteOrderCustomAttributeDefinitionResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteOrderCustomAttributeDefinitionResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteOrderCustomAttributeDefinitionResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteOrderCustomAttributeDefinitionResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteOrderCustomAttributeDefinitionResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteOrderCustomAttributeDefinitionResponse) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Represents a delete request for an order custom attribute. +type DeleteOrderCustomAttributeRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteOrderCustomAttributeRequest) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteOrderCustomAttributeRequest) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteOrderCustomAttributeRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteOrderCustomAttributeRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteOrderCustomAttributeRequest) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Represents a response from deleting an order custom attribute. +type DeleteOrderCustomAttributeResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteOrderCustomAttributeResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteOrderCustomAttributeResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteOrderCustomAttributeResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteOrderCustomAttributeResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteOrderCustomAttributeResponse) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DeletePaymentLinkRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeletePaymentLinkRequest) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeletePaymentLinkRequest) UnmarshalJSON(data []byte) error { + type unmarshaler DeletePaymentLinkRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeletePaymentLinkRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeletePaymentLinkRequest) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DeletePaymentLinkResponse struct { + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The ID of the link that is deleted. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The ID of the order that is canceled. When a payment link is deleted, Square updates the + // the `state` (of the order that the checkout link created) to CANCELED. + CancelledOrderID *string `json:"cancelled_order_id,omitempty" url:"cancelled_order_id,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeletePaymentLinkResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeletePaymentLinkResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DeletePaymentLinkResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeletePaymentLinkResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeletePaymentLinkResponse) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// A request to delete a `Shift`. +type DeleteShiftRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteShiftRequest) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteShiftRequest) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteShiftRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteShiftRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteShiftRequest) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// The response to a request to delete a `Shift`. The response might contain a set of +// `Error` objects if the request resulted in errors. +type DeleteShiftResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteShiftResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteShiftResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteShiftResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteShiftResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteShiftResponse) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Represents a `DeleteSnippet` request. +type DeleteSnippetRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteSnippetRequest) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteSnippetRequest) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteSnippetRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteSnippetRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteSnippetRequest) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Represents a `DeleteSnippet` response. +type DeleteSnippetResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteSnippetResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteSnippetResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteSnippetResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteSnippetResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteSnippetResponse) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Defines input parameters in a call to the +// [DeleteSubscriptionAction](api-endpoint:Subscriptions-DeleteSubscriptionAction) +// endpoint. +type DeleteSubscriptionActionRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteSubscriptionActionRequest) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteSubscriptionActionRequest) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteSubscriptionActionRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteSubscriptionActionRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteSubscriptionActionRequest) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Defines output parameters in a response of the [DeleteSubscriptionAction](api-endpoint:Subscriptions-DeleteSubscriptionAction) +// endpoint. +type DeleteSubscriptionActionResponse struct { + // Errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The subscription that has the specified action deleted. + Subscription *Subscription `json:"subscription,omitempty" url:"subscription,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteSubscriptionActionResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteSubscriptionActionResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteSubscriptionActionResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteSubscriptionActionResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteSubscriptionActionResponse) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Deletes a [Subscription](entity:WebhookSubscription). +type DeleteWebhookSubscriptionRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteWebhookSubscriptionRequest) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteWebhookSubscriptionRequest) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteWebhookSubscriptionRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteWebhookSubscriptionRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteWebhookSubscriptionRequest) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Defines the fields that are included in the response body of +// a request to the [DeleteWebhookSubscription](api-endpoint:WebhookSubscriptions-DeleteWebhookSubscription) endpoint. +type DeleteWebhookSubscriptionResponse struct { + // Information on errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeleteWebhookSubscriptionResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteWebhookSubscriptionResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteWebhookSubscriptionResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteWebhookSubscriptionResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteWebhookSubscriptionResponse) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Defines the parameters for a `DeprecatedCreateDisputeEvidenceFile` request. +type DeprecatedCreateDisputeEvidenceFileRequest struct { + // The Unique ID. For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). + IdempotencyKey string `json:"idempotency_key" url:"idempotency_key"` + // The type of evidence you are uploading. + // See [DisputeEvidenceType](#type-disputeevidencetype) for possible values + EvidenceType *DisputeEvidenceType `json:"evidence_type,omitempty" url:"evidence_type,omitempty"` + // The MIME type of the uploaded file. + // The type can be image/heic, image/heif, image/jpeg, application/pdf, image/png, or image/tiff. + ContentType *string `json:"content_type,omitempty" url:"content_type,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeprecatedCreateDisputeEvidenceFileRequest) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeprecatedCreateDisputeEvidenceFileRequest) UnmarshalJSON(data []byte) error { + type unmarshaler DeprecatedCreateDisputeEvidenceFileRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeprecatedCreateDisputeEvidenceFileRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeprecatedCreateDisputeEvidenceFileRequest) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Defines the fields in a `DeprecatedCreateDisputeEvidenceFile` response. +type DeprecatedCreateDisputeEvidenceFileResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The metadata of the newly uploaded dispute evidence. + Evidence *DisputeEvidence `json:"evidence,omitempty" url:"evidence,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeprecatedCreateDisputeEvidenceFileResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeprecatedCreateDisputeEvidenceFileResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DeprecatedCreateDisputeEvidenceFileResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeprecatedCreateDisputeEvidenceFileResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeprecatedCreateDisputeEvidenceFileResponse) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Defines the parameters for a `DeprecatedCreateDisputeEvidenceText` request. +type DeprecatedCreateDisputeEvidenceTextRequest struct { + // The Unique ID. For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). + IdempotencyKey string `json:"idempotency_key" url:"idempotency_key"` + // The type of evidence you are uploading. + // See [DisputeEvidenceType](#type-disputeevidencetype) for possible values + EvidenceType *DisputeEvidenceType `json:"evidence_type,omitempty" url:"evidence_type,omitempty"` + // The evidence string. + EvidenceText string `json:"evidence_text" url:"evidence_text"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeprecatedCreateDisputeEvidenceTextRequest) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeprecatedCreateDisputeEvidenceTextRequest) UnmarshalJSON(data []byte) error { + type unmarshaler DeprecatedCreateDisputeEvidenceTextRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeprecatedCreateDisputeEvidenceTextRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeprecatedCreateDisputeEvidenceTextRequest) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Defines the fields in a `DeprecatedCreateDisputeEvidenceText` response. +type DeprecatedCreateDisputeEvidenceTextResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The newly uploaded dispute evidence metadata. + Evidence *DisputeEvidence `json:"evidence,omitempty" url:"evidence,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeprecatedCreateDisputeEvidenceTextResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeprecatedCreateDisputeEvidenceTextResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DeprecatedCreateDisputeEvidenceTextResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeprecatedCreateDisputeEvidenceTextResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeprecatedCreateDisputeEvidenceTextResponse) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Information about the destination against which the payout was made. +type Destination struct { + // Type of the destination such as a bank account or debit card. + // See [DestinationType](#type-destinationtype) for possible values + Type *DestinationType `json:"type,omitempty" url:"type,omitempty"` + // Square issued unique ID (also known as the instrument ID) associated with this destination. + ID *string `json:"id,omitempty" url:"id,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *Destination) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *Destination) UnmarshalJSON(data []byte) error { + type unmarshaler Destination + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = Destination(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *Destination) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Details about a refund's destination. +type DestinationDetails struct { + // Details about a card refund. Only populated if the destination_type is `CARD`. + CardDetails *DestinationDetailsCardRefundDetails `json:"card_details,omitempty" url:"card_details,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DestinationDetails) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DestinationDetails) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationDetails + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DestinationDetails(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DestinationDetails) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DestinationDetailsCardRefundDetails struct { + // The card's non-confidential details. + Card *Card `json:"card,omitempty" url:"card,omitempty"` + // The method used to enter the card's details for the refund. The method can be + // `KEYED`, `SWIPED`, `EMV`, `ON_FILE`, or `CONTACTLESS`. + EntryMethod *string `json:"entry_method,omitempty" url:"entry_method,omitempty"` + // The authorization code provided by the issuer when a refund is approved. + AuthResultCode *string `json:"auth_result_code,omitempty" url:"auth_result_code,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DestinationDetailsCardRefundDetails) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DestinationDetailsCardRefundDetails) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationDetailsCardRefundDetails + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DestinationDetailsCardRefundDetails(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DestinationDetailsCardRefundDetails) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// List of possible destinations against which a payout can be made. +type DestinationType string + +const ( + DestinationTypeUnknownDestinationTypeDoNotUse DestinationType = "UNKNOWN_DESTINATION_TYPE_DO_NOT_USE" + DestinationTypeBankAccount DestinationType = "BANK_ACCOUNT" + DestinationTypeCard DestinationType = "CARD" + DestinationTypeSquareBalance DestinationType = "SQUARE_BALANCE" + DestinationTypeSquareStoredBalance DestinationType = "SQUARE_STORED_BALANCE" + DestinationTypeDestinationTypePending DestinationType = "DESTINATION_TYPE_PENDING" +) + +func NewDestinationTypeFromString(s string) (DestinationType, error) { + switch s { + case "UNKNOWN_DESTINATION_TYPE_DO_NOT_USE": + return DestinationTypeUnknownDestinationTypeDoNotUse, nil + case "BANK_ACCOUNT": + return DestinationTypeBankAccount, nil + case "CARD": + return DestinationTypeCard, nil + case "SQUARE_BALANCE": + return DestinationTypeSquareBalance, nil + case "SQUARE_STORED_BALANCE": + return DestinationTypeSquareStoredBalance, nil + case "DESTINATION_TYPE_PENDING": + return DestinationTypeDestinationTypePending, nil + } + var t DestinationType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (d DestinationType) Ptr() *DestinationType { + return &d +} + +type Device struct { + // A synthetic identifier for the device. The identifier includes a standardized prefix and + // is otherwise an opaque id generated from key device fields. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // A collection of DeviceAttributes representing the device. + Attributes *DeviceAttributes `json:"attributes,omitempty" url:"attributes,omitempty"` + // A list of components applicable to the device. + Components []*Component `json:"components,omitempty" url:"components,omitempty"` + // The current status of the device. + Status *DeviceStatus `json:"status,omitempty" url:"status,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *Device) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *Device) UnmarshalJSON(data []byte) error { + type unmarshaler Device + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = Device(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *Device) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DeviceAttributes struct { + // The device type. + // See [DeviceType](#type-devicetype) for possible values + Type DeviceAttributesDeviceType `json:"type" url:"type"` + // The maker of the device. + Manufacturer string `json:"manufacturer" url:"manufacturer"` + // The specific model of the device. + Model *string `json:"model,omitempty" url:"model,omitempty"` + // A seller-specified name for the device. + Name *string `json:"name,omitempty" url:"name,omitempty"` + // The manufacturer-supplied identifier for the device (where available). In many cases, + // this identifier will be a serial number. + ManufacturersID *string `json:"manufacturers_id,omitempty" url:"manufacturers_id,omitempty"` + // The RFC 3339-formatted value of the most recent update to the device information. + // (Could represent any field update on the device.) + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // The current version of software installed on the device. + Version *string `json:"version,omitempty" url:"version,omitempty"` + // The merchant_token identifying the merchant controlling the device. + MerchantToken *string `json:"merchant_token,omitempty" url:"merchant_token,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeviceAttributes) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeviceAttributes) UnmarshalJSON(data []byte) error { + type unmarshaler DeviceAttributes + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeviceAttributes(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeviceAttributes) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// An enum identifier of the device type. +type DeviceAttributesDeviceType string + +const ( + DeviceAttributesDeviceTypeDeviceTypeInvalidType DeviceAttributesDeviceType = "DEVICE_TYPE_INVALID_TYPE" + DeviceAttributesDeviceTypeTerminal DeviceAttributesDeviceType = "TERMINAL" + DeviceAttributesDeviceTypeRegister DeviceAttributesDeviceType = "REGISTER" + DeviceAttributesDeviceTypeIos DeviceAttributesDeviceType = "IOS" + DeviceAttributesDeviceTypeAndroid DeviceAttributesDeviceType = "ANDROID" + DeviceAttributesDeviceTypeCashDrawer DeviceAttributesDeviceType = "CASH_DRAWER" + DeviceAttributesDeviceTypePrinter DeviceAttributesDeviceType = "PRINTER" + DeviceAttributesDeviceTypeReader DeviceAttributesDeviceType = "READER" + DeviceAttributesDeviceTypeScale DeviceAttributesDeviceType = "SCALE" + DeviceAttributesDeviceTypeBarcodeScanner DeviceAttributesDeviceType = "BARCODE_SCANNER" + DeviceAttributesDeviceTypeStand DeviceAttributesDeviceType = "STAND" + DeviceAttributesDeviceTypeInternalPrinter DeviceAttributesDeviceType = "INTERNAL_PRINTER" + DeviceAttributesDeviceTypeScannerScale DeviceAttributesDeviceType = "SCANNER_SCALE" +) + +func NewDeviceAttributesDeviceTypeFromString(s string) (DeviceAttributesDeviceType, error) { + switch s { + case "DEVICE_TYPE_INVALID_TYPE": + return DeviceAttributesDeviceTypeDeviceTypeInvalidType, nil + case "TERMINAL": + return DeviceAttributesDeviceTypeTerminal, nil + case "REGISTER": + return DeviceAttributesDeviceTypeRegister, nil + case "IOS": + return DeviceAttributesDeviceTypeIos, nil + case "ANDROID": + return DeviceAttributesDeviceTypeAndroid, nil + case "CASH_DRAWER": + return DeviceAttributesDeviceTypeCashDrawer, nil + case "PRINTER": + return DeviceAttributesDeviceTypePrinter, nil + case "READER": + return DeviceAttributesDeviceTypeReader, nil + case "SCALE": + return DeviceAttributesDeviceTypeScale, nil + case "BARCODE_SCANNER": + return DeviceAttributesDeviceTypeBarcodeScanner, nil + case "STAND": + return DeviceAttributesDeviceTypeStand, nil + case "INTERNAL_PRINTER": + return DeviceAttributesDeviceTypeInternalPrinter, nil + case "SCANNER_SCALE": + return DeviceAttributesDeviceTypeScannerScale, nil + } + var t DeviceAttributesDeviceType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (d DeviceAttributesDeviceType) Ptr() *DeviceAttributesDeviceType { + return &d +} + +type DeviceCheckoutOptions struct { + // The unique ID of the device intended for this `TerminalCheckout`. + // A list of `DeviceCode` objects can be retrieved from the /v2/devices/codes endpoint. + // Match a `DeviceCode.device_id` value with `device_id` to get the associated device code. + DeviceID string `json:"device_id" url:"device_id"` + // Instructs the device to skip the receipt screen. Defaults to false. + SkipReceiptScreen *bool `json:"skip_receipt_screen,omitempty" url:"skip_receipt_screen,omitempty"` + // Indicates that signature collection is desired during checkout. Defaults to false. + CollectSignature *bool `json:"collect_signature,omitempty" url:"collect_signature,omitempty"` + // Tip-specific settings. + TipSettings *TipSettings `json:"tip_settings,omitempty" url:"tip_settings,omitempty"` + // Show the itemization screen prior to taking a payment. This field is only meaningful when the + // checkout includes an order ID. Defaults to true. + ShowItemizedCart *bool `json:"show_itemized_cart,omitempty" url:"show_itemized_cart,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeviceCheckoutOptions) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeviceCheckoutOptions) UnmarshalJSON(data []byte) error { + type unmarshaler DeviceCheckoutOptions + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeviceCheckoutOptions(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeviceCheckoutOptions) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DeviceCode struct { + // The unique id for this device code. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An optional user-defined name for the device code. + Name *string `json:"name,omitempty" url:"name,omitempty"` + // The unique code that can be used to login. + Code *string `json:"code,omitempty" url:"code,omitempty"` + // The unique id of the device that used this code. Populated when the device is paired up. + DeviceID *string `json:"device_id,omitempty" url:"device_id,omitempty"` + // The targeting product type of the device code. + ProductType ProductType `json:"product_type" url:"product_type"` + // The location assigned to this code. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The pairing status of the device code. + // See [DeviceCodeStatus](#type-devicecodestatus) for possible values + Status *DeviceCodeStatus `json:"status,omitempty" url:"status,omitempty"` + // When this DeviceCode will expire and no longer login. Timestamp in RFC 3339 format. + PairBy *string `json:"pair_by,omitempty" url:"pair_by,omitempty"` + // When this DeviceCode was created. Timestamp in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // When this DeviceCode's status was last changed. Timestamp in RFC 3339 format. + StatusChangedAt *string `json:"status_changed_at,omitempty" url:"status_changed_at,omitempty"` + // When this DeviceCode was paired. Timestamp in RFC 3339 format. + PairedAt *string `json:"paired_at,omitempty" url:"paired_at,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeviceCode) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeviceCode) UnmarshalJSON(data []byte) error { + type unmarshaler DeviceCode + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeviceCode(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeviceCode) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Published when a Square Terminal has been paired with a +// Terminal API client and the device_id of the paired Square Terminal is +// available. +type DeviceCodePairedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The ID of the target location associated with the event. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The type of event this represents, `"device.code.paired"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // RFC 3339 timestamp of when the event was created. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *DeviceCodePairedEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeviceCodePairedEvent) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeviceCodePairedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler DeviceCodePairedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeviceCodePairedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeviceCodePairedEvent) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DeviceCodePairedEventData struct { + // Name of the paired object’s type, `"device_code"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the paired device code. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the paired device code. + Object *DeviceCodePairedEventObject `json:"object,omitempty" url:"object,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeviceCodePairedEventData) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeviceCodePairedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler DeviceCodePairedEventData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeviceCodePairedEventData(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeviceCodePairedEventData) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DeviceCodePairedEventObject struct { + // The created terminal checkout + DeviceCode *DeviceCode `json:"device_code,omitempty" url:"device_code,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeviceCodePairedEventObject) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeviceCodePairedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler DeviceCodePairedEventObject + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeviceCodePairedEventObject(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeviceCodePairedEventObject) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// DeviceCode.Status enum. +type DeviceCodeStatus string + +const ( + DeviceCodeStatusUnknown DeviceCodeStatus = "UNKNOWN" + DeviceCodeStatusUnpaired DeviceCodeStatus = "UNPAIRED" + DeviceCodeStatusPaired DeviceCodeStatus = "PAIRED" + DeviceCodeStatusExpired DeviceCodeStatus = "EXPIRED" +) + +func NewDeviceCodeStatusFromString(s string) (DeviceCodeStatus, error) { + switch s { + case "UNKNOWN": + return DeviceCodeStatusUnknown, nil + case "UNPAIRED": + return DeviceCodeStatusUnpaired, nil + case "PAIRED": + return DeviceCodeStatusPaired, nil + case "EXPIRED": + return DeviceCodeStatusExpired, nil + } + var t DeviceCodeStatus + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (d DeviceCodeStatus) Ptr() *DeviceCodeStatus { + return &d +} + +type DeviceComponentDetails struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeviceComponentDetails) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeviceComponentDetails) UnmarshalJSON(data []byte) error { + type unmarshaler DeviceComponentDetails + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeviceComponentDetails(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeviceComponentDetails) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DeviceComponentDetailsApplicationDetails struct { + // The type of application. + // See [ApplicationType](#type-applicationtype) for possible values + ApplicationType *ApplicationType `json:"application_type,omitempty" url:"application_type,omitempty"` + // The version of the application. + Version *string `json:"version,omitempty" url:"version,omitempty"` + // The location_id of the session for the application. + SessionLocation *string `json:"session_location,omitempty" url:"session_location,omitempty"` + // The id of the device code that was used to log in to the device. + DeviceCodeID *string `json:"device_code_id,omitempty" url:"device_code_id,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeviceComponentDetailsApplicationDetails) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeviceComponentDetailsApplicationDetails) UnmarshalJSON(data []byte) error { + type unmarshaler DeviceComponentDetailsApplicationDetails + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeviceComponentDetailsApplicationDetails(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeviceComponentDetailsApplicationDetails) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DeviceComponentDetailsBatteryDetails struct { + // The battery charge percentage as displayed on the device. + VisiblePercent *int `json:"visible_percent,omitempty" url:"visible_percent,omitempty"` + // The status of external_power. + // See [ExternalPower](#type-externalpower) for possible values + ExternalPower *DeviceComponentDetailsExternalPower `json:"external_power,omitempty" url:"external_power,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeviceComponentDetailsBatteryDetails) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeviceComponentDetailsBatteryDetails) UnmarshalJSON(data []byte) error { + type unmarshaler DeviceComponentDetailsBatteryDetails + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeviceComponentDetailsBatteryDetails(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeviceComponentDetailsBatteryDetails) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DeviceComponentDetailsCardReaderDetails struct { + // The version of the card reader. + Version *string `json:"version,omitempty" url:"version,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeviceComponentDetailsCardReaderDetails) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeviceComponentDetailsCardReaderDetails) UnmarshalJSON(data []byte) error { + type unmarshaler DeviceComponentDetailsCardReaderDetails + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeviceComponentDetailsCardReaderDetails(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeviceComponentDetailsCardReaderDetails) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DeviceComponentDetailsEthernetDetails struct { + // A boolean to represent whether the Ethernet interface is currently active. + Active *bool `json:"active,omitempty" url:"active,omitempty"` + // The string representation of the device’s IPv4 address. + IPAddressV4 *string `json:"ip_address_v4,omitempty" url:"ip_address_v4,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeviceComponentDetailsEthernetDetails) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeviceComponentDetailsEthernetDetails) UnmarshalJSON(data []byte) error { + type unmarshaler DeviceComponentDetailsEthernetDetails + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeviceComponentDetailsEthernetDetails(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeviceComponentDetailsEthernetDetails) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// An enum for ExternalPower. +type DeviceComponentDetailsExternalPower string + +const ( + DeviceComponentDetailsExternalPowerExternalPowerInvalidType DeviceComponentDetailsExternalPower = "EXTERNAL_POWER_INVALID_TYPE" + DeviceComponentDetailsExternalPowerAvailableCharging DeviceComponentDetailsExternalPower = "AVAILABLE_CHARGING" + DeviceComponentDetailsExternalPowerAvailableNotInUse DeviceComponentDetailsExternalPower = "AVAILABLE_NOT_IN_USE" + DeviceComponentDetailsExternalPowerUnavailable DeviceComponentDetailsExternalPower = "UNAVAILABLE" + DeviceComponentDetailsExternalPowerAvailableInsufficient DeviceComponentDetailsExternalPower = "AVAILABLE_INSUFFICIENT" +) + +func NewDeviceComponentDetailsExternalPowerFromString(s string) (DeviceComponentDetailsExternalPower, error) { + switch s { + case "EXTERNAL_POWER_INVALID_TYPE": + return DeviceComponentDetailsExternalPowerExternalPowerInvalidType, nil + case "AVAILABLE_CHARGING": + return DeviceComponentDetailsExternalPowerAvailableCharging, nil + case "AVAILABLE_NOT_IN_USE": + return DeviceComponentDetailsExternalPowerAvailableNotInUse, nil + case "UNAVAILABLE": + return DeviceComponentDetailsExternalPowerUnavailable, nil + case "AVAILABLE_INSUFFICIENT": + return DeviceComponentDetailsExternalPowerAvailableInsufficient, nil + } + var t DeviceComponentDetailsExternalPower + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (d DeviceComponentDetailsExternalPower) Ptr() *DeviceComponentDetailsExternalPower { + return &d +} + +// A value qualified by unit of measure. +type DeviceComponentDetailsMeasurement struct { + Value *int `json:"value,omitempty" url:"value,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeviceComponentDetailsMeasurement) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeviceComponentDetailsMeasurement) UnmarshalJSON(data []byte) error { + type unmarshaler DeviceComponentDetailsMeasurement + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeviceComponentDetailsMeasurement(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeviceComponentDetailsMeasurement) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DeviceComponentDetailsNetworkInterfaceDetails struct { + // The string representation of the device’s IPv4 address. + IPAddressV4 *string `json:"ip_address_v4,omitempty" url:"ip_address_v4,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeviceComponentDetailsNetworkInterfaceDetails) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeviceComponentDetailsNetworkInterfaceDetails) UnmarshalJSON(data []byte) error { + type unmarshaler DeviceComponentDetailsNetworkInterfaceDetails + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeviceComponentDetailsNetworkInterfaceDetails(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeviceComponentDetailsNetworkInterfaceDetails) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DeviceComponentDetailsWiFiDetails struct { + // A boolean to represent whether the WiFI interface is currently active. + Active *bool `json:"active,omitempty" url:"active,omitempty"` + // The name of the connected WIFI network. + Ssid *string `json:"ssid,omitempty" url:"ssid,omitempty"` + // The string representation of the device’s IPv4 address. + IPAddressV4 *string `json:"ip_address_v4,omitempty" url:"ip_address_v4,omitempty"` + // The security protocol for a secure connection (e.g. WPA2). None provided if the connection + // is unsecured. + SecureConnection *string `json:"secure_connection,omitempty" url:"secure_connection,omitempty"` + // A representation of signal strength of the WIFI network connection. + SignalStrength *DeviceComponentDetailsMeasurement `json:"signal_strength,omitempty" url:"signal_strength,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeviceComponentDetailsWiFiDetails) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeviceComponentDetailsWiFiDetails) UnmarshalJSON(data []byte) error { + type unmarshaler DeviceComponentDetailsWiFiDetails + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeviceComponentDetailsWiFiDetails(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeviceComponentDetailsWiFiDetails) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Published when a Device is created. +type DeviceCreatedEvent struct { + // The merchant the newly created device belongs to. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents. The value is `"device.created"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A UUID that uniquely identifies this device creation event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The time when the device creation event was first created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The metadata associated with the device creation event. + Data *DeviceCreatedEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeviceCreatedEvent) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeviceCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler DeviceCreatedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeviceCreatedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeviceCreatedEvent) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DeviceCreatedEventData struct { + // The type of the event data object. The value is `"device"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The ID of the device. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the created device. + Object *DeviceCreatedEventObject `json:"object,omitempty" url:"object,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeviceCreatedEventData) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeviceCreatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler DeviceCreatedEventData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeviceCreatedEventData(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeviceCreatedEventData) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DeviceCreatedEventObject struct { + // The created device. + Device *Device `json:"device,omitempty" url:"device,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeviceCreatedEventObject) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeviceCreatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler DeviceCreatedEventObject + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeviceCreatedEventObject(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeviceCreatedEventObject) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Details about the device that took the payment. +type DeviceDetails struct { + // The Square-issued ID of the device. + DeviceID *string `json:"device_id,omitempty" url:"device_id,omitempty"` + // The Square-issued installation ID for the device. + DeviceInstallationID *string `json:"device_installation_id,omitempty" url:"device_installation_id,omitempty"` + // The name of the device set by the seller. + DeviceName *string `json:"device_name,omitempty" url:"device_name,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeviceDetails) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeviceDetails) UnmarshalJSON(data []byte) error { + type unmarshaler DeviceDetails + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeviceDetails(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeviceDetails) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DeviceMetadata struct { + // The Terminal’s remaining battery percentage, between 1-100. + BatteryPercentage *string `json:"battery_percentage,omitempty" url:"battery_percentage,omitempty"` + // The current charging state of the Terminal. + // Options: `CHARGING`, `NOT_CHARGING` + ChargingState *string `json:"charging_state,omitempty" url:"charging_state,omitempty"` + // The ID of the Square seller business location associated with the Terminal. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The ID of the Square merchant account that is currently signed-in to the Terminal. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The Terminal’s current network connection type. + // Options: `WIFI`, `ETHERNET` + NetworkConnectionType *string `json:"network_connection_type,omitempty" url:"network_connection_type,omitempty"` + // The country in which the Terminal is authorized to take payments. + PaymentRegion *string `json:"payment_region,omitempty" url:"payment_region,omitempty"` + // The unique identifier assigned to the Terminal, which can be found on the lower back + // of the device. + SerialNumber *string `json:"serial_number,omitempty" url:"serial_number,omitempty"` + // The current version of the Terminal’s operating system. + OsVersion *string `json:"os_version,omitempty" url:"os_version,omitempty"` + // The current version of the application running on the Terminal. + AppVersion *string `json:"app_version,omitempty" url:"app_version,omitempty"` + // The name of the Wi-Fi network to which the Terminal is connected. + WifiNetworkName *string `json:"wifi_network_name,omitempty" url:"wifi_network_name,omitempty"` + // The signal strength of the Wi-FI network connection. + // Options: `POOR`, `FAIR`, `GOOD`, `EXCELLENT` + WifiNetworkStrength *string `json:"wifi_network_strength,omitempty" url:"wifi_network_strength,omitempty"` + // The IP address of the Terminal. + IPAddress *string `json:"ip_address,omitempty" url:"ip_address,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeviceMetadata) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeviceMetadata) UnmarshalJSON(data []byte) error { + type unmarshaler DeviceMetadata + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeviceMetadata(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeviceMetadata) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DeviceStatus struct { + // See [Category](#type-category) for possible values + Category *DeviceStatusCategory `json:"category,omitempty" url:"category,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DeviceStatus) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeviceStatus) UnmarshalJSON(data []byte) error { + type unmarshaler DeviceStatus + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeviceStatus(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeviceStatus) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DeviceStatusCategory string + +const ( + DeviceStatusCategoryDeviceStatusInvalidType DeviceStatusCategory = "DEVICE_STATUS_INVALID_TYPE" + DeviceStatusCategoryAvailable DeviceStatusCategory = "AVAILABLE" + DeviceStatusCategoryNeedsAttention DeviceStatusCategory = "NEEDS_ATTENTION" + DeviceStatusCategoryCritical DeviceStatusCategory = "CRITICAL" + DeviceStatusCategoryOffline DeviceStatusCategory = "OFFLINE" +) + +func NewDeviceStatusCategoryFromString(s string) (DeviceStatusCategory, error) { + switch s { + case "DEVICE_STATUS_INVALID_TYPE": + return DeviceStatusCategoryDeviceStatusInvalidType, nil + case "AVAILABLE": + return DeviceStatusCategoryAvailable, nil + case "NEEDS_ATTENTION": + return DeviceStatusCategoryNeedsAttention, nil + case "CRITICAL": + return DeviceStatusCategoryCritical, nil + case "OFFLINE": + return DeviceStatusCategoryOffline, nil + } + var t DeviceStatusCategory + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (d DeviceStatusCategory) Ptr() *DeviceStatusCategory { + return &d +} + +// Additional details about `WALLET` type payments. Contains only non-confidential information. +type DigitalWalletDetails struct { + // The status of the `WALLET` payment. The status can be `AUTHORIZED`, `CAPTURED`, `VOIDED`, or + // `FAILED`. + Status *string `json:"status,omitempty" url:"status,omitempty"` + // The brand used for the `WALLET` payment. The brand can be `CASH_APP`, `PAYPAY`, `ALIPAY`, + // `RAKUTEN_PAY`, `AU_PAY`, `D_BARAI`, `MERPAY`, `WECHAT_PAY` or `UNKNOWN`. + Brand *string `json:"brand,omitempty" url:"brand,omitempty"` + // Brand-specific details for payments with the `brand` of `CASH_APP`. + CashAppDetails *CashAppDetails `json:"cash_app_details,omitempty" url:"cash_app_details,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DigitalWalletDetails) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DigitalWalletDetails) UnmarshalJSON(data []byte) error { + type unmarshaler DigitalWalletDetails + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DigitalWalletDetails(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DigitalWalletDetails) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Defines the fields that are included in the response body of +// a request to the [DisableCard](api-endpoint:Cards-DisableCard) endpoint. +// +// Note: if there are errors processing the request, the card field will not be +// present. +type DisableCardResponse struct { + // Information on errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The retrieved card. + Card *Card `json:"card,omitempty" url:"card,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DisableCardResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DisableCardResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DisableCardResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DisableCardResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DisableCardResponse) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Disables [Event](entity:Event)s for your application. +type DisableEventsRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DisableEventsRequest) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DisableEventsRequest) UnmarshalJSON(data []byte) error { + type unmarshaler DisableEventsRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DisableEventsRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DisableEventsRequest) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Defines the fields that are included in the response body of +// a request to the [DisableEvents](api-endpoint:Events-DisableEvents) endpoint. +// +// Note: if there are errors processing the request, the events field will not be +// present. +type DisableEventsResponse struct { + // Information on errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DisableEventsResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DisableEventsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DisableEventsResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DisableEventsResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DisableEventsResponse) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DismissTerminalActionRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DismissTerminalActionRequest) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DismissTerminalActionRequest) UnmarshalJSON(data []byte) error { + type unmarshaler DismissTerminalActionRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DismissTerminalActionRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DismissTerminalActionRequest) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DismissTerminalActionResponse struct { + // Information on errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // Current state of the action to be dismissed. + Action *TerminalAction `json:"action,omitempty" url:"action,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DismissTerminalActionResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DismissTerminalActionResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DismissTerminalActionResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DismissTerminalActionResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DismissTerminalActionResponse) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DismissTerminalCheckoutRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DismissTerminalCheckoutRequest) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DismissTerminalCheckoutRequest) UnmarshalJSON(data []byte) error { + type unmarshaler DismissTerminalCheckoutRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DismissTerminalCheckoutRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DismissTerminalCheckoutRequest) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DismissTerminalCheckoutResponse struct { + // Information on errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // Current state of the checkout to be dismissed. + Checkout *TerminalCheckout `json:"checkout,omitempty" url:"checkout,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DismissTerminalCheckoutResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DismissTerminalCheckoutResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DismissTerminalCheckoutResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DismissTerminalCheckoutResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DismissTerminalCheckoutResponse) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DismissTerminalRefundRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DismissTerminalRefundRequest) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DismissTerminalRefundRequest) UnmarshalJSON(data []byte) error { + type unmarshaler DismissTerminalRefundRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DismissTerminalRefundRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DismissTerminalRefundRequest) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DismissTerminalRefundResponse struct { + // Information on errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // Current state of the refund to be dismissed. + Refund *TerminalRefund `json:"refund,omitempty" url:"refund,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DismissTerminalRefundResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DismissTerminalRefundResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DismissTerminalRefundResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DismissTerminalRefundResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DismissTerminalRefundResponse) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Represents a [dispute](https://developer.squareup.com/docs/disputes-api/overview) a cardholder initiated with their bank. +type Dispute struct { + // The unique ID for this `Dispute`, generated by Square. + DisputeID *string `json:"dispute_id,omitempty" url:"dispute_id,omitempty"` + // The unique ID for this `Dispute`, generated by Square. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The disputed amount, which can be less than the total transaction amount. + // For instance, if multiple items were purchased but the cardholder only initiates a dispute over some of the items. + AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` + // The reason why the cardholder initiated the dispute. + // See [DisputeReason](#type-disputereason) for possible values + Reason *DisputeReason `json:"reason,omitempty" url:"reason,omitempty"` + // The current state of this dispute. + // See [DisputeState](#type-disputestate) for possible values + State *DisputeState `json:"state,omitempty" url:"state,omitempty"` + // The deadline by which the seller must respond to the dispute, in [RFC 3339 format](https://developer.squareup.com/docs/build-basics/common-data-types/working-with-dates). + DueAt *string `json:"due_at,omitempty" url:"due_at,omitempty"` + // The payment challenged in this dispute. + DisputedPayment *DisputedPayment `json:"disputed_payment,omitempty" url:"disputed_payment,omitempty"` + // The IDs of the evidence associated with the dispute. + EvidenceIDs []string `json:"evidence_ids,omitempty" url:"evidence_ids,omitempty"` + // The card brand used in the disputed payment. + // See [CardBrand](#type-cardbrand) for possible values + CardBrand *CardBrand `json:"card_brand,omitempty" url:"card_brand,omitempty"` + // The timestamp when the dispute was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The timestamp when the dispute was last updated, in RFC 3339 format. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // The ID of the dispute in the card brand system, generated by the card brand. + BrandDisputeID *string `json:"brand_dispute_id,omitempty" url:"brand_dispute_id,omitempty"` + // The timestamp when the dispute was reported, in RFC 3339 format. + ReportedDate *string `json:"reported_date,omitempty" url:"reported_date,omitempty"` + // The timestamp when the dispute was reported, in RFC 3339 format. + ReportedAt *string `json:"reported_at,omitempty" url:"reported_at,omitempty"` + // The current version of the `Dispute`. + Version *int `json:"version,omitempty" url:"version,omitempty"` + // The ID of the location where the dispute originated. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *Dispute) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *Dispute) UnmarshalJSON(data []byte) error { + type unmarshaler Dispute + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = Dispute(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *Dispute) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Published when a [Dispute](entity:Dispute) is created. +type DisputeCreatedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The ID of the target location associated with the event. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The type of event this represents. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *DisputeCreatedEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DisputeCreatedEvent) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DisputeCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler DisputeCreatedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DisputeCreatedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DisputeCreatedEvent) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DisputeCreatedEventData struct { + // Name of the affected dispute's type. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the affected dispute. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing fields and values relevant to the event. + Object *DisputeCreatedEventObject `json:"object,omitempty" url:"object,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DisputeCreatedEventData) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DisputeCreatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler DisputeCreatedEventData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DisputeCreatedEventData(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DisputeCreatedEventData) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DisputeCreatedEventObject struct { + // The dispute object. + Object *Dispute `json:"object,omitempty" url:"object,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DisputeCreatedEventObject) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DisputeCreatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler DisputeCreatedEventObject + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DisputeCreatedEventObject(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DisputeCreatedEventObject) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DisputeEvidence struct { + // The Square-generated ID of the evidence. + EvidenceID *string `json:"evidence_id,omitempty" url:"evidence_id,omitempty"` + // The Square-generated ID of the evidence. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The ID of the dispute the evidence is associated with. + DisputeID *string `json:"dispute_id,omitempty" url:"dispute_id,omitempty"` + // Image, PDF, TXT + EvidenceFile *DisputeEvidenceFile `json:"evidence_file,omitempty" url:"evidence_file,omitempty"` + // Raw text + EvidenceText *string `json:"evidence_text,omitempty" url:"evidence_text,omitempty"` + // The time when the evidence was uploaded, in RFC 3339 format. + UploadedAt *string `json:"uploaded_at,omitempty" url:"uploaded_at,omitempty"` + // The type of the evidence. + // See [DisputeEvidenceType](#type-disputeevidencetype) for possible values + EvidenceType *DisputeEvidenceType `json:"evidence_type,omitempty" url:"evidence_type,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DisputeEvidence) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DisputeEvidence) UnmarshalJSON(data []byte) error { + type unmarshaler DisputeEvidence + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DisputeEvidence(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DisputeEvidence) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Published when evidence is added to a [Dispute](entity:Dispute) +// from the Disputes Dashboard in the Seller Dashboard, the Square Point of Sale app, +// or by calling either [CreateDisputeEvidenceFile](api-endpoint:Disputes-CreateDisputeEvidenceFile) or [CreateDisputeEvidenceText](api-endpoint:Disputes-CreateDisputeEvidenceText). +type DisputeEvidenceAddedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The ID of the target location associated with the event. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The type of event this represents. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *DisputeEvidenceAddedEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DisputeEvidenceAddedEvent) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DisputeEvidenceAddedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler DisputeEvidenceAddedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DisputeEvidenceAddedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DisputeEvidenceAddedEvent) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DisputeEvidenceAddedEventData struct { + // Name of the affected dispute's type. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the affected dispute. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing fields and values relevant to the event. + Object *DisputeEvidenceAddedEventObject `json:"object,omitempty" url:"object,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DisputeEvidenceAddedEventData) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DisputeEvidenceAddedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler DisputeEvidenceAddedEventData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DisputeEvidenceAddedEventData(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DisputeEvidenceAddedEventData) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DisputeEvidenceAddedEventObject struct { + // The dispute object. + Object *Dispute `json:"object,omitempty" url:"object,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DisputeEvidenceAddedEventObject) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DisputeEvidenceAddedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler DisputeEvidenceAddedEventObject + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DisputeEvidenceAddedEventObject(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DisputeEvidenceAddedEventObject) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Published when evidence is added to a [Dispute](entity:Dispute) +// from the Disputes Dashboard in the Seller Dashboard, the Square Point of Sale app, +// or by calling either [CreateDisputeEvidenceFile](api-endpoint:Disputes-CreateDisputeEvidenceFile) or [CreateDisputeEvidenceText](api-endpoint:Disputes-CreateDisputeEvidenceText). +type DisputeEvidenceCreatedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The ID of the target location associated with the event. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The type of event this represents. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *DisputeEvidenceCreatedEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DisputeEvidenceCreatedEvent) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DisputeEvidenceCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler DisputeEvidenceCreatedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DisputeEvidenceCreatedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DisputeEvidenceCreatedEvent) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DisputeEvidenceCreatedEventData struct { + // Name of the affected dispute's type. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the affected dispute. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing fields and values relevant to the event. + Object *DisputeEvidenceCreatedEventObject `json:"object,omitempty" url:"object,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DisputeEvidenceCreatedEventData) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DisputeEvidenceCreatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler DisputeEvidenceCreatedEventData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DisputeEvidenceCreatedEventData(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DisputeEvidenceCreatedEventData) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DisputeEvidenceCreatedEventObject struct { + // The dispute object. + Object *Dispute `json:"object,omitempty" url:"object,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DisputeEvidenceCreatedEventObject) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DisputeEvidenceCreatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler DisputeEvidenceCreatedEventObject + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DisputeEvidenceCreatedEventObject(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DisputeEvidenceCreatedEventObject) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Published when evidence is removed from a [Dispute](entity:Dispute) +// from the Disputes Dashboard in the Seller Dashboard, the Square Point of Sale app, +// or by calling [DeleteDisputeEvidence](api-endpoint:Disputes-DeleteDisputeEvidence). +type DisputeEvidenceDeletedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The ID of the target location associated with the event. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The type of event this represents. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *DisputeEvidenceDeletedEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DisputeEvidenceDeletedEvent) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DisputeEvidenceDeletedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler DisputeEvidenceDeletedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DisputeEvidenceDeletedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DisputeEvidenceDeletedEvent) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DisputeEvidenceDeletedEventData struct { + // Name of the affected dispute's type. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the affected dispute. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing fields and values relevant to the event. + Object *DisputeEvidenceDeletedEventObject `json:"object,omitempty" url:"object,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DisputeEvidenceDeletedEventData) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DisputeEvidenceDeletedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler DisputeEvidenceDeletedEventData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DisputeEvidenceDeletedEventData(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DisputeEvidenceDeletedEventData) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DisputeEvidenceDeletedEventObject struct { + // The dispute object. + Object *Dispute `json:"object,omitempty" url:"object,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DisputeEvidenceDeletedEventObject) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DisputeEvidenceDeletedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler DisputeEvidenceDeletedEventObject + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DisputeEvidenceDeletedEventObject(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DisputeEvidenceDeletedEventObject) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// A file to be uploaded as dispute evidence. +type DisputeEvidenceFile struct { + // The file name including the file extension. For example: "receipt.tiff". + Filename *string `json:"filename,omitempty" url:"filename,omitempty"` + // Dispute evidence files must be application/pdf, image/heic, image/heif, image/jpeg, image/png, or image/tiff formats. + Filetype *string `json:"filetype,omitempty" url:"filetype,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DisputeEvidenceFile) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DisputeEvidenceFile) UnmarshalJSON(data []byte) error { + type unmarshaler DisputeEvidenceFile + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DisputeEvidenceFile(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DisputeEvidenceFile) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Published when evidence is removed from a [Dispute](entity:Dispute) +// from the Disputes Dashboard in the Seller Dashboard, the Square Point of Sale app, +// or by calling [DeleteDisputeEvidence](api-endpoint:Disputes-DeleteDisputeEvidence). +type DisputeEvidenceRemovedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The ID of the target location associated with the event. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The type of event this represents. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *DisputeEvidenceRemovedEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DisputeEvidenceRemovedEvent) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DisputeEvidenceRemovedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler DisputeEvidenceRemovedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DisputeEvidenceRemovedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DisputeEvidenceRemovedEvent) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DisputeEvidenceRemovedEventData struct { + // Name of the affected dispute's type. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the affected dispute. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing fields and values relevant to the event. + Object *DisputeEvidenceRemovedEventObject `json:"object,omitempty" url:"object,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DisputeEvidenceRemovedEventData) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DisputeEvidenceRemovedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler DisputeEvidenceRemovedEventData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DisputeEvidenceRemovedEventData(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DisputeEvidenceRemovedEventData) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DisputeEvidenceRemovedEventObject struct { + // The dispute object. + Object *Dispute `json:"object,omitempty" url:"object,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DisputeEvidenceRemovedEventObject) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DisputeEvidenceRemovedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler DisputeEvidenceRemovedEventObject + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DisputeEvidenceRemovedEventObject(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DisputeEvidenceRemovedEventObject) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// The type of the dispute evidence. +type DisputeEvidenceType string + +const ( + DisputeEvidenceTypeUnknownType DisputeEvidenceType = "UNKNOWN_TYPE" + DisputeEvidenceTypeGenericEvidence DisputeEvidenceType = "GENERIC_EVIDENCE" + DisputeEvidenceTypeOnlineOrAppAccessLog DisputeEvidenceType = "ONLINE_OR_APP_ACCESS_LOG" + DisputeEvidenceTypeAuthorizationDocumentation DisputeEvidenceType = "AUTHORIZATION_DOCUMENTATION" + DisputeEvidenceTypeCancellationOrRefundDocumentation DisputeEvidenceType = "CANCELLATION_OR_REFUND_DOCUMENTATION" + DisputeEvidenceTypeCardholderCommunication DisputeEvidenceType = "CARDHOLDER_COMMUNICATION" + DisputeEvidenceTypeCardholderInformation DisputeEvidenceType = "CARDHOLDER_INFORMATION" + DisputeEvidenceTypePurchaseAcknowledgement DisputeEvidenceType = "PURCHASE_ACKNOWLEDGEMENT" + DisputeEvidenceTypeDuplicateChargeDocumentation DisputeEvidenceType = "DUPLICATE_CHARGE_DOCUMENTATION" + DisputeEvidenceTypeProductOrServiceDescription DisputeEvidenceType = "PRODUCT_OR_SERVICE_DESCRIPTION" + DisputeEvidenceTypeReceipt DisputeEvidenceType = "RECEIPT" + DisputeEvidenceTypeServiceReceivedDocumentation DisputeEvidenceType = "SERVICE_RECEIVED_DOCUMENTATION" + DisputeEvidenceTypeProofOfDeliveryDocumentation DisputeEvidenceType = "PROOF_OF_DELIVERY_DOCUMENTATION" + DisputeEvidenceTypeRelatedTransactionDocumentation DisputeEvidenceType = "RELATED_TRANSACTION_DOCUMENTATION" + DisputeEvidenceTypeRebuttalExplanation DisputeEvidenceType = "REBUTTAL_EXPLANATION" + DisputeEvidenceTypeTrackingNumber DisputeEvidenceType = "TRACKING_NUMBER" +) + +func NewDisputeEvidenceTypeFromString(s string) (DisputeEvidenceType, error) { + switch s { + case "UNKNOWN_TYPE": + return DisputeEvidenceTypeUnknownType, nil + case "GENERIC_EVIDENCE": + return DisputeEvidenceTypeGenericEvidence, nil + case "ONLINE_OR_APP_ACCESS_LOG": + return DisputeEvidenceTypeOnlineOrAppAccessLog, nil + case "AUTHORIZATION_DOCUMENTATION": + return DisputeEvidenceTypeAuthorizationDocumentation, nil + case "CANCELLATION_OR_REFUND_DOCUMENTATION": + return DisputeEvidenceTypeCancellationOrRefundDocumentation, nil + case "CARDHOLDER_COMMUNICATION": + return DisputeEvidenceTypeCardholderCommunication, nil + case "CARDHOLDER_INFORMATION": + return DisputeEvidenceTypeCardholderInformation, nil + case "PURCHASE_ACKNOWLEDGEMENT": + return DisputeEvidenceTypePurchaseAcknowledgement, nil + case "DUPLICATE_CHARGE_DOCUMENTATION": + return DisputeEvidenceTypeDuplicateChargeDocumentation, nil + case "PRODUCT_OR_SERVICE_DESCRIPTION": + return DisputeEvidenceTypeProductOrServiceDescription, nil + case "RECEIPT": + return DisputeEvidenceTypeReceipt, nil + case "SERVICE_RECEIVED_DOCUMENTATION": + return DisputeEvidenceTypeServiceReceivedDocumentation, nil + case "PROOF_OF_DELIVERY_DOCUMENTATION": + return DisputeEvidenceTypeProofOfDeliveryDocumentation, nil + case "RELATED_TRANSACTION_DOCUMENTATION": + return DisputeEvidenceTypeRelatedTransactionDocumentation, nil + case "REBUTTAL_EXPLANATION": + return DisputeEvidenceTypeRebuttalExplanation, nil + case "TRACKING_NUMBER": + return DisputeEvidenceTypeTrackingNumber, nil + } + var t DisputeEvidenceType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (d DisputeEvidenceType) Ptr() *DisputeEvidenceType { + return &d +} + +// The list of possible reasons why a cardholder might initiate a +// dispute with their bank. +type DisputeReason string + +const ( + DisputeReasonUnknownReason DisputeReason = "UNKNOWN_REASON" + DisputeReasonAmountDiffers DisputeReason = "AMOUNT_DIFFERS" + DisputeReasonCancelled DisputeReason = "CANCELLED" + DisputeReasonCompliance DisputeReason = "COMPLIANCE" + DisputeReasonDissatisfied DisputeReason = "DISSATISFIED" + DisputeReasonDuplicate DisputeReason = "DUPLICATE" + DisputeReasonFraud DisputeReason = "FRAUD" + DisputeReasonNoKnowledge DisputeReason = "NO_KNOWLEDGE" + DisputeReasonNotAsDescribed DisputeReason = "NOT_AS_DESCRIBED" + DisputeReasonNotReceived DisputeReason = "NOT_RECEIVED" + DisputeReasonPaidByOtherMeans DisputeReason = "PAID_BY_OTHER_MEANS" + DisputeReasonCustomerRequestsCredit DisputeReason = "CUSTOMER_REQUESTS_CREDIT" + DisputeReasonUnauthorized DisputeReason = "UNAUTHORIZED" + DisputeReasonReturned DisputeReason = "RETURNED" + DisputeReasonInsufficientResponse DisputeReason = "INSUFFICIENT_RESPONSE" + DisputeReasonRequestDocumentation DisputeReason = "REQUEST_DOCUMENTATION" + DisputeReasonEmvLiabilityShift DisputeReason = "EMV_LIABILITY_SHIFT" +) + +func NewDisputeReasonFromString(s string) (DisputeReason, error) { + switch s { + case "UNKNOWN_REASON": + return DisputeReasonUnknownReason, nil + case "AMOUNT_DIFFERS": + return DisputeReasonAmountDiffers, nil + case "CANCELLED": + return DisputeReasonCancelled, nil + case "COMPLIANCE": + return DisputeReasonCompliance, nil + case "DISSATISFIED": + return DisputeReasonDissatisfied, nil + case "DUPLICATE": + return DisputeReasonDuplicate, nil + case "FRAUD": + return DisputeReasonFraud, nil + case "NO_KNOWLEDGE": + return DisputeReasonNoKnowledge, nil + case "NOT_AS_DESCRIBED": + return DisputeReasonNotAsDescribed, nil + case "NOT_RECEIVED": + return DisputeReasonNotReceived, nil + case "PAID_BY_OTHER_MEANS": + return DisputeReasonPaidByOtherMeans, nil + case "CUSTOMER_REQUESTS_CREDIT": + return DisputeReasonCustomerRequestsCredit, nil + case "UNAUTHORIZED": + return DisputeReasonUnauthorized, nil + case "RETURNED": + return DisputeReasonReturned, nil + case "INSUFFICIENT_RESPONSE": + return DisputeReasonInsufficientResponse, nil + case "REQUEST_DOCUMENTATION": + return DisputeReasonRequestDocumentation, nil + case "EMV_LIABILITY_SHIFT": + return DisputeReasonEmvLiabilityShift, nil + } + var t DisputeReason + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (d DisputeReason) Ptr() *DisputeReason { + return &d +} + +// The list of possible dispute states. +type DisputeState string + +const ( + DisputeStateUnknownState DisputeState = "UNKNOWN_STATE" + DisputeStateInquiryEvidenceRequired DisputeState = "INQUIRY_EVIDENCE_REQUIRED" + DisputeStateInquiryProcessing DisputeState = "INQUIRY_PROCESSING" + DisputeStateInquiryClosed DisputeState = "INQUIRY_CLOSED" + DisputeStateEvidenceRequired DisputeState = "EVIDENCE_REQUIRED" + DisputeStateProcessing DisputeState = "PROCESSING" + DisputeStateWon DisputeState = "WON" + DisputeStateLost DisputeState = "LOST" + DisputeStateAccepted DisputeState = "ACCEPTED" + DisputeStateWaitingThirdParty DisputeState = "WAITING_THIRD_PARTY" +) + +func NewDisputeStateFromString(s string) (DisputeState, error) { + switch s { + case "UNKNOWN_STATE": + return DisputeStateUnknownState, nil + case "INQUIRY_EVIDENCE_REQUIRED": + return DisputeStateInquiryEvidenceRequired, nil + case "INQUIRY_PROCESSING": + return DisputeStateInquiryProcessing, nil + case "INQUIRY_CLOSED": + return DisputeStateInquiryClosed, nil + case "EVIDENCE_REQUIRED": + return DisputeStateEvidenceRequired, nil + case "PROCESSING": + return DisputeStateProcessing, nil + case "WON": + return DisputeStateWon, nil + case "LOST": + return DisputeStateLost, nil + case "ACCEPTED": + return DisputeStateAccepted, nil + case "WAITING_THIRD_PARTY": + return DisputeStateWaitingThirdParty, nil + } + var t DisputeState + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (d DisputeState) Ptr() *DisputeState { + return &d +} + +// Published when the state of a [Dispute](entity:Dispute) changes. +// This includes the dispute resolution (WON, LOST) reported by the bank. The event +// data includes details of what changed. +type DisputeStateChangedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The ID of the target location associated with the event. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The type of event this represents. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *DisputeStateChangedEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DisputeStateChangedEvent) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DisputeStateChangedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler DisputeStateChangedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DisputeStateChangedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DisputeStateChangedEvent) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DisputeStateChangedEventData struct { + // Name of the affected dispute's type. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the affected dispute. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing fields and values relevant to the event. + Object *DisputeStateChangedEventObject `json:"object,omitempty" url:"object,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DisputeStateChangedEventData) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DisputeStateChangedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler DisputeStateChangedEventData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DisputeStateChangedEventData(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DisputeStateChangedEventData) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DisputeStateChangedEventObject struct { + // The dispute object. + Object *Dispute `json:"object,omitempty" url:"object,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DisputeStateChangedEventObject) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DisputeStateChangedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler DisputeStateChangedEventObject + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DisputeStateChangedEventObject(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DisputeStateChangedEventObject) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Published when the state of a [Dispute](entity:Dispute) changes. +// This includes the dispute resolution (WON, LOST) reported by the bank. The event +// data includes details of what changed. +type DisputeStateUpdatedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The ID of the target location associated with the event. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The type of event this represents. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *DisputeStateUpdatedEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DisputeStateUpdatedEvent) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DisputeStateUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler DisputeStateUpdatedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DisputeStateUpdatedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DisputeStateUpdatedEvent) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DisputeStateUpdatedEventData struct { + // Name of the affected dispute's type. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the affected dispute. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing fields and values relevant to the event. + Object *DisputeStateUpdatedEventObject `json:"object,omitempty" url:"object,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DisputeStateUpdatedEventData) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DisputeStateUpdatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler DisputeStateUpdatedEventData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DisputeStateUpdatedEventData(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DisputeStateUpdatedEventData) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DisputeStateUpdatedEventObject struct { + // The dispute object. + Object *Dispute `json:"object,omitempty" url:"object,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DisputeStateUpdatedEventObject) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DisputeStateUpdatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler DisputeStateUpdatedEventObject + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DisputeStateUpdatedEventObject(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DisputeStateUpdatedEventObject) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// The payment the cardholder disputed. +type DisputedPayment struct { + // Square-generated unique ID of the payment being disputed. + PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (d *DisputedPayment) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DisputedPayment) UnmarshalJSON(data []byte) error { + type unmarshaler DisputedPayment + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DisputedPayment(value) + + extraProperties, err := core.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DisputedPayment) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Determines item visibility in Ecom (Online Store) and Online Checkout. +type EcomVisibility string + +const ( + EcomVisibilityEcomVisibilityDoNotUse EcomVisibility = "ECOM_VISIBILITY_DO_NOT_USE" + EcomVisibilityUnindexed EcomVisibility = "UNINDEXED" + EcomVisibilityUnavailable EcomVisibility = "UNAVAILABLE" + EcomVisibilityHidden EcomVisibility = "HIDDEN" + EcomVisibilityVisible EcomVisibility = "VISIBLE" +) + +func NewEcomVisibilityFromString(s string) (EcomVisibility, error) { + switch s { + case "ECOM_VISIBILITY_DO_NOT_USE": + return EcomVisibilityEcomVisibilityDoNotUse, nil + case "UNINDEXED": + return EcomVisibilityUnindexed, nil + case "UNAVAILABLE": + return EcomVisibilityUnavailable, nil + case "HIDDEN": + return EcomVisibilityHidden, nil + case "VISIBLE": + return EcomVisibilityVisible, nil + } + var t EcomVisibility + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (e EcomVisibility) Ptr() *EcomVisibility { + return &e +} + +// An employee object that is used by the external API. +// +// DEPRECATED at version 2020-08-26. Replaced by [TeamMember](entity:TeamMember). +type Employee struct { + // UUID for this object. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The employee's first name. + FirstName *string `json:"first_name,omitempty" url:"first_name,omitempty"` + // The employee's last name. + LastName *string `json:"last_name,omitempty" url:"last_name,omitempty"` + // The employee's email address + Email *string `json:"email,omitempty" url:"email,omitempty"` + // The employee's phone number in E.164 format, i.e. "+12125554250" + PhoneNumber *string `json:"phone_number,omitempty" url:"phone_number,omitempty"` + // A list of location IDs where this employee has access to. + LocationIDs []string `json:"location_ids,omitempty" url:"location_ids,omitempty"` + // Specifies the status of the employees being fetched. + // See [EmployeeStatus](#type-employeestatus) for possible values + Status *EmployeeStatus `json:"status,omitempty" url:"status,omitempty"` + // Whether this employee is the owner of the merchant. Each merchant + // has one owner employee, and that employee has full authority over + // the account. + IsOwner *bool `json:"is_owner,omitempty" url:"is_owner,omitempty"` + // A read-only timestamp in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // A read-only timestamp in RFC 3339 format. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (e *Employee) GetExtraProperties() map[string]interface{} { + return e.extraProperties +} + +func (e *Employee) UnmarshalJSON(data []byte) error { + type unmarshaler Employee + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = Employee(value) + + extraProperties, err := core.ExtractExtraProperties(data, *e) + if err != nil { + return err + } + e.extraProperties = extraProperties + + e._rawJSON = json.RawMessage(data) + return nil +} + +func (e *Employee) String() string { + if len(e._rawJSON) > 0 { + if value, err := core.StringifyJSON(e._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(e); err == nil { + return value + } + return fmt.Sprintf("%#v", e) +} + +// The status of the Employee being retrieved. +// +// DEPRECATED at version 2020-08-26. Replaced by [TeamMemberStatus](entity:TeamMemberStatus). +type EmployeeStatus string + +const ( + EmployeeStatusDoNotUse EmployeeStatus = "DO_NOT_USE" + EmployeeStatusActive EmployeeStatus = "ACTIVE" + EmployeeStatusInactive EmployeeStatus = "INACTIVE" +) + +func NewEmployeeStatusFromString(s string) (EmployeeStatus, error) { + switch s { + case "DO_NOT_USE": + return EmployeeStatusDoNotUse, nil + case "ACTIVE": + return EmployeeStatusActive, nil + case "INACTIVE": + return EmployeeStatusInactive, nil + } + var t EmployeeStatus + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (e EmployeeStatus) Ptr() *EmployeeStatus { + return &e +} + +// The hourly wage rate that an employee earns on a `Shift` for doing the job specified by the `title` property of this object. Deprecated at version 2020-08-26. Use [TeamMemberWage](entity:TeamMemberWage). +type EmployeeWage struct { + // The UUID for this object. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The `Employee` that this wage is assigned to. + EmployeeID *string `json:"employee_id,omitempty" url:"employee_id,omitempty"` + // The job title that this wage relates to. + Title *string `json:"title,omitempty" url:"title,omitempty"` + // Can be a custom-set hourly wage or the calculated effective hourly + // wage based on the annual wage and hours worked per week. + HourlyRate *Money `json:"hourly_rate,omitempty" url:"hourly_rate,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (e *EmployeeWage) GetExtraProperties() map[string]interface{} { + return e.extraProperties +} + +func (e *EmployeeWage) UnmarshalJSON(data []byte) error { + type unmarshaler EmployeeWage + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = EmployeeWage(value) + + extraProperties, err := core.ExtractExtraProperties(data, *e) + if err != nil { + return err + } + e.extraProperties = extraProperties + + e._rawJSON = json.RawMessage(data) + return nil +} + +func (e *EmployeeWage) String() string { + if len(e._rawJSON) > 0 { + if value, err := core.StringifyJSON(e._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(e); err == nil { + return value + } + return fmt.Sprintf("%#v", e) +} + +// Enables [Event](entity:Event)s for your application. +type EnableEventsRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (e *EnableEventsRequest) GetExtraProperties() map[string]interface{} { + return e.extraProperties +} + +func (e *EnableEventsRequest) UnmarshalJSON(data []byte) error { + type unmarshaler EnableEventsRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = EnableEventsRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *e) + if err != nil { + return err + } + e.extraProperties = extraProperties + + e._rawJSON = json.RawMessage(data) + return nil +} + +func (e *EnableEventsRequest) String() string { + if len(e._rawJSON) > 0 { + if value, err := core.StringifyJSON(e._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(e); err == nil { + return value + } + return fmt.Sprintf("%#v", e) +} + +// Defines the fields that are included in the response body of +// a request to the [EnableEvents](api-endpoint:Events-EnableEvents) endpoint. +// +// Note: if there are errors processing the request, the events field will not be +// present. +type EnableEventsResponse struct { + // Information on errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (e *EnableEventsResponse) GetExtraProperties() map[string]interface{} { + return e.extraProperties +} + +func (e *EnableEventsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler EnableEventsResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = EnableEventsResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *e) + if err != nil { + return err + } + e.extraProperties = extraProperties + + e._rawJSON = json.RawMessage(data) + return nil +} + +func (e *EnableEventsResponse) String() string { + if len(e._rawJSON) > 0 { + if value, err := core.StringifyJSON(e._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(e); err == nil { + return value + } + return fmt.Sprintf("%#v", e) +} + +// Represents an error encountered during a request to the Connect API. +// +// See [Handling errors](https://developer.squareup.com/docs/build-basics/handling-errors) for more information. +type Error struct { + // The high-level category for the error. + // See [ErrorCategory](#type-errorcategory) for possible values + Category ErrorCategory `json:"category" url:"category"` + // The specific code of the error. + // See [ErrorCode](#type-errorcode) for possible values + Code ErrorCode `json:"code" url:"code"` + // A human-readable description of the error for debugging purposes. + Detail *string `json:"detail,omitempty" url:"detail,omitempty"` + // The name of the field provided in the original request (if any) that + // the error pertains to. + Field *string `json:"field,omitempty" url:"field,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (e *Error) GetExtraProperties() map[string]interface{} { + return e.extraProperties +} + +func (e *Error) UnmarshalJSON(data []byte) error { + type unmarshaler Error + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = Error(value) + + extraProperties, err := core.ExtractExtraProperties(data, *e) + if err != nil { + return err + } + e.extraProperties = extraProperties + + e._rawJSON = json.RawMessage(data) + return nil +} + +func (e *Error) String() string { + if len(e._rawJSON) > 0 { + if value, err := core.StringifyJSON(e._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(e); err == nil { + return value + } + return fmt.Sprintf("%#v", e) +} + +// Indicates which high-level category of error has occurred during a +// request to the Connect API. +type ErrorCategory string + +const ( + ErrorCategoryAPIError ErrorCategory = "API_ERROR" + ErrorCategoryAuthenticationError ErrorCategory = "AUTHENTICATION_ERROR" + ErrorCategoryInvalidRequestError ErrorCategory = "INVALID_REQUEST_ERROR" + ErrorCategoryRateLimitError ErrorCategory = "RATE_LIMIT_ERROR" + ErrorCategoryPaymentMethodError ErrorCategory = "PAYMENT_METHOD_ERROR" + ErrorCategoryRefundError ErrorCategory = "REFUND_ERROR" + ErrorCategoryMerchantSubscriptionError ErrorCategory = "MERCHANT_SUBSCRIPTION_ERROR" + ErrorCategoryExternalVendorError ErrorCategory = "EXTERNAL_VENDOR_ERROR" +) + +func NewErrorCategoryFromString(s string) (ErrorCategory, error) { + switch s { + case "API_ERROR": + return ErrorCategoryAPIError, nil + case "AUTHENTICATION_ERROR": + return ErrorCategoryAuthenticationError, nil + case "INVALID_REQUEST_ERROR": + return ErrorCategoryInvalidRequestError, nil + case "RATE_LIMIT_ERROR": + return ErrorCategoryRateLimitError, nil + case "PAYMENT_METHOD_ERROR": + return ErrorCategoryPaymentMethodError, nil + case "REFUND_ERROR": + return ErrorCategoryRefundError, nil + case "MERCHANT_SUBSCRIPTION_ERROR": + return ErrorCategoryMerchantSubscriptionError, nil + case "EXTERNAL_VENDOR_ERROR": + return ErrorCategoryExternalVendorError, nil + } + var t ErrorCategory + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (e ErrorCategory) Ptr() *ErrorCategory { + return &e +} + +// Indicates the specific error that occurred during a request to a +// Square API. +type ErrorCode string + +const ( + ErrorCodeInternalServerError ErrorCode = "INTERNAL_SERVER_ERROR" + ErrorCodeUnauthorized ErrorCode = "UNAUTHORIZED" + ErrorCodeAccessTokenExpired ErrorCode = "ACCESS_TOKEN_EXPIRED" + ErrorCodeAccessTokenRevoked ErrorCode = "ACCESS_TOKEN_REVOKED" + ErrorCodeClientDisabled ErrorCode = "CLIENT_DISABLED" + ErrorCodeForbidden ErrorCode = "FORBIDDEN" + ErrorCodeInsufficientScopes ErrorCode = "INSUFFICIENT_SCOPES" + ErrorCodeApplicationDisabled ErrorCode = "APPLICATION_DISABLED" + ErrorCodeV1Application ErrorCode = "V1_APPLICATION" + ErrorCodeV1AccessToken ErrorCode = "V1_ACCESS_TOKEN" + ErrorCodeCardProcessingNotEnabled ErrorCode = "CARD_PROCESSING_NOT_ENABLED" + ErrorCodeMerchantSubscriptionNotFound ErrorCode = "MERCHANT_SUBSCRIPTION_NOT_FOUND" + ErrorCodeBadRequest ErrorCode = "BAD_REQUEST" + ErrorCodeMissingRequiredParameter ErrorCode = "MISSING_REQUIRED_PARAMETER" + ErrorCodeIncorrectType ErrorCode = "INCORRECT_TYPE" + ErrorCodeInvalidTime ErrorCode = "INVALID_TIME" + ErrorCodeInvalidTimeRange ErrorCode = "INVALID_TIME_RANGE" + ErrorCodeInvalidValue ErrorCode = "INVALID_VALUE" + ErrorCodeInvalidCursor ErrorCode = "INVALID_CURSOR" + ErrorCodeUnknownQueryParameter ErrorCode = "UNKNOWN_QUERY_PARAMETER" + ErrorCodeConflictingParameters ErrorCode = "CONFLICTING_PARAMETERS" + ErrorCodeExpectedJSONBody ErrorCode = "EXPECTED_JSON_BODY" + ErrorCodeInvalidSortOrder ErrorCode = "INVALID_SORT_ORDER" + ErrorCodeValueRegexMismatch ErrorCode = "VALUE_REGEX_MISMATCH" + ErrorCodeValueTooShort ErrorCode = "VALUE_TOO_SHORT" + ErrorCodeValueTooLong ErrorCode = "VALUE_TOO_LONG" + ErrorCodeValueTooLow ErrorCode = "VALUE_TOO_LOW" + ErrorCodeValueTooHigh ErrorCode = "VALUE_TOO_HIGH" + ErrorCodeValueEmpty ErrorCode = "VALUE_EMPTY" + ErrorCodeArrayLengthTooLong ErrorCode = "ARRAY_LENGTH_TOO_LONG" + ErrorCodeArrayLengthTooShort ErrorCode = "ARRAY_LENGTH_TOO_SHORT" + ErrorCodeArrayEmpty ErrorCode = "ARRAY_EMPTY" + ErrorCodeExpectedBoolean ErrorCode = "EXPECTED_BOOLEAN" + ErrorCodeExpectedInteger ErrorCode = "EXPECTED_INTEGER" + ErrorCodeExpectedFloat ErrorCode = "EXPECTED_FLOAT" + ErrorCodeExpectedString ErrorCode = "EXPECTED_STRING" + ErrorCodeExpectedObject ErrorCode = "EXPECTED_OBJECT" + ErrorCodeExpectedArray ErrorCode = "EXPECTED_ARRAY" + ErrorCodeExpectedMap ErrorCode = "EXPECTED_MAP" + ErrorCodeExpectedBase64EncodedByteArray ErrorCode = "EXPECTED_BASE64_ENCODED_BYTE_ARRAY" + ErrorCodeInvalidArrayValue ErrorCode = "INVALID_ARRAY_VALUE" + ErrorCodeInvalidEnumValue ErrorCode = "INVALID_ENUM_VALUE" + ErrorCodeInvalidContentType ErrorCode = "INVALID_CONTENT_TYPE" + ErrorCodeInvalidFormValue ErrorCode = "INVALID_FORM_VALUE" + ErrorCodeCustomerNotFound ErrorCode = "CUSTOMER_NOT_FOUND" + ErrorCodeBuyerNotFound ErrorCode = "BUYER_NOT_FOUND" + ErrorCodeOneInstrumentExpected ErrorCode = "ONE_INSTRUMENT_EXPECTED" + ErrorCodeNoFieldsSet ErrorCode = "NO_FIELDS_SET" + ErrorCodeDeprecatedFieldSet ErrorCode = "DEPRECATED_FIELD_SET" + ErrorCodeRetiredFieldSet ErrorCode = "RETIRED_FIELD_SET" + ErrorCodeTooManyMapEntries ErrorCode = "TOO_MANY_MAP_ENTRIES" + ErrorCodeMapKeyLengthTooShort ErrorCode = "MAP_KEY_LENGTH_TOO_SHORT" + ErrorCodeMapKeyLengthTooLong ErrorCode = "MAP_KEY_LENGTH_TOO_LONG" + ErrorCodeCustomerMissingName ErrorCode = "CUSTOMER_MISSING_NAME" + ErrorCodeCustomerMissingEmail ErrorCode = "CUSTOMER_MISSING_EMAIL" + ErrorCodeInvalidPauseLength ErrorCode = "INVALID_PAUSE_LENGTH" + ErrorCodeInvalidDate ErrorCode = "INVALID_DATE" + ErrorCodeJobTemplateNameTaken ErrorCode = "JOB_TEMPLATE_NAME_TAKEN" + ErrorCodeClientNotSupported ErrorCode = "CLIENT_NOT_SUPPORTED" + ErrorCodeUnsupportedCountry ErrorCode = "UNSUPPORTED_COUNTRY" + ErrorCodeUnsupportedCurrency ErrorCode = "UNSUPPORTED_CURRENCY" + ErrorCodeAppleTtpPinToken ErrorCode = "APPLE_TTP_PIN_TOKEN" + ErrorCodeCardExpired ErrorCode = "CARD_EXPIRED" + ErrorCodeInvalidExpiration ErrorCode = "INVALID_EXPIRATION" + ErrorCodeInvalidExpirationYear ErrorCode = "INVALID_EXPIRATION_YEAR" + ErrorCodeInvalidExpirationDate ErrorCode = "INVALID_EXPIRATION_DATE" + ErrorCodeUnsupportedCardBrand ErrorCode = "UNSUPPORTED_CARD_BRAND" + ErrorCodeUnsupportedEntryMethod ErrorCode = "UNSUPPORTED_ENTRY_METHOD" + ErrorCodeInvalidEncryptedCard ErrorCode = "INVALID_ENCRYPTED_CARD" + ErrorCodeInvalidCard ErrorCode = "INVALID_CARD" + ErrorCodePaymentAmountMismatch ErrorCode = "PAYMENT_AMOUNT_MISMATCH" + ErrorCodeGenericDecline ErrorCode = "GENERIC_DECLINE" + ErrorCodeCvvFailure ErrorCode = "CVV_FAILURE" + ErrorCodeAddressVerificationFailure ErrorCode = "ADDRESS_VERIFICATION_FAILURE" + ErrorCodeInvalidAccount ErrorCode = "INVALID_ACCOUNT" + ErrorCodeCurrencyMismatch ErrorCode = "CURRENCY_MISMATCH" + ErrorCodeInsufficientFunds ErrorCode = "INSUFFICIENT_FUNDS" + ErrorCodeInsufficientPermissions ErrorCode = "INSUFFICIENT_PERMISSIONS" + ErrorCodeCardholderInsufficientPermissions ErrorCode = "CARDHOLDER_INSUFFICIENT_PERMISSIONS" + ErrorCodeInvalidLocation ErrorCode = "INVALID_LOCATION" + ErrorCodeTransactionLimit ErrorCode = "TRANSACTION_LIMIT" + ErrorCodeVoiceFailure ErrorCode = "VOICE_FAILURE" + ErrorCodePanFailure ErrorCode = "PAN_FAILURE" + ErrorCodeExpirationFailure ErrorCode = "EXPIRATION_FAILURE" + ErrorCodeCardNotSupported ErrorCode = "CARD_NOT_SUPPORTED" + ErrorCodeIssuerInstallmentError ErrorCode = "ISSUER_INSTALLMENT_ERROR" + ErrorCodeInvalidPin ErrorCode = "INVALID_PIN" + ErrorCodeMissingPin ErrorCode = "MISSING_PIN" + ErrorCodeMissingAccountType ErrorCode = "MISSING_ACCOUNT_TYPE" + ErrorCodeInvalidPostalCode ErrorCode = "INVALID_POSTAL_CODE" + ErrorCodeInvalidFees ErrorCode = "INVALID_FEES" + ErrorCodeManuallyEnteredPaymentNotSupported ErrorCode = "MANUALLY_ENTERED_PAYMENT_NOT_SUPPORTED" + ErrorCodePaymentLimitExceeded ErrorCode = "PAYMENT_LIMIT_EXCEEDED" + ErrorCodeGiftCardAvailableAmount ErrorCode = "GIFT_CARD_AVAILABLE_AMOUNT" + ErrorCodeGiftCardBuyerDailyLimitReached ErrorCode = "GIFT_CARD_BUYER_DAILY_LIMIT_REACHED" + ErrorCodeGiftCardInvalidAmount ErrorCode = "GIFT_CARD_INVALID_AMOUNT" + ErrorCodeGiftCardMaxValueReached ErrorCode = "GIFT_CARD_MAX_VALUE_REACHED" + ErrorCodeGiftCardMerchantMaxOutstandingBalanceReached ErrorCode = "GIFT_CARD_MERCHANT_MAX_OUTSTANDING_BALANCE_REACHED" + ErrorCodeGiftCardValueAdditionLimitReached ErrorCode = "GIFT_CARD_VALUE_ADDITION_LIMIT_REACHED" + ErrorCodeAccountUnusable ErrorCode = "ACCOUNT_UNUSABLE" + ErrorCodeBuyerRefusedPayment ErrorCode = "BUYER_REFUSED_PAYMENT" + ErrorCodeDelayedTransactionExpired ErrorCode = "DELAYED_TRANSACTION_EXPIRED" + ErrorCodeDelayedTransactionCanceled ErrorCode = "DELAYED_TRANSACTION_CANCELED" + ErrorCodeDelayedTransactionCaptured ErrorCode = "DELAYED_TRANSACTION_CAPTURED" + ErrorCodeDelayedTransactionFailed ErrorCode = "DELAYED_TRANSACTION_FAILED" + ErrorCodeCardTokenExpired ErrorCode = "CARD_TOKEN_EXPIRED" + ErrorCodeCardTokenUsed ErrorCode = "CARD_TOKEN_USED" + ErrorCodeAmountTooHigh ErrorCode = "AMOUNT_TOO_HIGH" + ErrorCodeUnsupportedInstrumentType ErrorCode = "UNSUPPORTED_INSTRUMENT_TYPE" + ErrorCodeRefundAmountInvalid ErrorCode = "REFUND_AMOUNT_INVALID" + ErrorCodeRefundAlreadyPending ErrorCode = "REFUND_ALREADY_PENDING" + ErrorCodePaymentNotRefundable ErrorCode = "PAYMENT_NOT_REFUNDABLE" + ErrorCodeRefundDeclined ErrorCode = "REFUND_DECLINED" + ErrorCodeInsufficientPermissionsForRefund ErrorCode = "INSUFFICIENT_PERMISSIONS_FOR_REFUND" + ErrorCodeInvalidCardData ErrorCode = "INVALID_CARD_DATA" + ErrorCodeSourceUsed ErrorCode = "SOURCE_USED" + ErrorCodeSourceExpired ErrorCode = "SOURCE_EXPIRED" + ErrorCodeUnsupportedLoyaltyRewardTier ErrorCode = "UNSUPPORTED_LOYALTY_REWARD_TIER" + ErrorCodeLocationMismatch ErrorCode = "LOCATION_MISMATCH" + ErrorCodeOrderExpired ErrorCode = "ORDER_EXPIRED" + ErrorCodeOrderAlreadyUsed ErrorCode = "ORDER_ALREADY_USED" + ErrorCodeOrderTooManyCatalogObjects ErrorCode = "ORDER_TOO_MANY_CATALOG_OBJECTS" + ErrorCodeInsufficientInventory ErrorCode = "INSUFFICIENT_INVENTORY" + ErrorCodePriceMismatch ErrorCode = "PRICE_MISMATCH" + ErrorCodeVersionMismatch ErrorCode = "VERSION_MISMATCH" + ErrorCodeIdempotencyKeyReused ErrorCode = "IDEMPOTENCY_KEY_REUSED" + ErrorCodeUnexpectedValue ErrorCode = "UNEXPECTED_VALUE" + ErrorCodeSandboxNotSupported ErrorCode = "SANDBOX_NOT_SUPPORTED" + ErrorCodeInvalidEmailAddress ErrorCode = "INVALID_EMAIL_ADDRESS" + ErrorCodeInvalidPhoneNumber ErrorCode = "INVALID_PHONE_NUMBER" + ErrorCodeCheckoutExpired ErrorCode = "CHECKOUT_EXPIRED" + ErrorCodeBadCertificate ErrorCode = "BAD_CERTIFICATE" + ErrorCodeInvalidSquareVersionFormat ErrorCode = "INVALID_SQUARE_VERSION_FORMAT" + ErrorCodeAPIVersionIncompatible ErrorCode = "API_VERSION_INCOMPATIBLE" + ErrorCodeInvalidURL ErrorCode = "INVALID_URL" + ErrorCodeHTTPSOnly ErrorCode = "HTTPS_ONLY" + ErrorCodeUnreachableURL ErrorCode = "UNREACHABLE_URL" + ErrorCodeSessionExpired ErrorCode = "SESSION_EXPIRED" + ErrorCodeInvalidVerificationCode ErrorCode = "INVALID_VERIFICATION_CODE" + ErrorCodeCardPresenceRequired ErrorCode = "CARD_PRESENCE_REQUIRED" + ErrorCodeUnsupportedSourceType ErrorCode = "UNSUPPORTED_SOURCE_TYPE" + ErrorCodeCardMismatch ErrorCode = "CARD_MISMATCH" + ErrorCodePlaidError ErrorCode = "PLAID_ERROR" + ErrorCodePlaidErrorItemLoginRequired ErrorCode = "PLAID_ERROR_ITEM_LOGIN_REQUIRED" + ErrorCodePlaidErrorRateLimit ErrorCode = "PLAID_ERROR_RATE_LIMIT" + ErrorCodeCalculateFulfillmentRatesNoProfilesConfigured ErrorCode = "CALCULATE_FULFILLMENT_RATES_NO_PROFILES_CONFIGURED" + ErrorCodeCalculateFulfillmentRatesShipmentDestinationNotConfigured ErrorCode = "CALCULATE_FULFILLMENT_RATES_SHIPMENT_DESTINATION_NOT_CONFIGURED" + ErrorCodeCalculateFulfillmentRatesInvalidRecipientAddress ErrorCode = "CALCULATE_FULFILLMENT_RATES_INVALID_RECIPIENT_ADDRESS" + ErrorCodeCalculateFulfillmentRatesFulfillmentTypeNotSupported ErrorCode = "CALCULATE_FULFILLMENT_RATES_FULFILLMENT_TYPE_NOT_SUPPORTED" + ErrorCodeFulfillmentRateProfileDuplicateItem ErrorCode = "FULFILLMENT_RATE_PROFILE_DUPLICATE_ITEM" + ErrorCodeFulfillmentRateProfileInvalidItem ErrorCode = "FULFILLMENT_RATE_PROFILE_INVALID_ITEM" + ErrorCodeCardDeclined ErrorCode = "CARD_DECLINED" + ErrorCodeVerifyCvvFailure ErrorCode = "VERIFY_CVV_FAILURE" + ErrorCodeVerifyAvsFailure ErrorCode = "VERIFY_AVS_FAILURE" + ErrorCodeCardDeclinedCallIssuer ErrorCode = "CARD_DECLINED_CALL_ISSUER" + ErrorCodeCardDeclinedVerificationRequired ErrorCode = "CARD_DECLINED_VERIFICATION_REQUIRED" + ErrorCodeBadExpiration ErrorCode = "BAD_EXPIRATION" + ErrorCodeChipInsertionRequired ErrorCode = "CHIP_INSERTION_REQUIRED" + ErrorCodeAllowablePinTriesExceeded ErrorCode = "ALLOWABLE_PIN_TRIES_EXCEEDED" + ErrorCodeReservationDeclined ErrorCode = "RESERVATION_DECLINED" + ErrorCodeBlockedByBlocklist ErrorCode = "BLOCKED_BY_BLOCKLIST" + ErrorCodeFulfillmentPreferencesRestrictedDateNotUnique ErrorCode = "FULFILLMENT_PREFERENCES_RESTRICTED_DATE_NOT_UNIQUE" + ErrorCodeFulfillmentPreferencesInvalidSchedulingDatetime ErrorCode = "FULFILLMENT_PREFERENCES_INVALID_SCHEDULING_DATETIME" + ErrorCodeFulfillmentPreferencesInvalidFulfillmentAvailabilityWindow ErrorCode = "FULFILLMENT_PREFERENCES_INVALID_FULFILLMENT_AVAILABILITY_WINDOW" + ErrorCodeFulfillmentPreferencesFulfillmentScheduleNotAllowed ErrorCode = "FULFILLMENT_PREFERENCES_FULFILLMENT_SCHEDULE_NOT_ALLOWED" + ErrorCodeFulfillmentPreferencesAssignmentIsImmutable ErrorCode = "FULFILLMENT_PREFERENCES_ASSIGNMENT_IS_IMMUTABLE" + ErrorCodeInvalidTimezone ErrorCode = "INVALID_TIMEZONE" + ErrorCodeUnknownBodyParameter ErrorCode = "UNKNOWN_BODY_PARAMETER" + ErrorCodeFulfillmentPreferencesConflictingAssignmentType ErrorCode = "FULFILLMENT_PREFERENCES_CONFLICTING_ASSIGNMENT_TYPE" + ErrorCodeNotFound ErrorCode = "NOT_FOUND" + ErrorCodeApplePaymentProcessingCertificateHashNotFound ErrorCode = "APPLE_PAYMENT_PROCESSING_CERTIFICATE_HASH_NOT_FOUND" + ErrorCodeMethodNotAllowed ErrorCode = "METHOD_NOT_ALLOWED" + ErrorCodeNotAcceptable ErrorCode = "NOT_ACCEPTABLE" + ErrorCodeRequestTimeout ErrorCode = "REQUEST_TIMEOUT" + ErrorCodeConflict ErrorCode = "CONFLICT" + ErrorCodeGone ErrorCode = "GONE" + ErrorCodeRequestEntityTooLarge ErrorCode = "REQUEST_ENTITY_TOO_LARGE" + ErrorCodeUnsupportedMediaType ErrorCode = "UNSUPPORTED_MEDIA_TYPE" + ErrorCodeUnprocessableEntity ErrorCode = "UNPROCESSABLE_ENTITY" + ErrorCodeRateLimited ErrorCode = "RATE_LIMITED" + ErrorCodeClientClosedRequest ErrorCode = "CLIENT_CLOSED_REQUEST" + ErrorCodeNotImplemented ErrorCode = "NOT_IMPLEMENTED" + ErrorCodeBadGateway ErrorCode = "BAD_GATEWAY" + ErrorCodeServiceUnavailable ErrorCode = "SERVICE_UNAVAILABLE" + ErrorCodeTemporaryError ErrorCode = "TEMPORARY_ERROR" + ErrorCodeGatewayTimeout ErrorCode = "GATEWAY_TIMEOUT" +) + +func NewErrorCodeFromString(s string) (ErrorCode, error) { + switch s { + case "INTERNAL_SERVER_ERROR": + return ErrorCodeInternalServerError, nil + case "UNAUTHORIZED": + return ErrorCodeUnauthorized, nil + case "ACCESS_TOKEN_EXPIRED": + return ErrorCodeAccessTokenExpired, nil + case "ACCESS_TOKEN_REVOKED": + return ErrorCodeAccessTokenRevoked, nil + case "CLIENT_DISABLED": + return ErrorCodeClientDisabled, nil + case "FORBIDDEN": + return ErrorCodeForbidden, nil + case "INSUFFICIENT_SCOPES": + return ErrorCodeInsufficientScopes, nil + case "APPLICATION_DISABLED": + return ErrorCodeApplicationDisabled, nil + case "V1_APPLICATION": + return ErrorCodeV1Application, nil + case "V1_ACCESS_TOKEN": + return ErrorCodeV1AccessToken, nil + case "CARD_PROCESSING_NOT_ENABLED": + return ErrorCodeCardProcessingNotEnabled, nil + case "MERCHANT_SUBSCRIPTION_NOT_FOUND": + return ErrorCodeMerchantSubscriptionNotFound, nil + case "BAD_REQUEST": + return ErrorCodeBadRequest, nil + case "MISSING_REQUIRED_PARAMETER": + return ErrorCodeMissingRequiredParameter, nil + case "INCORRECT_TYPE": + return ErrorCodeIncorrectType, nil + case "INVALID_TIME": + return ErrorCodeInvalidTime, nil + case "INVALID_TIME_RANGE": + return ErrorCodeInvalidTimeRange, nil + case "INVALID_VALUE": + return ErrorCodeInvalidValue, nil + case "INVALID_CURSOR": + return ErrorCodeInvalidCursor, nil + case "UNKNOWN_QUERY_PARAMETER": + return ErrorCodeUnknownQueryParameter, nil + case "CONFLICTING_PARAMETERS": + return ErrorCodeConflictingParameters, nil + case "EXPECTED_JSON_BODY": + return ErrorCodeExpectedJSONBody, nil + case "INVALID_SORT_ORDER": + return ErrorCodeInvalidSortOrder, nil + case "VALUE_REGEX_MISMATCH": + return ErrorCodeValueRegexMismatch, nil + case "VALUE_TOO_SHORT": + return ErrorCodeValueTooShort, nil + case "VALUE_TOO_LONG": + return ErrorCodeValueTooLong, nil + case "VALUE_TOO_LOW": + return ErrorCodeValueTooLow, nil + case "VALUE_TOO_HIGH": + return ErrorCodeValueTooHigh, nil + case "VALUE_EMPTY": + return ErrorCodeValueEmpty, nil + case "ARRAY_LENGTH_TOO_LONG": + return ErrorCodeArrayLengthTooLong, nil + case "ARRAY_LENGTH_TOO_SHORT": + return ErrorCodeArrayLengthTooShort, nil + case "ARRAY_EMPTY": + return ErrorCodeArrayEmpty, nil + case "EXPECTED_BOOLEAN": + return ErrorCodeExpectedBoolean, nil + case "EXPECTED_INTEGER": + return ErrorCodeExpectedInteger, nil + case "EXPECTED_FLOAT": + return ErrorCodeExpectedFloat, nil + case "EXPECTED_STRING": + return ErrorCodeExpectedString, nil + case "EXPECTED_OBJECT": + return ErrorCodeExpectedObject, nil + case "EXPECTED_ARRAY": + return ErrorCodeExpectedArray, nil + case "EXPECTED_MAP": + return ErrorCodeExpectedMap, nil + case "EXPECTED_BASE64_ENCODED_BYTE_ARRAY": + return ErrorCodeExpectedBase64EncodedByteArray, nil + case "INVALID_ARRAY_VALUE": + return ErrorCodeInvalidArrayValue, nil + case "INVALID_ENUM_VALUE": + return ErrorCodeInvalidEnumValue, nil + case "INVALID_CONTENT_TYPE": + return ErrorCodeInvalidContentType, nil + case "INVALID_FORM_VALUE": + return ErrorCodeInvalidFormValue, nil + case "CUSTOMER_NOT_FOUND": + return ErrorCodeCustomerNotFound, nil + case "BUYER_NOT_FOUND": + return ErrorCodeBuyerNotFound, nil + case "ONE_INSTRUMENT_EXPECTED": + return ErrorCodeOneInstrumentExpected, nil + case "NO_FIELDS_SET": + return ErrorCodeNoFieldsSet, nil + case "DEPRECATED_FIELD_SET": + return ErrorCodeDeprecatedFieldSet, nil + case "RETIRED_FIELD_SET": + return ErrorCodeRetiredFieldSet, nil + case "TOO_MANY_MAP_ENTRIES": + return ErrorCodeTooManyMapEntries, nil + case "MAP_KEY_LENGTH_TOO_SHORT": + return ErrorCodeMapKeyLengthTooShort, nil + case "MAP_KEY_LENGTH_TOO_LONG": + return ErrorCodeMapKeyLengthTooLong, nil + case "CUSTOMER_MISSING_NAME": + return ErrorCodeCustomerMissingName, nil + case "CUSTOMER_MISSING_EMAIL": + return ErrorCodeCustomerMissingEmail, nil + case "INVALID_PAUSE_LENGTH": + return ErrorCodeInvalidPauseLength, nil + case "INVALID_DATE": + return ErrorCodeInvalidDate, nil + case "JOB_TEMPLATE_NAME_TAKEN": + return ErrorCodeJobTemplateNameTaken, nil + case "CLIENT_NOT_SUPPORTED": + return ErrorCodeClientNotSupported, nil + case "UNSUPPORTED_COUNTRY": + return ErrorCodeUnsupportedCountry, nil + case "UNSUPPORTED_CURRENCY": + return ErrorCodeUnsupportedCurrency, nil + case "APPLE_TTP_PIN_TOKEN": + return ErrorCodeAppleTtpPinToken, nil + case "CARD_EXPIRED": + return ErrorCodeCardExpired, nil + case "INVALID_EXPIRATION": + return ErrorCodeInvalidExpiration, nil + case "INVALID_EXPIRATION_YEAR": + return ErrorCodeInvalidExpirationYear, nil + case "INVALID_EXPIRATION_DATE": + return ErrorCodeInvalidExpirationDate, nil + case "UNSUPPORTED_CARD_BRAND": + return ErrorCodeUnsupportedCardBrand, nil + case "UNSUPPORTED_ENTRY_METHOD": + return ErrorCodeUnsupportedEntryMethod, nil + case "INVALID_ENCRYPTED_CARD": + return ErrorCodeInvalidEncryptedCard, nil + case "INVALID_CARD": + return ErrorCodeInvalidCard, nil + case "PAYMENT_AMOUNT_MISMATCH": + return ErrorCodePaymentAmountMismatch, nil + case "GENERIC_DECLINE": + return ErrorCodeGenericDecline, nil + case "CVV_FAILURE": + return ErrorCodeCvvFailure, nil + case "ADDRESS_VERIFICATION_FAILURE": + return ErrorCodeAddressVerificationFailure, nil + case "INVALID_ACCOUNT": + return ErrorCodeInvalidAccount, nil + case "CURRENCY_MISMATCH": + return ErrorCodeCurrencyMismatch, nil + case "INSUFFICIENT_FUNDS": + return ErrorCodeInsufficientFunds, nil + case "INSUFFICIENT_PERMISSIONS": + return ErrorCodeInsufficientPermissions, nil + case "CARDHOLDER_INSUFFICIENT_PERMISSIONS": + return ErrorCodeCardholderInsufficientPermissions, nil + case "INVALID_LOCATION": + return ErrorCodeInvalidLocation, nil + case "TRANSACTION_LIMIT": + return ErrorCodeTransactionLimit, nil + case "VOICE_FAILURE": + return ErrorCodeVoiceFailure, nil + case "PAN_FAILURE": + return ErrorCodePanFailure, nil + case "EXPIRATION_FAILURE": + return ErrorCodeExpirationFailure, nil + case "CARD_NOT_SUPPORTED": + return ErrorCodeCardNotSupported, nil + case "ISSUER_INSTALLMENT_ERROR": + return ErrorCodeIssuerInstallmentError, nil + case "INVALID_PIN": + return ErrorCodeInvalidPin, nil + case "MISSING_PIN": + return ErrorCodeMissingPin, nil + case "MISSING_ACCOUNT_TYPE": + return ErrorCodeMissingAccountType, nil + case "INVALID_POSTAL_CODE": + return ErrorCodeInvalidPostalCode, nil + case "INVALID_FEES": + return ErrorCodeInvalidFees, nil + case "MANUALLY_ENTERED_PAYMENT_NOT_SUPPORTED": + return ErrorCodeManuallyEnteredPaymentNotSupported, nil + case "PAYMENT_LIMIT_EXCEEDED": + return ErrorCodePaymentLimitExceeded, nil + case "GIFT_CARD_AVAILABLE_AMOUNT": + return ErrorCodeGiftCardAvailableAmount, nil + case "GIFT_CARD_BUYER_DAILY_LIMIT_REACHED": + return ErrorCodeGiftCardBuyerDailyLimitReached, nil + case "GIFT_CARD_INVALID_AMOUNT": + return ErrorCodeGiftCardInvalidAmount, nil + case "GIFT_CARD_MAX_VALUE_REACHED": + return ErrorCodeGiftCardMaxValueReached, nil + case "GIFT_CARD_MERCHANT_MAX_OUTSTANDING_BALANCE_REACHED": + return ErrorCodeGiftCardMerchantMaxOutstandingBalanceReached, nil + case "GIFT_CARD_VALUE_ADDITION_LIMIT_REACHED": + return ErrorCodeGiftCardValueAdditionLimitReached, nil + case "ACCOUNT_UNUSABLE": + return ErrorCodeAccountUnusable, nil + case "BUYER_REFUSED_PAYMENT": + return ErrorCodeBuyerRefusedPayment, nil + case "DELAYED_TRANSACTION_EXPIRED": + return ErrorCodeDelayedTransactionExpired, nil + case "DELAYED_TRANSACTION_CANCELED": + return ErrorCodeDelayedTransactionCanceled, nil + case "DELAYED_TRANSACTION_CAPTURED": + return ErrorCodeDelayedTransactionCaptured, nil + case "DELAYED_TRANSACTION_FAILED": + return ErrorCodeDelayedTransactionFailed, nil + case "CARD_TOKEN_EXPIRED": + return ErrorCodeCardTokenExpired, nil + case "CARD_TOKEN_USED": + return ErrorCodeCardTokenUsed, nil + case "AMOUNT_TOO_HIGH": + return ErrorCodeAmountTooHigh, nil + case "UNSUPPORTED_INSTRUMENT_TYPE": + return ErrorCodeUnsupportedInstrumentType, nil + case "REFUND_AMOUNT_INVALID": + return ErrorCodeRefundAmountInvalid, nil + case "REFUND_ALREADY_PENDING": + return ErrorCodeRefundAlreadyPending, nil + case "PAYMENT_NOT_REFUNDABLE": + return ErrorCodePaymentNotRefundable, nil + case "REFUND_DECLINED": + return ErrorCodeRefundDeclined, nil + case "INSUFFICIENT_PERMISSIONS_FOR_REFUND": + return ErrorCodeInsufficientPermissionsForRefund, nil + case "INVALID_CARD_DATA": + return ErrorCodeInvalidCardData, nil + case "SOURCE_USED": + return ErrorCodeSourceUsed, nil + case "SOURCE_EXPIRED": + return ErrorCodeSourceExpired, nil + case "UNSUPPORTED_LOYALTY_REWARD_TIER": + return ErrorCodeUnsupportedLoyaltyRewardTier, nil + case "LOCATION_MISMATCH": + return ErrorCodeLocationMismatch, nil + case "ORDER_EXPIRED": + return ErrorCodeOrderExpired, nil + case "ORDER_ALREADY_USED": + return ErrorCodeOrderAlreadyUsed, nil + case "ORDER_TOO_MANY_CATALOG_OBJECTS": + return ErrorCodeOrderTooManyCatalogObjects, nil + case "INSUFFICIENT_INVENTORY": + return ErrorCodeInsufficientInventory, nil + case "PRICE_MISMATCH": + return ErrorCodePriceMismatch, nil + case "VERSION_MISMATCH": + return ErrorCodeVersionMismatch, nil + case "IDEMPOTENCY_KEY_REUSED": + return ErrorCodeIdempotencyKeyReused, nil + case "UNEXPECTED_VALUE": + return ErrorCodeUnexpectedValue, nil + case "SANDBOX_NOT_SUPPORTED": + return ErrorCodeSandboxNotSupported, nil + case "INVALID_EMAIL_ADDRESS": + return ErrorCodeInvalidEmailAddress, nil + case "INVALID_PHONE_NUMBER": + return ErrorCodeInvalidPhoneNumber, nil + case "CHECKOUT_EXPIRED": + return ErrorCodeCheckoutExpired, nil + case "BAD_CERTIFICATE": + return ErrorCodeBadCertificate, nil + case "INVALID_SQUARE_VERSION_FORMAT": + return ErrorCodeInvalidSquareVersionFormat, nil + case "API_VERSION_INCOMPATIBLE": + return ErrorCodeAPIVersionIncompatible, nil + case "INVALID_URL": + return ErrorCodeInvalidURL, nil + case "HTTPS_ONLY": + return ErrorCodeHTTPSOnly, nil + case "UNREACHABLE_URL": + return ErrorCodeUnreachableURL, nil + case "SESSION_EXPIRED": + return ErrorCodeSessionExpired, nil + case "INVALID_VERIFICATION_CODE": + return ErrorCodeInvalidVerificationCode, nil + case "CARD_PRESENCE_REQUIRED": + return ErrorCodeCardPresenceRequired, nil + case "UNSUPPORTED_SOURCE_TYPE": + return ErrorCodeUnsupportedSourceType, nil + case "CARD_MISMATCH": + return ErrorCodeCardMismatch, nil + case "PLAID_ERROR": + return ErrorCodePlaidError, nil + case "PLAID_ERROR_ITEM_LOGIN_REQUIRED": + return ErrorCodePlaidErrorItemLoginRequired, nil + case "PLAID_ERROR_RATE_LIMIT": + return ErrorCodePlaidErrorRateLimit, nil + case "CALCULATE_FULFILLMENT_RATES_NO_PROFILES_CONFIGURED": + return ErrorCodeCalculateFulfillmentRatesNoProfilesConfigured, nil + case "CALCULATE_FULFILLMENT_RATES_SHIPMENT_DESTINATION_NOT_CONFIGURED": + return ErrorCodeCalculateFulfillmentRatesShipmentDestinationNotConfigured, nil + case "CALCULATE_FULFILLMENT_RATES_INVALID_RECIPIENT_ADDRESS": + return ErrorCodeCalculateFulfillmentRatesInvalidRecipientAddress, nil + case "CALCULATE_FULFILLMENT_RATES_FULFILLMENT_TYPE_NOT_SUPPORTED": + return ErrorCodeCalculateFulfillmentRatesFulfillmentTypeNotSupported, nil + case "FULFILLMENT_RATE_PROFILE_DUPLICATE_ITEM": + return ErrorCodeFulfillmentRateProfileDuplicateItem, nil + case "FULFILLMENT_RATE_PROFILE_INVALID_ITEM": + return ErrorCodeFulfillmentRateProfileInvalidItem, nil + case "CARD_DECLINED": + return ErrorCodeCardDeclined, nil + case "VERIFY_CVV_FAILURE": + return ErrorCodeVerifyCvvFailure, nil + case "VERIFY_AVS_FAILURE": + return ErrorCodeVerifyAvsFailure, nil + case "CARD_DECLINED_CALL_ISSUER": + return ErrorCodeCardDeclinedCallIssuer, nil + case "CARD_DECLINED_VERIFICATION_REQUIRED": + return ErrorCodeCardDeclinedVerificationRequired, nil + case "BAD_EXPIRATION": + return ErrorCodeBadExpiration, nil + case "CHIP_INSERTION_REQUIRED": + return ErrorCodeChipInsertionRequired, nil + case "ALLOWABLE_PIN_TRIES_EXCEEDED": + return ErrorCodeAllowablePinTriesExceeded, nil + case "RESERVATION_DECLINED": + return ErrorCodeReservationDeclined, nil + case "BLOCKED_BY_BLOCKLIST": + return ErrorCodeBlockedByBlocklist, nil + case "FULFILLMENT_PREFERENCES_RESTRICTED_DATE_NOT_UNIQUE": + return ErrorCodeFulfillmentPreferencesRestrictedDateNotUnique, nil + case "FULFILLMENT_PREFERENCES_INVALID_SCHEDULING_DATETIME": + return ErrorCodeFulfillmentPreferencesInvalidSchedulingDatetime, nil + case "FULFILLMENT_PREFERENCES_INVALID_FULFILLMENT_AVAILABILITY_WINDOW": + return ErrorCodeFulfillmentPreferencesInvalidFulfillmentAvailabilityWindow, nil + case "FULFILLMENT_PREFERENCES_FULFILLMENT_SCHEDULE_NOT_ALLOWED": + return ErrorCodeFulfillmentPreferencesFulfillmentScheduleNotAllowed, nil + case "FULFILLMENT_PREFERENCES_ASSIGNMENT_IS_IMMUTABLE": + return ErrorCodeFulfillmentPreferencesAssignmentIsImmutable, nil + case "INVALID_TIMEZONE": + return ErrorCodeInvalidTimezone, nil + case "UNKNOWN_BODY_PARAMETER": + return ErrorCodeUnknownBodyParameter, nil + case "FULFILLMENT_PREFERENCES_CONFLICTING_ASSIGNMENT_TYPE": + return ErrorCodeFulfillmentPreferencesConflictingAssignmentType, nil + case "NOT_FOUND": + return ErrorCodeNotFound, nil + case "APPLE_PAYMENT_PROCESSING_CERTIFICATE_HASH_NOT_FOUND": + return ErrorCodeApplePaymentProcessingCertificateHashNotFound, nil + case "METHOD_NOT_ALLOWED": + return ErrorCodeMethodNotAllowed, nil + case "NOT_ACCEPTABLE": + return ErrorCodeNotAcceptable, nil + case "REQUEST_TIMEOUT": + return ErrorCodeRequestTimeout, nil + case "CONFLICT": + return ErrorCodeConflict, nil + case "GONE": + return ErrorCodeGone, nil + case "REQUEST_ENTITY_TOO_LARGE": + return ErrorCodeRequestEntityTooLarge, nil + case "UNSUPPORTED_MEDIA_TYPE": + return ErrorCodeUnsupportedMediaType, nil + case "UNPROCESSABLE_ENTITY": + return ErrorCodeUnprocessableEntity, nil + case "RATE_LIMITED": + return ErrorCodeRateLimited, nil + case "CLIENT_CLOSED_REQUEST": + return ErrorCodeClientClosedRequest, nil + case "NOT_IMPLEMENTED": + return ErrorCodeNotImplemented, nil + case "BAD_GATEWAY": + return ErrorCodeBadGateway, nil + case "SERVICE_UNAVAILABLE": + return ErrorCodeServiceUnavailable, nil + case "TEMPORARY_ERROR": + return ErrorCodeTemporaryError, nil + case "GATEWAY_TIMEOUT": + return ErrorCodeGatewayTimeout, nil + } + var t ErrorCode + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (e ErrorCode) Ptr() *ErrorCode { + return &e +} + +type Event struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The ID of the target location associated with the event. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The type of event this represents. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *EventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (e *Event) GetExtraProperties() map[string]interface{} { + return e.extraProperties +} + +func (e *Event) UnmarshalJSON(data []byte) error { + type unmarshaler Event + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = Event(value) + + extraProperties, err := core.ExtractExtraProperties(data, *e) + if err != nil { + return err + } + e.extraProperties = extraProperties + + e._rawJSON = json.RawMessage(data) + return nil +} + +func (e *Event) String() string { + if len(e._rawJSON) > 0 { + if value, err := core.StringifyJSON(e._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(e); err == nil { + return value + } + return fmt.Sprintf("%#v", e) +} + +type EventData struct { + // The name of the affected object’s type. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The ID of the affected object. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // This is true if the affected object has been deleted; otherwise, it's absent. + Deleted *bool `json:"deleted,omitempty" url:"deleted,omitempty"` + // An object containing fields and values relevant to the event. It is absent if the affected object has been deleted. + Object map[string]interface{} `json:"object,omitempty" url:"object,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (e *EventData) GetExtraProperties() map[string]interface{} { + return e.extraProperties +} + +func (e *EventData) UnmarshalJSON(data []byte) error { + type unmarshaler EventData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = EventData(value) + + extraProperties, err := core.ExtractExtraProperties(data, *e) + if err != nil { + return err + } + e.extraProperties = extraProperties + + e._rawJSON = json.RawMessage(data) + return nil +} + +func (e *EventData) String() string { + if len(e._rawJSON) > 0 { + if value, err := core.StringifyJSON(e._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(e); err == nil { + return value + } + return fmt.Sprintf("%#v", e) +} + +// Contains metadata about a particular [Event](entity:Event). +type EventMetadata struct { + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The API version of the event. This corresponds to the default API version of the developer application at the time when the event was created. + APIVersion *string `json:"api_version,omitempty" url:"api_version,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (e *EventMetadata) GetExtraProperties() map[string]interface{} { + return e.extraProperties +} + +func (e *EventMetadata) UnmarshalJSON(data []byte) error { + type unmarshaler EventMetadata + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = EventMetadata(value) + + extraProperties, err := core.ExtractExtraProperties(data, *e) + if err != nil { + return err + } + e.extraProperties = extraProperties + + e._rawJSON = json.RawMessage(data) + return nil +} + +func (e *EventMetadata) String() string { + if len(e._rawJSON) > 0 { + if value, err := core.StringifyJSON(e._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(e); err == nil { + return value + } + return fmt.Sprintf("%#v", e) +} + +// Contains the metadata of a webhook event type. +type EventTypeMetadata struct { + // The event type. + EventType *string `json:"event_type,omitempty" url:"event_type,omitempty"` + // The API version at which the event type was introduced. + APIVersionIntroduced *string `json:"api_version_introduced,omitempty" url:"api_version_introduced,omitempty"` + // The release status of the event type. + ReleaseStatus *string `json:"release_status,omitempty" url:"release_status,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (e *EventTypeMetadata) GetExtraProperties() map[string]interface{} { + return e.extraProperties +} + +func (e *EventTypeMetadata) UnmarshalJSON(data []byte) error { + type unmarshaler EventTypeMetadata + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = EventTypeMetadata(value) + + extraProperties, err := core.ExtractExtraProperties(data, *e) + if err != nil { + return err + } + e.extraProperties = extraProperties + + e._rawJSON = json.RawMessage(data) + return nil +} + +func (e *EventTypeMetadata) String() string { + if len(e._rawJSON) > 0 { + if value, err := core.StringifyJSON(e._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(e); err == nil { + return value + } + return fmt.Sprintf("%#v", e) +} + +// Indicates which products matched by a CatalogPricingRule +// will be excluded if the pricing rule uses an exclude set. +type ExcludeStrategy string + +const ( + ExcludeStrategyExcludeStrategyDoNotUse ExcludeStrategy = "EXCLUDE_STRATEGY_DO_NOT_USE" + ExcludeStrategyLeastExpensive ExcludeStrategy = "LEAST_EXPENSIVE" + ExcludeStrategyMostExpensive ExcludeStrategy = "MOST_EXPENSIVE" +) + +func NewExcludeStrategyFromString(s string) (ExcludeStrategy, error) { + switch s { + case "EXCLUDE_STRATEGY_DO_NOT_USE": + return ExcludeStrategyExcludeStrategyDoNotUse, nil + case "LEAST_EXPENSIVE": + return ExcludeStrategyLeastExpensive, nil + case "MOST_EXPENSIVE": + return ExcludeStrategyMostExpensive, nil + } + var t ExcludeStrategy + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (e ExcludeStrategy) Ptr() *ExcludeStrategy { + return &e +} + +// Stores details about an external payment. Contains only non-confidential information. +// For more information, see +// [Take External Payments](https://developer.squareup.com/docs/payments-api/take-payments/external-payments). +type ExternalPaymentDetails struct { + // The type of external payment the seller received. It can be one of the following: + // + // - CHECK - Paid using a physical check. + // - BANK_TRANSFER - Paid using external bank transfer. + // - OTHER_GIFT_CARD - Paid using a non-Square gift card. + // - CRYPTO - Paid using a crypto currency. + // - SQUARE_CASH - Paid using Square Cash App. + // - SOCIAL - Paid using peer-to-peer payment applications. + // - EXTERNAL - A third-party application gathered this payment outside of Square. + // - EMONEY - Paid using an E-money provider. + // - CARD - A credit or debit card that Square does not support. + // - STORED_BALANCE - Use for house accounts, store credit, and so forth. + // - FOOD_VOUCHER - Restaurant voucher provided by employers to employees to pay for meals + // - OTHER - A type not listed here. + Type string `json:"type" url:"type"` + // A description of the external payment source. For example, + // "Food Delivery Service". + Source string `json:"source" url:"source"` + // An ID to associate the payment to its originating source. + SourceID *string `json:"source_id,omitempty" url:"source_id,omitempty"` + // The fees paid to the source. The `amount_money` minus this field is + // the net amount seller receives. + SourceFeeMoney *Money `json:"source_fee_money,omitempty" url:"source_fee_money,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (e *ExternalPaymentDetails) GetExtraProperties() map[string]interface{} { + return e.extraProperties +} + +func (e *ExternalPaymentDetails) UnmarshalJSON(data []byte) error { + type unmarshaler ExternalPaymentDetails + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = ExternalPaymentDetails(value) + + extraProperties, err := core.ExtractExtraProperties(data, *e) + if err != nil { + return err + } + e.extraProperties = extraProperties + + e._rawJSON = json.RawMessage(data) + return nil +} + +func (e *ExternalPaymentDetails) String() string { + if len(e._rawJSON) > 0 { + if value, err := core.StringifyJSON(e._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(e); err == nil { + return value + } + return fmt.Sprintf("%#v", e) +} + +// A filter to select resources based on an exact field value. For any given +// value, the value can only be in one property. Depending on the field, either +// all properties can be set or only a subset will be available. +// +// Refer to the documentation of the field. +type FilterValue struct { + // A list of terms that must be present on the field of the resource. + All []string `json:"all,omitempty" url:"all,omitempty"` + // A list of terms where at least one of them must be present on the + // field of the resource. + Any []string `json:"any,omitempty" url:"any,omitempty"` + // A list of terms that must not be present on the field the resource + None []string `json:"none,omitempty" url:"none,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (f *FilterValue) GetExtraProperties() map[string]interface{} { + return f.extraProperties +} + +func (f *FilterValue) UnmarshalJSON(data []byte) error { + type unmarshaler FilterValue + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *f = FilterValue(value) + + extraProperties, err := core.ExtractExtraProperties(data, *f) + if err != nil { + return err + } + f.extraProperties = extraProperties + + f._rawJSON = json.RawMessage(data) + return nil +} + +func (f *FilterValue) String() string { + if len(f._rawJSON) > 0 { + if value, err := core.StringifyJSON(f._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(f); err == nil { + return value + } + return fmt.Sprintf("%#v", f) +} + +// Specifies a decimal number range. +type FloatNumberRange struct { + // A decimal value indicating where the range starts. + StartAt *string `json:"start_at,omitempty" url:"start_at,omitempty"` + // A decimal value indicating where the range ends. + EndAt *string `json:"end_at,omitempty" url:"end_at,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (f *FloatNumberRange) GetExtraProperties() map[string]interface{} { + return f.extraProperties +} + +func (f *FloatNumberRange) UnmarshalJSON(data []byte) error { + type unmarshaler FloatNumberRange + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *f = FloatNumberRange(value) + + extraProperties, err := core.ExtractExtraProperties(data, *f) + if err != nil { + return err + } + f.extraProperties = extraProperties + + f._rawJSON = json.RawMessage(data) + return nil +} + +func (f *FloatNumberRange) String() string { + if len(f._rawJSON) > 0 { + if value, err := core.StringifyJSON(f._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(f); err == nil { + return value + } + return fmt.Sprintf("%#v", f) +} + +// Contains details about how to fulfill this order. +// Orders can only be created with at most one fulfillment using the API. +// However, orders returned by the Orders API might contain multiple fulfillments because sellers can create multiple fulfillments using Square products such as Square Online. +type Fulfillment struct { + // A unique ID that identifies the fulfillment only within this order. + UID *string `json:"uid,omitempty" url:"uid,omitempty"` + // The type of the fulfillment. + // See [FulfillmentType](#type-fulfillmenttype) for possible values + Type *FulfillmentType `json:"type,omitempty" url:"type,omitempty"` + // The state of the fulfillment. + // See [FulfillmentState](#type-fulfillmentstate) for possible values + State *FulfillmentState `json:"state,omitempty" url:"state,omitempty"` + // Describes what order line items this fulfillment applies to. + // It can be `ALL` or `ENTRY_LIST` with a supplied list of fulfillment entries. + // See [FulfillmentFulfillmentLineItemApplication](#type-fulfillmentfulfillmentlineitemapplication) for possible values + LineItemApplication *FulfillmentFulfillmentLineItemApplication `json:"line_item_application,omitempty" url:"line_item_application,omitempty"` + // A list of entries pertaining to the fulfillment of an order. Each entry must reference + // a valid `uid` for an order line item in the `line_item_uid` field, as well as a `quantity` to + // fulfill. + // + // Multiple entries can reference the same line item `uid`, as long as the total quantity among + // all fulfillment entries referencing a single line item does not exceed the quantity of the + // order's line item itself. + // + // An order cannot be marked as `COMPLETED` before all fulfillments are `COMPLETED`, + // `CANCELED`, or `FAILED`. Fulfillments can be created and completed independently + // before order completion. + Entries []*FulfillmentFulfillmentEntry `json:"entries,omitempty" url:"entries,omitempty"` + // Application-defined data attached to this fulfillment. Metadata fields are intended + // to store descriptive references or associations with an entity in another system or store brief + // information about the object. Square does not process this field; it only stores and returns it + // in relevant API calls. Do not use metadata to store any sensitive information (such as personally + // identifiable information or card details). + // + // Keys written by applications must be 60 characters or less and must be in the character set + // `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed + // with a namespace, separated from the key with a ':' character. + // + // Values have a maximum length of 255 characters. + // + // An application can have up to 10 entries per metadata field. + // + // Entries written by applications are private and can only be read or modified by the same + // application. + // + // For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). + Metadata map[string]*string `json:"metadata,omitempty" url:"metadata,omitempty"` + // Contains details for a pickup fulfillment. These details are required when the fulfillment + // type is `PICKUP`. + PickupDetails *FulfillmentPickupDetails `json:"pickup_details,omitempty" url:"pickup_details,omitempty"` + // Contains details for a shipment fulfillment. These details are required when the fulfillment type + // is `SHIPMENT`. + // + // A shipment fulfillment's relationship to fulfillment `state`: + // `PROPOSED`: A shipment is requested. + // `RESERVED`: Fulfillment in progress. Shipment processing. + // `PREPARED`: Shipment packaged. Shipping label created. + // `COMPLETED`: Package has been shipped. + // `CANCELED`: Shipment has been canceled. + // `FAILED`: Shipment has failed. + ShipmentDetails *FulfillmentShipmentDetails `json:"shipment_details,omitempty" url:"shipment_details,omitempty"` + // Describes delivery details of an order fulfillment. + DeliveryDetails *FulfillmentDeliveryDetails `json:"delivery_details,omitempty" url:"delivery_details,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (f *Fulfillment) GetExtraProperties() map[string]interface{} { + return f.extraProperties +} + +func (f *Fulfillment) UnmarshalJSON(data []byte) error { + type unmarshaler Fulfillment + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *f = Fulfillment(value) + + extraProperties, err := core.ExtractExtraProperties(data, *f) + if err != nil { + return err + } + f.extraProperties = extraProperties + + f._rawJSON = json.RawMessage(data) + return nil +} + +func (f *Fulfillment) String() string { + if len(f._rawJSON) > 0 { + if value, err := core.StringifyJSON(f._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(f); err == nil { + return value + } + return fmt.Sprintf("%#v", f) +} + +// Describes delivery details of an order fulfillment. +type FulfillmentDeliveryDetails struct { + // The contact information for the person to receive the fulfillment. + Recipient *FulfillmentRecipient `json:"recipient,omitempty" url:"recipient,omitempty"` + // Indicates the fulfillment delivery schedule type. If `SCHEDULED`, then + // `deliver_at` is required. If `ASAP`, then `prep_time_duration` is required. The default is `SCHEDULED`. + // See [OrderFulfillmentDeliveryDetailsScheduleType](#type-orderfulfillmentdeliverydetailsscheduletype) for possible values + ScheduleType *FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType `json:"schedule_type,omitempty" url:"schedule_type,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when the fulfillment was placed. + // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + // + // Must be in RFC 3339 timestamp format, e.g., "2016-09-04T23:59:33.123Z". + PlacedAt *string `json:"placed_at,omitempty" url:"placed_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // that represents the start of the delivery period. + // When the fulfillment `schedule_type` is `ASAP`, the field is automatically + // set to the current time plus the `prep_time_duration`. + // Otherwise, the application can set this field while the fulfillment `state` is + // `PROPOSED`, `RESERVED`, or `PREPARED` (any time before the + // terminal state such as `COMPLETED`, `CANCELED`, and `FAILED`). + // + // The timestamp must be in RFC 3339 format + // (for example, "2016-09-04T23:59:33.123Z"). + DeliverAt *string `json:"deliver_at,omitempty" url:"deliver_at,omitempty"` + // The duration of time it takes to prepare and deliver this fulfillment. + // The duration must be in RFC 3339 format (for example, "P1W3D"). + PrepTimeDuration *string `json:"prep_time_duration,omitempty" url:"prep_time_duration,omitempty"` + // The time period after `deliver_at` in which to deliver the order. + // Applications can set this field when the fulfillment `state` is + // `PROPOSED`, `RESERVED`, or `PREPARED` (any time before the terminal state + // such as `COMPLETED`, `CANCELED`, and `FAILED`). + // + // The duration must be in RFC 3339 format (for example, "P1W3D"). + DeliveryWindowDuration *string `json:"delivery_window_duration,omitempty" url:"delivery_window_duration,omitempty"` + // Provides additional instructions about the delivery fulfillment. + // It is displayed in the Square Point of Sale application and set by the API. + Note *string `json:"note,omitempty" url:"note,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicates when the seller completed the fulfillment. + // This field is automatically set when fulfillment `state` changes to `COMPLETED`. + // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + CompletedAt *string `json:"completed_at,omitempty" url:"completed_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicates when the seller started processing the fulfillment. + // This field is automatically set when the fulfillment `state` changes to `RESERVED`. + // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + InProgressAt *string `json:"in_progress_at,omitempty" url:"in_progress_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when the fulfillment was rejected. This field is + // automatically set when the fulfillment `state` changes to `FAILED`. + // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + RejectedAt *string `json:"rejected_at,omitempty" url:"rejected_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when the seller marked the fulfillment as ready for + // courier pickup. This field is automatically set when the fulfillment `state` changes + // to PREPARED. + // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + ReadyAt *string `json:"ready_at,omitempty" url:"ready_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when the fulfillment was delivered to the recipient. + // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + DeliveredAt *string `json:"delivered_at,omitempty" url:"delivered_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when the fulfillment was canceled. This field is automatically + // set when the fulfillment `state` changes to `CANCELED`. + // + // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + CanceledAt *string `json:"canceled_at,omitempty" url:"canceled_at,omitempty"` + // The delivery cancellation reason. Max length: 100 characters. + CancelReason *string `json:"cancel_reason,omitempty" url:"cancel_reason,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when an order can be picked up by the courier for delivery. + // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + CourierPickupAt *string `json:"courier_pickup_at,omitempty" url:"courier_pickup_at,omitempty"` + // The time period after `courier_pickup_at` in which the courier should pick up the order. + // The duration must be in RFC 3339 format (for example, "P1W3D"). + CourierPickupWindowDuration *string `json:"courier_pickup_window_duration,omitempty" url:"courier_pickup_window_duration,omitempty"` + // Whether the delivery is preferred to be no contact. + IsNoContactDelivery *bool `json:"is_no_contact_delivery,omitempty" url:"is_no_contact_delivery,omitempty"` + // A note to provide additional instructions about how to deliver the order. + DropoffNotes *string `json:"dropoff_notes,omitempty" url:"dropoff_notes,omitempty"` + // The name of the courier provider. + CourierProviderName *string `json:"courier_provider_name,omitempty" url:"courier_provider_name,omitempty"` + // The support phone number of the courier. + CourierSupportPhoneNumber *string `json:"courier_support_phone_number,omitempty" url:"courier_support_phone_number,omitempty"` + // The identifier for the delivery created by Square. + SquareDeliveryID *string `json:"square_delivery_id,omitempty" url:"square_delivery_id,omitempty"` + // The identifier for the delivery created by the third-party courier service. + ExternalDeliveryID *string `json:"external_delivery_id,omitempty" url:"external_delivery_id,omitempty"` + // The flag to indicate the delivery is managed by a third party (ie DoorDash), which means + // we may not receive all recipient information for PII purposes. + ManagedDelivery *bool `json:"managed_delivery,omitempty" url:"managed_delivery,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (f *FulfillmentDeliveryDetails) GetExtraProperties() map[string]interface{} { + return f.extraProperties +} + +func (f *FulfillmentDeliveryDetails) UnmarshalJSON(data []byte) error { + type unmarshaler FulfillmentDeliveryDetails + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *f = FulfillmentDeliveryDetails(value) + + extraProperties, err := core.ExtractExtraProperties(data, *f) + if err != nil { + return err + } + f.extraProperties = extraProperties + + f._rawJSON = json.RawMessage(data) + return nil +} + +func (f *FulfillmentDeliveryDetails) String() string { + if len(f._rawJSON) > 0 { + if value, err := core.StringifyJSON(f._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(f); err == nil { + return value + } + return fmt.Sprintf("%#v", f) +} + +// The schedule type of the delivery fulfillment. +type FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType string + +const ( + FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleTypeFulfillmentDeliveryDetailsScheduleTypeDoNotUse FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType = "FULFILLMENT_DELIVERY_DETAILS_SCHEDULE_TYPE_DO_NOT_USE" + FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleTypeScheduled FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType = "SCHEDULED" + FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleTypeAsap FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType = "ASAP" +) + +func NewFulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleTypeFromString(s string) (FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType, error) { + switch s { + case "FULFILLMENT_DELIVERY_DETAILS_SCHEDULE_TYPE_DO_NOT_USE": + return FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleTypeFulfillmentDeliveryDetailsScheduleTypeDoNotUse, nil + case "SCHEDULED": + return FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleTypeScheduled, nil + case "ASAP": + return FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleTypeAsap, nil + } + var t FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (f FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType) Ptr() *FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType { + return &f +} + +// Links an order line item to a fulfillment. Each entry must reference +// a valid `uid` for an order line item in the `line_item_uid` field, as well as a `quantity` to +// fulfill. +type FulfillmentFulfillmentEntry struct { + // A unique ID that identifies the fulfillment entry only within this order. + UID *string `json:"uid,omitempty" url:"uid,omitempty"` + // The `uid` from the order line item. + LineItemUID string `json:"line_item_uid" url:"line_item_uid"` + // The quantity of the line item being fulfilled, formatted as a decimal number. + // For example, `"3"`. + // + // Fulfillments for line items with a `quantity_unit` can have non-integer quantities. + // For example, `"1.70000"`. + Quantity string `json:"quantity" url:"quantity"` + // Application-defined data attached to this fulfillment entry. Metadata fields are intended + // to store descriptive references or associations with an entity in another system or store brief + // information about the object. Square does not process this field; it only stores and returns it + // in relevant API calls. Do not use metadata to store any sensitive information (such as personally + // identifiable information or card details). + // + // Keys written by applications must be 60 characters or less and must be in the character set + // `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed + // with a namespace, separated from the key with a ':' character. + // + // Values have a maximum length of 255 characters. + // + // An application can have up to 10 entries per metadata field. + // + // Entries written by applications are private and can only be read or modified by the same + // application. + // + // For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). + Metadata map[string]*string `json:"metadata,omitempty" url:"metadata,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (f *FulfillmentFulfillmentEntry) GetExtraProperties() map[string]interface{} { + return f.extraProperties +} + +func (f *FulfillmentFulfillmentEntry) UnmarshalJSON(data []byte) error { + type unmarshaler FulfillmentFulfillmentEntry + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *f = FulfillmentFulfillmentEntry(value) + + extraProperties, err := core.ExtractExtraProperties(data, *f) + if err != nil { + return err + } + f.extraProperties = extraProperties + + f._rawJSON = json.RawMessage(data) + return nil +} + +func (f *FulfillmentFulfillmentEntry) String() string { + if len(f._rawJSON) > 0 { + if value, err := core.StringifyJSON(f._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(f); err == nil { + return value + } + return fmt.Sprintf("%#v", f) +} + +// The `line_item_application` describes what order line items this fulfillment applies +// to. It can be `ALL` or `ENTRY_LIST` with a supplied list of fulfillment entries. +type FulfillmentFulfillmentLineItemApplication string + +const ( + FulfillmentFulfillmentLineItemApplicationUnknownApplication FulfillmentFulfillmentLineItemApplication = "UNKNOWN_APPLICATION" + FulfillmentFulfillmentLineItemApplicationAll FulfillmentFulfillmentLineItemApplication = "ALL" + FulfillmentFulfillmentLineItemApplicationEntryList FulfillmentFulfillmentLineItemApplication = "ENTRY_LIST" +) + +func NewFulfillmentFulfillmentLineItemApplicationFromString(s string) (FulfillmentFulfillmentLineItemApplication, error) { + switch s { + case "UNKNOWN_APPLICATION": + return FulfillmentFulfillmentLineItemApplicationUnknownApplication, nil + case "ALL": + return FulfillmentFulfillmentLineItemApplicationAll, nil + case "ENTRY_LIST": + return FulfillmentFulfillmentLineItemApplicationEntryList, nil + } + var t FulfillmentFulfillmentLineItemApplication + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (f FulfillmentFulfillmentLineItemApplication) Ptr() *FulfillmentFulfillmentLineItemApplication { + return &f +} + +// Contains details necessary to fulfill a pickup order. +type FulfillmentPickupDetails struct { + // Information about the person to pick up this fulfillment from a physical + // location. + Recipient *FulfillmentRecipient `json:"recipient,omitempty" url:"recipient,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when this fulfillment expires if it is not marked in progress. The timestamp must be + // in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). The expiration time can only be set + // up to 7 days in the future. If `expires_at` is not set, any new payments attached to the order + // are automatically completed. + ExpiresAt *string `json:"expires_at,omitempty" url:"expires_at,omitempty"` + // The duration of time after which an in progress pickup fulfillment is automatically moved + // to the `COMPLETED` state. The duration must be in RFC 3339 format (for example, "P1W3D"). + // + // If not set, this pickup fulfillment remains in progress until it is canceled or completed. + AutoCompleteDuration *string `json:"auto_complete_duration,omitempty" url:"auto_complete_duration,omitempty"` + // The schedule type of the pickup fulfillment. Defaults to `SCHEDULED`. + // See [FulfillmentPickupDetailsScheduleType](#type-fulfillmentpickupdetailsscheduletype) for possible values + ScheduleType *FulfillmentPickupDetailsScheduleType `json:"schedule_type,omitempty" url:"schedule_type,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // that represents the start of the pickup window. Must be in RFC 3339 timestamp format, e.g., + // "2016-09-04T23:59:33.123Z". + // + // For fulfillments with the schedule type `ASAP`, this is automatically set + // to the current time plus the expected duration to prepare the fulfillment. + PickupAt *string `json:"pickup_at,omitempty" url:"pickup_at,omitempty"` + // The window of time in which the order should be picked up after the `pickup_at` timestamp. + // Must be in RFC 3339 duration format, e.g., "P1W3D". Can be used as an + // informational guideline for merchants. + PickupWindowDuration *string `json:"pickup_window_duration,omitempty" url:"pickup_window_duration,omitempty"` + // The duration of time it takes to prepare this fulfillment. + // The duration must be in RFC 3339 format (for example, "P1W3D"). + PrepTimeDuration *string `json:"prep_time_duration,omitempty" url:"prep_time_duration,omitempty"` + // A note to provide additional instructions about the pickup + // fulfillment displayed in the Square Point of Sale application and set by the API. + Note *string `json:"note,omitempty" url:"note,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when the fulfillment was placed. The timestamp must be in RFC 3339 format + // (for example, "2016-09-04T23:59:33.123Z"). + PlacedAt *string `json:"placed_at,omitempty" url:"placed_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when the fulfillment was marked in progress. The timestamp must be in RFC 3339 format + // (for example, "2016-09-04T23:59:33.123Z"). + AcceptedAt *string `json:"accepted_at,omitempty" url:"accepted_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when the fulfillment was rejected. The timestamp must be in RFC 3339 format + // (for example, "2016-09-04T23:59:33.123Z"). + RejectedAt *string `json:"rejected_at,omitempty" url:"rejected_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when the fulfillment is marked as ready for pickup. The timestamp must be in RFC 3339 format + // (for example, "2016-09-04T23:59:33.123Z"). + ReadyAt *string `json:"ready_at,omitempty" url:"ready_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when the fulfillment expired. The timestamp must be in RFC 3339 format + // (for example, "2016-09-04T23:59:33.123Z"). + ExpiredAt *string `json:"expired_at,omitempty" url:"expired_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when the fulfillment was picked up by the recipient. The timestamp must be in RFC 3339 format + // (for example, "2016-09-04T23:59:33.123Z"). + PickedUpAt *string `json:"picked_up_at,omitempty" url:"picked_up_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when the fulfillment was canceled. The timestamp must be in RFC 3339 format + // (for example, "2016-09-04T23:59:33.123Z"). + CanceledAt *string `json:"canceled_at,omitempty" url:"canceled_at,omitempty"` + // A description of why the pickup was canceled. The maximum length: 100 characters. + CancelReason *string `json:"cancel_reason,omitempty" url:"cancel_reason,omitempty"` + // If set to `true`, indicates that this pickup order is for curbside pickup, not in-store pickup. + IsCurbsidePickup *bool `json:"is_curbside_pickup,omitempty" url:"is_curbside_pickup,omitempty"` + // Specific details for curbside pickup. These details can only be populated if `is_curbside_pickup` is set to `true`. + CurbsidePickupDetails *FulfillmentPickupDetailsCurbsidePickupDetails `json:"curbside_pickup_details,omitempty" url:"curbside_pickup_details,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (f *FulfillmentPickupDetails) GetExtraProperties() map[string]interface{} { + return f.extraProperties +} + +func (f *FulfillmentPickupDetails) UnmarshalJSON(data []byte) error { + type unmarshaler FulfillmentPickupDetails + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *f = FulfillmentPickupDetails(value) + + extraProperties, err := core.ExtractExtraProperties(data, *f) + if err != nil { + return err + } + f.extraProperties = extraProperties + + f._rawJSON = json.RawMessage(data) + return nil +} + +func (f *FulfillmentPickupDetails) String() string { + if len(f._rawJSON) > 0 { + if value, err := core.StringifyJSON(f._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(f); err == nil { + return value + } + return fmt.Sprintf("%#v", f) +} + +// Specific details for curbside pickup. +type FulfillmentPickupDetailsCurbsidePickupDetails struct { + // Specific details for curbside pickup, such as parking number and vehicle model. + CurbsideDetails *string `json:"curbside_details,omitempty" url:"curbside_details,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when the buyer arrived and is waiting for pickup. The timestamp must be in RFC 3339 format + // (for example, "2016-09-04T23:59:33.123Z"). + BuyerArrivedAt *string `json:"buyer_arrived_at,omitempty" url:"buyer_arrived_at,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (f *FulfillmentPickupDetailsCurbsidePickupDetails) GetExtraProperties() map[string]interface{} { + return f.extraProperties +} + +func (f *FulfillmentPickupDetailsCurbsidePickupDetails) UnmarshalJSON(data []byte) error { + type unmarshaler FulfillmentPickupDetailsCurbsidePickupDetails + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *f = FulfillmentPickupDetailsCurbsidePickupDetails(value) + + extraProperties, err := core.ExtractExtraProperties(data, *f) + if err != nil { + return err + } + f.extraProperties = extraProperties + + f._rawJSON = json.RawMessage(data) + return nil +} + +func (f *FulfillmentPickupDetailsCurbsidePickupDetails) String() string { + if len(f._rawJSON) > 0 { + if value, err := core.StringifyJSON(f._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(f); err == nil { + return value + } + return fmt.Sprintf("%#v", f) +} + +// The schedule type of the pickup fulfillment. +type FulfillmentPickupDetailsScheduleType string + +const ( + FulfillmentPickupDetailsScheduleTypeFulfillmentPickupDetailsScheduleTypeDoNotUse FulfillmentPickupDetailsScheduleType = "FULFILLMENT_PICKUP_DETAILS_SCHEDULE_TYPE_DO_NOT_USE" + FulfillmentPickupDetailsScheduleTypeScheduled FulfillmentPickupDetailsScheduleType = "SCHEDULED" + FulfillmentPickupDetailsScheduleTypeAsap FulfillmentPickupDetailsScheduleType = "ASAP" +) + +func NewFulfillmentPickupDetailsScheduleTypeFromString(s string) (FulfillmentPickupDetailsScheduleType, error) { + switch s { + case "FULFILLMENT_PICKUP_DETAILS_SCHEDULE_TYPE_DO_NOT_USE": + return FulfillmentPickupDetailsScheduleTypeFulfillmentPickupDetailsScheduleTypeDoNotUse, nil + case "SCHEDULED": + return FulfillmentPickupDetailsScheduleTypeScheduled, nil + case "ASAP": + return FulfillmentPickupDetailsScheduleTypeAsap, nil + } + var t FulfillmentPickupDetailsScheduleType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (f FulfillmentPickupDetailsScheduleType) Ptr() *FulfillmentPickupDetailsScheduleType { + return &f +} + +// Information about the fulfillment recipient. +type FulfillmentRecipient struct { + // The ID of the customer associated with the fulfillment. + // + // If `customer_id` is provided, the fulfillment recipient's `display_name`, + // `email_address`, and `phone_number` are automatically populated from the + // targeted customer profile. If these fields are set in the request, the request + // values override the information from the customer profile. If the + // targeted customer profile does not contain the necessary information and + // these fields are left unset, the request results in an error. + CustomerID *string `json:"customer_id,omitempty" url:"customer_id,omitempty"` + // The display name of the fulfillment recipient. This field is required. + // + // If provided, the display name overrides the corresponding customer profile value + // indicated by `customer_id`. + DisplayName *string `json:"display_name,omitempty" url:"display_name,omitempty"` + // The email address of the fulfillment recipient. + // + // If provided, the email address overrides the corresponding customer profile value + // indicated by `customer_id`. + EmailAddress *string `json:"email_address,omitempty" url:"email_address,omitempty"` + // The phone number of the fulfillment recipient. This field is required. + // + // If provided, the phone number overrides the corresponding customer profile value + // indicated by `customer_id`. + PhoneNumber *string `json:"phone_number,omitempty" url:"phone_number,omitempty"` + // The address of the fulfillment recipient. This field is required. + // + // If provided, the address overrides the corresponding customer profile value + // indicated by `customer_id`. + Address *Address `json:"address,omitempty" url:"address,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (f *FulfillmentRecipient) GetExtraProperties() map[string]interface{} { + return f.extraProperties +} + +func (f *FulfillmentRecipient) UnmarshalJSON(data []byte) error { + type unmarshaler FulfillmentRecipient + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *f = FulfillmentRecipient(value) + + extraProperties, err := core.ExtractExtraProperties(data, *f) + if err != nil { + return err + } + f.extraProperties = extraProperties + + f._rawJSON = json.RawMessage(data) + return nil +} + +func (f *FulfillmentRecipient) String() string { + if len(f._rawJSON) > 0 { + if value, err := core.StringifyJSON(f._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(f); err == nil { + return value + } + return fmt.Sprintf("%#v", f) +} + +// Contains the details necessary to fulfill a shipment order. +type FulfillmentShipmentDetails struct { + // Information about the person to receive this shipment fulfillment. + Recipient *FulfillmentRecipient `json:"recipient,omitempty" url:"recipient,omitempty"` + // The shipping carrier being used to ship this fulfillment (such as UPS, FedEx, or USPS). + Carrier *string `json:"carrier,omitempty" url:"carrier,omitempty"` + // A note with additional information for the shipping carrier. + ShippingNote *string `json:"shipping_note,omitempty" url:"shipping_note,omitempty"` + // A description of the type of shipping product purchased from the carrier + // (such as First Class, Priority, or Express). + ShippingType *string `json:"shipping_type,omitempty" url:"shipping_type,omitempty"` + // The reference number provided by the carrier to track the shipment's progress. + TrackingNumber *string `json:"tracking_number,omitempty" url:"tracking_number,omitempty"` + // A link to the tracking webpage on the carrier's website. + TrackingURL *string `json:"tracking_url,omitempty" url:"tracking_url,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when the shipment was requested. The timestamp must be in RFC 3339 format + // (for example, "2016-09-04T23:59:33.123Z"). + PlacedAt *string `json:"placed_at,omitempty" url:"placed_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when this fulfillment was moved to the `RESERVED` state, which indicates that preparation + // of this shipment has begun. The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + InProgressAt *string `json:"in_progress_at,omitempty" url:"in_progress_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when this fulfillment was moved to the `PREPARED` state, which indicates that the + // fulfillment is packaged. The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + PackagedAt *string `json:"packaged_at,omitempty" url:"packaged_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when the shipment is expected to be delivered to the shipping carrier. + // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + ExpectedShippedAt *string `json:"expected_shipped_at,omitempty" url:"expected_shipped_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when this fulfillment was moved to the `COMPLETED` state, which indicates that + // the fulfillment has been given to the shipping carrier. The timestamp must be in RFC 3339 format + // (for example, "2016-09-04T23:59:33.123Z"). + ShippedAt *string `json:"shipped_at,omitempty" url:"shipped_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating the shipment was canceled. + // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + CanceledAt *string `json:"canceled_at,omitempty" url:"canceled_at,omitempty"` + // A description of why the shipment was canceled. + CancelReason *string `json:"cancel_reason,omitempty" url:"cancel_reason,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when the shipment failed to be completed. The timestamp must be in RFC 3339 format + // (for example, "2016-09-04T23:59:33.123Z"). + FailedAt *string `json:"failed_at,omitempty" url:"failed_at,omitempty"` + // A description of why the shipment failed to be completed. + FailureReason *string `json:"failure_reason,omitempty" url:"failure_reason,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (f *FulfillmentShipmentDetails) GetExtraProperties() map[string]interface{} { + return f.extraProperties +} + +func (f *FulfillmentShipmentDetails) UnmarshalJSON(data []byte) error { + type unmarshaler FulfillmentShipmentDetails + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *f = FulfillmentShipmentDetails(value) + + extraProperties, err := core.ExtractExtraProperties(data, *f) + if err != nil { + return err + } + f.extraProperties = extraProperties + + f._rawJSON = json.RawMessage(data) + return nil +} + +func (f *FulfillmentShipmentDetails) String() string { + if len(f._rawJSON) > 0 { + if value, err := core.StringifyJSON(f._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(f); err == nil { + return value + } + return fmt.Sprintf("%#v", f) +} + +// The current state of this fulfillment. +type FulfillmentState string + +const ( + FulfillmentStateFulfillmentStateDoNotUse FulfillmentState = "FULFILLMENT_STATE_DO_NOT_USE" + FulfillmentStateProposed FulfillmentState = "PROPOSED" + FulfillmentStateReserved FulfillmentState = "RESERVED" + FulfillmentStatePrepared FulfillmentState = "PREPARED" + FulfillmentStateCompleted FulfillmentState = "COMPLETED" + FulfillmentStateCanceled FulfillmentState = "CANCELED" + FulfillmentStateFailed FulfillmentState = "FAILED" +) + +func NewFulfillmentStateFromString(s string) (FulfillmentState, error) { + switch s { + case "FULFILLMENT_STATE_DO_NOT_USE": + return FulfillmentStateFulfillmentStateDoNotUse, nil + case "PROPOSED": + return FulfillmentStateProposed, nil + case "RESERVED": + return FulfillmentStateReserved, nil + case "PREPARED": + return FulfillmentStatePrepared, nil + case "COMPLETED": + return FulfillmentStateCompleted, nil + case "CANCELED": + return FulfillmentStateCanceled, nil + case "FAILED": + return FulfillmentStateFailed, nil + } + var t FulfillmentState + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (f FulfillmentState) Ptr() *FulfillmentState { + return &f +} + +// The type of fulfillment. +type FulfillmentType string + +const ( + FulfillmentTypeFulfillmentTypeDoNotUse FulfillmentType = "FULFILLMENT_TYPE_DO_NOT_USE" + FulfillmentTypeCustom FulfillmentType = "CUSTOM" + FulfillmentTypePickup FulfillmentType = "PICKUP" + FulfillmentTypeManagedDelivery FulfillmentType = "MANAGED_DELIVERY" + FulfillmentTypeShipment FulfillmentType = "SHIPMENT" + FulfillmentTypeDigital FulfillmentType = "DIGITAL" + FulfillmentTypeDelivery FulfillmentType = "DELIVERY" + FulfillmentTypeSimple FulfillmentType = "SIMPLE" + FulfillmentTypeDineIn FulfillmentType = "DINE_IN" + FulfillmentTypeInStore FulfillmentType = "IN_STORE" +) + +func NewFulfillmentTypeFromString(s string) (FulfillmentType, error) { + switch s { + case "FULFILLMENT_TYPE_DO_NOT_USE": + return FulfillmentTypeFulfillmentTypeDoNotUse, nil + case "CUSTOM": + return FulfillmentTypeCustom, nil + case "PICKUP": + return FulfillmentTypePickup, nil + case "MANAGED_DELIVERY": + return FulfillmentTypeManagedDelivery, nil + case "SHIPMENT": + return FulfillmentTypeShipment, nil + case "DIGITAL": + return FulfillmentTypeDigital, nil + case "DELIVERY": + return FulfillmentTypeDelivery, nil + case "SIMPLE": + return FulfillmentTypeSimple, nil + case "DINE_IN": + return FulfillmentTypeDineIn, nil + case "IN_STORE": + return FulfillmentTypeInStore, nil + } + var t FulfillmentType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (f FulfillmentType) Ptr() *FulfillmentType { + return &f +} + +// Request object for fetching a specific `BankAccount` +// by the object ID. +type GetBankAccountByV1IDRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetBankAccountByV1IDRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetBankAccountByV1IDRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetBankAccountByV1IDRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetBankAccountByV1IDRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetBankAccountByV1IDRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// Response object returned by GetBankAccountByV1Id. +type GetBankAccountByV1IDResponse struct { + // Information on errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The requested `BankAccount` object. + BankAccount *BankAccount `json:"bank_account,omitempty" url:"bank_account,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetBankAccountByV1IDResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetBankAccountByV1IDResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetBankAccountByV1IDResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetBankAccountByV1IDResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetBankAccountByV1IDResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// Request object to fetch a specific `BankAccount` +// by the object ID. +type GetBankAccountRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetBankAccountRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetBankAccountRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetBankAccountRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetBankAccountRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetBankAccountRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// Response object returned by `GetBankAccount`. +type GetBankAccountResponse struct { + // Information on errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The requested `BankAccount` object. + BankAccount *BankAccount `json:"bank_account,omitempty" url:"bank_account,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetBankAccountResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetBankAccountResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetBankAccountResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetBankAccountResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetBankAccountResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +type GetBookingRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetBookingRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetBookingRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetBookingRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetBookingRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetBookingRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +type GetBookingResponse struct { + // The booking that was requested. + Booking *Booking `json:"booking,omitempty" url:"booking,omitempty"` + // Errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetBookingResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetBookingResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetBookingResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetBookingResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetBookingResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// A request to get a `BreakType` by ID. +type GetBreakTypeRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetBreakTypeRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetBreakTypeRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetBreakTypeRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetBreakTypeRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetBreakTypeRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// The response to a request to get a `BreakType`. The response contains +// the requested `BreakType` objects and might contain a set of `Error` objects if +// the request resulted in errors. +type GetBreakTypeResponse struct { + // The response object. + BreakType *BreakType `json:"break_type,omitempty" url:"break_type,omitempty"` + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetBreakTypeResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetBreakTypeResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetBreakTypeResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetBreakTypeResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetBreakTypeResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +type GetBusinessBookingProfileRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetBusinessBookingProfileRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetBusinessBookingProfileRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetBusinessBookingProfileRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetBusinessBookingProfileRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetBusinessBookingProfileRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +type GetBusinessBookingProfileResponse struct { + // The seller's booking profile. + BusinessBookingProfile *BusinessBookingProfile `json:"business_booking_profile,omitempty" url:"business_booking_profile,omitempty"` + // Errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetBusinessBookingProfileResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetBusinessBookingProfileResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetBusinessBookingProfileResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetBusinessBookingProfileResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetBusinessBookingProfileResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// Retrieves details for a specific Card. Accessible via +// HTTP requests at GET https://connect.squareup.com/v2/cards/{card_id} +type GetCardRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetCardRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetCardRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetCardRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetCardRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetCardRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// Defines the fields that are included in the response body of +// a request to the [RetrieveCard](api-endpoint:Cards-RetrieveCard) endpoint. +// +// Note: if there are errors processing the request, the card field will not be +// present. +type GetCardResponse struct { + // Information on errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The retrieved card. + Card *Card `json:"card,omitempty" url:"card,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetCardResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetCardResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetCardResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetCardResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetCardResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +type GetCashDrawerShiftResponse struct { + // The cash drawer shift queried for. + CashDrawerShift *CashDrawerShift `json:"cash_drawer_shift,omitempty" url:"cash_drawer_shift,omitempty"` + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetCashDrawerShiftResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetCashDrawerShiftResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetCashDrawerShiftResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetCashDrawerShiftResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetCashDrawerShiftResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +type GetCatalogObjectResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The `CatalogObject`s returned. + Object *CatalogObject `json:"object,omitempty" url:"object,omitempty"` + // A list of `CatalogObject`s referenced by the object in the `object` field. + RelatedObjects []*CatalogObject `json:"related_objects,omitempty" url:"related_objects,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetCatalogObjectResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetCatalogObjectResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetCatalogObjectResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetCatalogObjectResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetCatalogObjectResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// Represents a [RetrieveCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-RetrieveCustomerCustomAttributeDefinition) response. +// Either `custom_attribute_definition` or `errors` is present in the response. +type GetCustomerCustomAttributeDefinitionResponse struct { + // The retrieved custom attribute definition. + CustomAttributeDefinition *CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"custom_attribute_definition,omitempty"` + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetCustomerCustomAttributeDefinitionResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetCustomerCustomAttributeDefinitionResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetCustomerCustomAttributeDefinitionResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetCustomerCustomAttributeDefinitionResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetCustomerCustomAttributeDefinitionResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// Represents a [RetrieveCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-RetrieveCustomerCustomAttribute) response. +// Either `custom_attribute_definition` or `errors` is present in the response. +type GetCustomerCustomAttributeResponse struct { + // The retrieved custom attribute. If `with_definition` was set to `true` in the request, + // the custom attribute definition is returned in the `definition` field. + CustomAttribute *CustomAttribute `json:"custom_attribute,omitempty" url:"custom_attribute,omitempty"` + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetCustomerCustomAttributeResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetCustomerCustomAttributeResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetCustomerCustomAttributeResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetCustomerCustomAttributeResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetCustomerCustomAttributeResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// Defines the fields that can be included in a request to the +// [RetrieveCustomerGroup](api-endpoint:CustomerGroups-RetrieveCustomerGroup) endpoint. +type GetCustomerGroupRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetCustomerGroupRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetCustomerGroupRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetCustomerGroupRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetCustomerGroupRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetCustomerGroupRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// Defines the fields that are included in the response body of +// a request to the [RetrieveCustomerGroup](api-endpoint:CustomerGroups-RetrieveCustomerGroup) endpoint. +// +// Either `errors` or `group` is present in a given response (never both). +type GetCustomerGroupResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The retrieved customer group. + Group *CustomerGroup `json:"group,omitempty" url:"group,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetCustomerGroupResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetCustomerGroupResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetCustomerGroupResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetCustomerGroupResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetCustomerGroupResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// Defines the fields that are included in requests to the `RetrieveCustomer` +// endpoint. +type GetCustomerRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetCustomerRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetCustomerRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetCustomerRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetCustomerRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetCustomerRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// Defines the fields that are included in the response body of +// a request to the `RetrieveCustomer` endpoint. +// +// Either `errors` or `customer` is present in a given response (never both). +type GetCustomerResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The requested customer. + Customer *Customer `json:"customer,omitempty" url:"customer,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetCustomerResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetCustomerResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetCustomerResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetCustomerResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetCustomerResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// Defines the valid parameters for requests to the `RetrieveCustomerSegmentRequest` endpoint. +type GetCustomerSegmentRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetCustomerSegmentRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetCustomerSegmentRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetCustomerSegmentRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetCustomerSegmentRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetCustomerSegmentRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// Defines the fields that are included in the response body for requests to the `RetrieveCustomerSegment` endpoint. +// +// Either `errors` or `segment` is present in a given response (never both). +type GetCustomerSegmentResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The retrieved customer segment. + Segment *CustomerSegment `json:"segment,omitempty" url:"segment,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetCustomerSegmentResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetCustomerSegmentResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetCustomerSegmentResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetCustomerSegmentResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetCustomerSegmentResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +type GetDeviceCodeRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetDeviceCodeRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetDeviceCodeRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetDeviceCodeRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetDeviceCodeRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetDeviceCodeRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +type GetDeviceCodeResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The queried DeviceCode. + DeviceCode *DeviceCode `json:"device_code,omitempty" url:"device_code,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetDeviceCodeResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetDeviceCodeResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetDeviceCodeResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetDeviceCodeResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetDeviceCodeResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +type GetDeviceRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetDeviceRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetDeviceRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetDeviceRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetDeviceRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetDeviceRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +type GetDeviceResponse struct { + // Information about errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The requested `Device`. + Device *Device `json:"device,omitempty" url:"device,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetDeviceResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetDeviceResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetDeviceResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetDeviceResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetDeviceResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// Defines the parameters for a `RetrieveDisputeEvidence` request. +type GetDisputeEvidenceRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetDisputeEvidenceRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetDisputeEvidenceRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetDisputeEvidenceRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetDisputeEvidenceRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetDisputeEvidenceRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// Defines the fields in a `RetrieveDisputeEvidence` response. +type GetDisputeEvidenceResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // Metadata about the dispute evidence file. + Evidence *DisputeEvidence `json:"evidence,omitempty" url:"evidence,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetDisputeEvidenceResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetDisputeEvidenceResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetDisputeEvidenceResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetDisputeEvidenceResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetDisputeEvidenceResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// Defines the request parameters for the `RetrieveDispute` endpoint. +type GetDisputeRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetDisputeRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetDisputeRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetDisputeRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetDisputeRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetDisputeRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// Defines fields in a `RetrieveDispute` response. +type GetDisputeResponse struct { + // Information about errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // Details about the requested `Dispute`. + Dispute *Dispute `json:"dispute,omitempty" url:"dispute,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetDisputeResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetDisputeResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetDisputeResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetDisputeResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetDisputeResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +type GetEmployeeRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetEmployeeRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetEmployeeRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetEmployeeRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetEmployeeRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetEmployeeRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +type GetEmployeeResponse struct { + Employee *Employee `json:"employee,omitempty" url:"employee,omitempty"` + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetEmployeeResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetEmployeeResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetEmployeeResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetEmployeeResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetEmployeeResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// A request to get an `EmployeeWage`. +type GetEmployeeWageRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetEmployeeWageRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetEmployeeWageRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetEmployeeWageRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetEmployeeWageRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetEmployeeWageRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// A response to a request to get an `EmployeeWage`. The response contains +// the requested `EmployeeWage` objects and might contain a set of `Error` objects if +// the request resulted in errors. +type GetEmployeeWageResponse struct { + // The requested `EmployeeWage` object. + EmployeeWage *EmployeeWage `json:"employee_wage,omitempty" url:"employee_wage,omitempty"` + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetEmployeeWageResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetEmployeeWageResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetEmployeeWageResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetEmployeeWageResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetEmployeeWageResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// A response that contains a `GiftCard`. This response might contain a set of `Error` objects +// if the request resulted in errors. +type GetGiftCardFromGanResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // A gift card that was fetched, if present. It returns empty if an error occurred. + GiftCard *GiftCard `json:"gift_card,omitempty" url:"gift_card,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetGiftCardFromGanResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetGiftCardFromGanResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetGiftCardFromGanResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetGiftCardFromGanResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetGiftCardFromGanResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// A response that contains a `GiftCard` object. If the request resulted in errors, +// the response contains a set of `Error` objects. +type GetGiftCardFromNonceResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The retrieved gift card. + GiftCard *GiftCard `json:"gift_card,omitempty" url:"gift_card,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetGiftCardFromNonceResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetGiftCardFromNonceResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetGiftCardFromNonceResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetGiftCardFromNonceResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetGiftCardFromNonceResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// A request to retrieve digital gift cards. +type GetGiftCardRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetGiftCardRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetGiftCardRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetGiftCardRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetGiftCardRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetGiftCardRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// A response that contains a `GiftCard`. The response might contain a set of `Error` objects +// if the request resulted in errors. +type GetGiftCardResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The gift card retrieved. + GiftCard *GiftCard `json:"gift_card,omitempty" url:"gift_card,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetGiftCardResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetGiftCardResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetGiftCardResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetGiftCardResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetGiftCardResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +type GetInventoryAdjustmentRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetInventoryAdjustmentRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetInventoryAdjustmentRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetInventoryAdjustmentRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetInventoryAdjustmentRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetInventoryAdjustmentRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +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) 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 := core.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 := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.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) 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 := core.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 := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.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) 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 := core.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 := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +type GetInventoryPhysicalCountRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetInventoryPhysicalCountRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetInventoryPhysicalCountRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetInventoryPhysicalCountRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetInventoryPhysicalCountRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetInventoryPhysicalCountRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.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) 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 := core.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 := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +type GetInventoryTransferRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetInventoryTransferRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetInventoryTransferRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetInventoryTransferRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetInventoryTransferRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetInventoryTransferRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.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) 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 := core.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 := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// Describes a `GetInvoice` request. +type GetInvoiceRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetInvoiceRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetInvoiceRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetInvoiceRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetInvoiceRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetInvoiceRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// Describes a `GetInvoice` response. +type GetInvoiceResponse struct { + // The invoice requested. + Invoice *Invoice `json:"invoice,omitempty" url:"invoice,omitempty"` + // Information about errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetInvoiceResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetInvoiceResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetInvoiceResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetInvoiceResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetInvoiceResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// Defines the fields that are included in the request body for the +// [RetrieveLocation](api-endpoint:Locations-RetrieveLocation) endpoint. +type GetLocationRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetLocationRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetLocationRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetLocationRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetLocationRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetLocationRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// Defines the fields that the [RetrieveLocation](api-endpoint:Locations-RetrieveLocation) +// endpoint returns in a response. +type GetLocationResponse struct { + // Information about errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The requested location. + Location *Location `json:"location,omitempty" url:"location,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetLocationResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetLocationResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetLocationResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetLocationResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetLocationResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// A request to retrieve a loyalty account. +type GetLoyaltyAccountRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetLoyaltyAccountRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetLoyaltyAccountRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetLoyaltyAccountRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetLoyaltyAccountRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetLoyaltyAccountRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// A response that includes the loyalty account. +type GetLoyaltyAccountResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The loyalty account. + LoyaltyAccount *LoyaltyAccount `json:"loyalty_account,omitempty" url:"loyalty_account,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetLoyaltyAccountResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetLoyaltyAccountResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetLoyaltyAccountResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetLoyaltyAccountResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetLoyaltyAccountResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// A request to retrieve the [loyalty program](entity:LoyaltyProgram) that belongs to a seller. A seller can have only one loyalty program. +type GetLoyaltyProgramRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetLoyaltyProgramRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetLoyaltyProgramRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetLoyaltyProgramRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetLoyaltyProgramRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetLoyaltyProgramRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// A response that contains the loyalty program. +type GetLoyaltyProgramResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The loyalty program that was requested. + Program *LoyaltyProgram `json:"program,omitempty" url:"program,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetLoyaltyProgramResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetLoyaltyProgramResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetLoyaltyProgramResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetLoyaltyProgramResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetLoyaltyProgramResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// Represents a [RetrieveLoyaltyPromotionPromotions](api-endpoint:Loyalty-RetrieveLoyaltyPromotion) request. +type GetLoyaltyPromotionRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetLoyaltyPromotionRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetLoyaltyPromotionRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetLoyaltyPromotionRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetLoyaltyPromotionRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + + g._rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetLoyaltyPromotionRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// Represents a [RetrieveLoyaltyPromotionPromotions](api-endpoint:Loyalty-RetrieveLoyaltyPromotion) response. +type GetLoyaltyPromotionResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The retrieved loyalty promotion. + LoyaltyPromotion *LoyaltyPromotion `json:"loyalty_promotion,omitempty" url:"loyalty_promotion,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (g *GetLoyaltyPromotionResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetLoyaltyPromotionResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetLoyaltyPromotionResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CustomAttributeDefinition(value) + *g = GetLoyaltyPromotionResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *c) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - c.extraProperties = extraProperties + g.extraProperties = extraProperties - c._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (c *CustomAttributeDefinition) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { +func (g *GetLoyaltyPromotionResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(c); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", c) -} - -// The level of permission that a seller or other applications requires to -// view this custom attribute definition. -// The `Visibility` field controls who can read and write the custom attribute values -// and custom attribute definition. -type CustomAttributeDefinitionVisibility string - -const ( - CustomAttributeDefinitionVisibilityVisibilityHidden CustomAttributeDefinitionVisibility = "VISIBILITY_HIDDEN" - CustomAttributeDefinitionVisibilityVisibilityReadOnly CustomAttributeDefinitionVisibility = "VISIBILITY_READ_ONLY" - CustomAttributeDefinitionVisibilityVisibilityReadWriteValues CustomAttributeDefinitionVisibility = "VISIBILITY_READ_WRITE_VALUES" -) - -func NewCustomAttributeDefinitionVisibilityFromString(s string) (CustomAttributeDefinitionVisibility, error) { - switch s { - case "VISIBILITY_HIDDEN": - return CustomAttributeDefinitionVisibilityVisibilityHidden, nil - case "VISIBILITY_READ_ONLY": - return CustomAttributeDefinitionVisibilityVisibilityReadOnly, nil - case "VISIBILITY_READ_WRITE_VALUES": - return CustomAttributeDefinitionVisibilityVisibilityReadWriteValues, nil - } - var t CustomAttributeDefinitionVisibility - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (c CustomAttributeDefinitionVisibility) Ptr() *CustomAttributeDefinitionVisibility { - return &c + return fmt.Sprintf("%#v", g) } -// Supported custom attribute query expressions for calling the -// [SearchCatalogItems]($e/Catalog/SearchCatalogItems) -// endpoint to search for items or item variations. -type CustomAttributeFilter struct { - // A query expression to filter items or item variations by matching their custom attributes' - // `custom_attribute_definition_id` property value against the the specified id. - // Exactly one of `custom_attribute_definition_id` or `key` must be specified. - CustomAttributeDefinitionID *string `json:"custom_attribute_definition_id,omitempty" url:"custom_attribute_definition_id,omitempty"` - // A query expression to filter items or item variations by matching their custom attributes' - // `key` property value against the specified key. - // Exactly one of `custom_attribute_definition_id` or `key` must be specified. - Key *string `json:"key,omitempty" url:"key,omitempty"` - // A query expression to filter items or item variations by matching their custom attributes' - // `string_value` property value against the specified text. - // Exactly one of `string_filter`, `number_filter`, `selection_uids_filter`, or `bool_filter` must be specified. - StringFilter *string `json:"string_filter,omitempty" url:"string_filter,omitempty"` - // A query expression to filter items or item variations with their custom attributes - // containing a number value within the specified range. - // Exactly one of `string_filter`, `number_filter`, `selection_uids_filter`, or `bool_filter` must be specified. - NumberFilter *Range `json:"number_filter,omitempty" url:"number_filter,omitempty"` - // A query expression to filter items or item variations by matching their custom attributes' - // `selection_uid_values` values against the specified selection uids. - // Exactly one of `string_filter`, `number_filter`, `selection_uids_filter`, or `bool_filter` must be specified. - SelectionUIDsFilter []string `json:"selection_uids_filter,omitempty" url:"selection_uids_filter,omitempty"` - // A query expression to filter items or item variations by matching their custom attributes' - // `boolean_value` property values against the specified Boolean expression. - // Exactly one of `string_filter`, `number_filter`, `selection_uids_filter`, or `bool_filter` must be specified. - BoolFilter *bool `json:"bool_filter,omitempty" url:"bool_filter,omitempty"` - +// A request to retrieve a loyalty reward. +type GetLoyaltyRewardRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CustomAttributeFilter) GetExtraProperties() map[string]interface{} { - return c.extraProperties +func (g *GetLoyaltyRewardRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (c *CustomAttributeFilter) UnmarshalJSON(data []byte) error { - type unmarshaler CustomAttributeFilter +func (g *GetLoyaltyRewardRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetLoyaltyRewardRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CustomAttributeFilter(value) + *g = GetLoyaltyRewardRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *c) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - c.extraProperties = extraProperties + g.extraProperties = extraProperties - c._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (c *CustomAttributeFilter) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { +func (g *GetLoyaltyRewardRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(c); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", c) + return fmt.Sprintf("%#v", g) } -// Describes a custom form field to add to the checkout page to collect more information from buyers during checkout. -// For more information, -// see [Specify checkout options](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations#specify-checkout-options-1). -type CustomField struct { - // The title of the custom field. - Title string `json:"title" url:"title"` +// A response that includes the loyalty reward. +type GetLoyaltyRewardResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The loyalty reward retrieved. + Reward *LoyaltyReward `json:"reward,omitempty" url:"reward,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CustomField) GetExtraProperties() map[string]interface{} { - return c.extraProperties +func (g *GetLoyaltyRewardResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (c *CustomField) UnmarshalJSON(data []byte) error { - type unmarshaler CustomField +func (g *GetLoyaltyRewardResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetLoyaltyRewardResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CustomField(value) + *g = GetLoyaltyRewardResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *c) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - c.extraProperties = extraProperties + g.extraProperties = extraProperties - c._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (c *CustomField) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { +func (g *GetLoyaltyRewardResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(c); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", c) + return fmt.Sprintf("%#v", g) } -// Represents a Square customer profile in the Customer Directory of a Square seller. -type Customer struct { - // A unique Square-assigned ID for the customer profile. - // - // If you need this ID for an API request, use the ID returned when you created the customer profile or call the [SearchCustomers](api-endpoint:Customers-SearchCustomers) - // or [ListCustomers](api-endpoint:Customers-ListCustomers) endpoint. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The timestamp when the customer profile was created, in RFC 3339 format. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The timestamp when the customer profile was last updated, in RFC 3339 format. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` - // Payment details of the credit, debit, and gift cards stored on file for the customer profile. - // - // DEPRECATED at version 2021-06-16 and will be RETIRED at version 2024-12-18. Replaced by calling [ListCards](api-endpoint:Cards-ListCards) (for credit and debit cards on file) - // or [ListGiftCards](api-endpoint:GiftCards-ListGiftCards) (for gift cards on file) and including the `customer_id` query parameter. - // For more information, see [Migration notes](https://developer.squareup.com/docs/customers-api/what-it-does#migrate-customer-cards). - Cards []*Card `json:"cards,omitempty" url:"cards,omitempty"` - // The given name (that is, the first name) associated with the customer profile. - GivenName *string `json:"given_name,omitempty" url:"given_name,omitempty"` - // The family name (that is, the last name) associated with the customer profile. - FamilyName *string `json:"family_name,omitempty" url:"family_name,omitempty"` - // A nickname for the customer profile. - Nickname *string `json:"nickname,omitempty" url:"nickname,omitempty"` - // A business name associated with the customer profile. - CompanyName *string `json:"company_name,omitempty" url:"company_name,omitempty"` - // The email address associated with the customer profile. - EmailAddress *string `json:"email_address,omitempty" url:"email_address,omitempty"` - // The physical address associated with the customer profile. - Address *Address `json:"address,omitempty" url:"address,omitempty"` - // The phone number associated with the customer profile. - PhoneNumber *string `json:"phone_number,omitempty" url:"phone_number,omitempty"` - // The birthday associated with the customer profile, in `YYYY-MM-DD` format. For example, `1998-09-21` - // represents September 21, 1998, and `0000-09-21` represents September 21 (without a birth year). - Birthday *string `json:"birthday,omitempty" url:"birthday,omitempty"` - // An optional second ID used to associate the customer profile with an - // entity in another system. - ReferenceID *string `json:"reference_id,omitempty" url:"reference_id,omitempty"` - // A custom note associated with the customer profile. - Note *string `json:"note,omitempty" url:"note,omitempty"` - // Represents general customer preferences. - Preferences *CustomerPreferences `json:"preferences,omitempty" url:"preferences,omitempty"` - // The method used to create the customer profile. - // See [CustomerCreationSource](#type-customercreationsource) for possible values - CreationSource *CustomerCreationSource `json:"creation_source,omitempty" url:"creation_source,omitempty"` - // The IDs of [customer groups](entity:CustomerGroup) the customer belongs to. - GroupIDs []string `json:"group_ids,omitempty" url:"group_ids,omitempty"` - // The IDs of [customer segments](entity:CustomerSegment) the customer belongs to. - SegmentIDs []string `json:"segment_ids,omitempty" url:"segment_ids,omitempty"` - // The Square-assigned version number of the customer profile. The version number is incremented each time an update is committed to the customer profile, except for changes to customer segment membership and cards on file. - Version *int64 `json:"version,omitempty" url:"version,omitempty"` - // The tax ID associated with the customer profile. This field is present only for customers of sellers in EU countries or the United Kingdom. - // For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids). - TaxIDs *CustomerTaxIDs `json:"tax_ids,omitempty" url:"tax_ids,omitempty"` - +// Request object for the [RetrieveMerchant](api-endpoint:Merchants-RetrieveMerchant) endpoint. +type GetMerchantRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *Customer) GetExtraProperties() map[string]interface{} { - return c.extraProperties +func (g *GetMerchantRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (c *Customer) UnmarshalJSON(data []byte) error { - type unmarshaler Customer +func (g *GetMerchantRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetMerchantRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = Customer(value) + *g = GetMerchantRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *c) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - c.extraProperties = extraProperties + g.extraProperties = extraProperties - c._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (c *Customer) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { +func (g *GetMerchantRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(c); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", c) + return fmt.Sprintf("%#v", g) } -// The customer address filter. This filter is used in a [CustomerCustomAttributeFilterValue]($m/CustomerCustomAttributeFilterValue) filter when -// searching by an `Address`-type custom attribute. -type CustomerAddressFilter struct { - // The postal code to search for. Only an `exact` match is supported. - PostalCode *CustomerTextFilter `json:"postal_code,omitempty" url:"postal_code,omitempty"` - // The country code to search for. - // See [Country](#type-country) for possible values - Country *Country `json:"country,omitempty" url:"country,omitempty"` +// The response object returned by the [RetrieveMerchant](api-endpoint:Merchants-RetrieveMerchant) endpoint. +type GetMerchantResponse struct { + // Information on errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The requested `Merchant` object. + Merchant *Merchant `json:"merchant,omitempty" url:"merchant,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CustomerAddressFilter) GetExtraProperties() map[string]interface{} { - return c.extraProperties +func (g *GetMerchantResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (c *CustomerAddressFilter) UnmarshalJSON(data []byte) error { - type unmarshaler CustomerAddressFilter +func (g *GetMerchantResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetMerchantResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CustomerAddressFilter(value) + *g = GetMerchantResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *c) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - c.extraProperties = extraProperties + g.extraProperties = extraProperties - c._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (c *CustomerAddressFilter) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { +func (g *GetMerchantResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(c); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", c) -} - -// Indicates the method used to create the customer profile. -type CustomerCreationSource string - -const ( - CustomerCreationSourceOther CustomerCreationSource = "OTHER" - CustomerCreationSourceAppointments CustomerCreationSource = "APPOINTMENTS" - CustomerCreationSourceCoupon CustomerCreationSource = "COUPON" - CustomerCreationSourceDeletionRecovery CustomerCreationSource = "DELETION_RECOVERY" - CustomerCreationSourceDirectory CustomerCreationSource = "DIRECTORY" - CustomerCreationSourceEgifting CustomerCreationSource = "EGIFTING" - CustomerCreationSourceEmailCollection CustomerCreationSource = "EMAIL_COLLECTION" - CustomerCreationSourceFeedback CustomerCreationSource = "FEEDBACK" - CustomerCreationSourceImport CustomerCreationSource = "IMPORT" - CustomerCreationSourceInvoices CustomerCreationSource = "INVOICES" - CustomerCreationSourceLoyalty CustomerCreationSource = "LOYALTY" - CustomerCreationSourceMarketing CustomerCreationSource = "MARKETING" - CustomerCreationSourceMerge CustomerCreationSource = "MERGE" - CustomerCreationSourceOnlineStore CustomerCreationSource = "ONLINE_STORE" - CustomerCreationSourceInstantProfile CustomerCreationSource = "INSTANT_PROFILE" - CustomerCreationSourceTerminal CustomerCreationSource = "TERMINAL" - CustomerCreationSourceThirdParty CustomerCreationSource = "THIRD_PARTY" - CustomerCreationSourceThirdPartyImport CustomerCreationSource = "THIRD_PARTY_IMPORT" - CustomerCreationSourceUnmergeRecovery CustomerCreationSource = "UNMERGE_RECOVERY" -) - -func NewCustomerCreationSourceFromString(s string) (CustomerCreationSource, error) { - switch s { - case "OTHER": - return CustomerCreationSourceOther, nil - case "APPOINTMENTS": - return CustomerCreationSourceAppointments, nil - case "COUPON": - return CustomerCreationSourceCoupon, nil - case "DELETION_RECOVERY": - return CustomerCreationSourceDeletionRecovery, nil - case "DIRECTORY": - return CustomerCreationSourceDirectory, nil - case "EGIFTING": - return CustomerCreationSourceEgifting, nil - case "EMAIL_COLLECTION": - return CustomerCreationSourceEmailCollection, nil - case "FEEDBACK": - return CustomerCreationSourceFeedback, nil - case "IMPORT": - return CustomerCreationSourceImport, nil - case "INVOICES": - return CustomerCreationSourceInvoices, nil - case "LOYALTY": - return CustomerCreationSourceLoyalty, nil - case "MARKETING": - return CustomerCreationSourceMarketing, nil - case "MERGE": - return CustomerCreationSourceMerge, nil - case "ONLINE_STORE": - return CustomerCreationSourceOnlineStore, nil - case "INSTANT_PROFILE": - return CustomerCreationSourceInstantProfile, nil - case "TERMINAL": - return CustomerCreationSourceTerminal, nil - case "THIRD_PARTY": - return CustomerCreationSourceThirdParty, nil - case "THIRD_PARTY_IMPORT": - return CustomerCreationSourceThirdPartyImport, nil - case "UNMERGE_RECOVERY": - return CustomerCreationSourceUnmergeRecovery, nil - } - var t CustomerCreationSource - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (c CustomerCreationSource) Ptr() *CustomerCreationSource { - return &c + return fmt.Sprintf("%#v", g) } -// The creation source filter. -// -// If one or more creation sources are set, customer profiles are included in, -// or excluded from, the result if they match at least one of the filter criteria. -type CustomerCreationSourceFilter struct { - // The list of creation sources used as filtering criteria. - // See [CustomerCreationSource](#type-customercreationsource) for possible values - Values []CustomerCreationSource `json:"values,omitempty" url:"values,omitempty"` - // Indicates whether a customer profile matching the filter criteria - // should be included in the result or excluded from the result. - // - // Default: `INCLUDE`. - // See [CustomerInclusionExclusion](#type-customerinclusionexclusion) for possible values - Rule *CustomerInclusionExclusion `json:"rule,omitempty" url:"rule,omitempty"` - +type GetOrderRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CustomerCreationSourceFilter) GetExtraProperties() map[string]interface{} { - return c.extraProperties +func (g *GetOrderRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (c *CustomerCreationSourceFilter) UnmarshalJSON(data []byte) error { - type unmarshaler CustomerCreationSourceFilter +func (g *GetOrderRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetOrderRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CustomerCreationSourceFilter(value) + *g = GetOrderRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *c) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - c.extraProperties = extraProperties + g.extraProperties = extraProperties - c._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (c *CustomerCreationSourceFilter) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { +func (g *GetOrderRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(c); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", c) + return fmt.Sprintf("%#v", g) } -// The custom attribute filter. Use this filter in a set of [custom attribute filters]($m/CustomerCustomAttributeFilters) to search -// based on the value or last updated date of a customer-related [custom attribute]($m/CustomAttribute). -type CustomerCustomAttributeFilter struct { - // The `key` of the [custom attribute](entity:CustomAttribute) to filter by. The key is the identifier of the custom attribute - // (and the corresponding custom attribute definition) and can be retrieved using the [Customer Custom Attributes API](api:CustomerCustomAttributes). - Key string `json:"key" url:"key"` - // A filter that corresponds to the data type of the target custom attribute. For example, provide the `phone` filter to - // search based on the value of a `PhoneNumber`-type custom attribute. The data type is specified by the schema field of the custom attribute definition, - // which can be retrieved using the [Customer Custom Attributes API](api:CustomerCustomAttributes). - // - // You must provide this `filter` field, the `updated_at` field, or both. - Filter *CustomerCustomAttributeFilterValue `json:"filter,omitempty" url:"filter,omitempty"` - // The date range for when the custom attribute was last updated. The date range can include `start_at`, `end_at`, or - // both. Range boundaries are inclusive. Dates are specified as RFC 3339 timestamps. - // - // You must provide this `updated_at` field, the `filter` field, or both. - UpdatedAt *TimeRange `json:"updated_at,omitempty" url:"updated_at,omitempty"` +type GetOrderResponse struct { + // The requested order. + Order *Order `json:"order,omitempty" url:"order,omitempty"` + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CustomerCustomAttributeFilter) GetExtraProperties() map[string]interface{} { - return c.extraProperties +func (g *GetOrderResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (c *CustomerCustomAttributeFilter) UnmarshalJSON(data []byte) error { - type unmarshaler CustomerCustomAttributeFilter +func (g *GetOrderResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetOrderResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CustomerCustomAttributeFilter(value) + *g = GetOrderResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *c) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - c.extraProperties = extraProperties + g.extraProperties = extraProperties - c._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (c *CustomerCustomAttributeFilter) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { +func (g *GetOrderResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(c); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", c) + return fmt.Sprintf("%#v", g) } -// A type-specific filter used in a [custom attribute filter]($m/CustomerCustomAttributeFilter) to search based on the value -// of a customer-related [custom attribute]($m/CustomAttribute). -type CustomerCustomAttributeFilterValue struct { - // A filter for a query based on the value of an `Email`-type custom attribute. This filter is case-insensitive and can - // include `exact` or `fuzzy`, but not both. - // - // For an `exact` match, provide the complete email address. - // - // For a `fuzzy` match, provide a query expression containing one or more query tokens to match against the email address. Square removes - // any punctuation (including periods (.), underscores (\_), and the @ symbol) and tokenizes the email addresses on spaces. A match is found - // if a tokenized email address contains all the tokens in the search query, irrespective of the token order. For example, `Steven gmail` - // matches steven.jones@gmail.com and mygmail@stevensbakery.com. - Email *CustomerTextFilter `json:"email,omitempty" url:"email,omitempty"` - // A filter for a query based on the value of a `PhoneNumber`-type custom attribute. This filter is case-insensitive and - // can include `exact` or `fuzzy`, but not both. - // - // For an `exact` match, provide the complete phone number. This is always an E.164-compliant phone number that starts - // with the + sign followed by the country code and subscriber number. For example, the format for a US phone number is +12061112222. - // - // For a `fuzzy` match, provide a query expression containing one or more query tokens to match against the phone number. - // Square removes any punctuation and tokenizes the expression on spaces. A match is found if a tokenized phone number contains - // all the tokens in the search query, irrespective of the token order. For example, `415 123 45` is tokenized to `415`, `123`, and `45`, - // which matches +14151234567 and +12345674158, but does not match +1234156780. Similarly, the expression `415` matches - // +14151234567, +12345674158, and +1234156780. - Phone *CustomerTextFilter `json:"phone,omitempty" url:"phone,omitempty"` - // A filter for a query based on the value of a `String`-type custom attribute. This filter is case-insensitive and - // can include `exact` or `fuzzy`, but not both. - // - // For an `exact` match, provide the complete string. - // - // For a `fuzzy` match, provide a query expression containing one or more query tokens in any order that contain complete words - // to match against the string. Square tokenizes the expression using a grammar-based tokenizer. For example, the expressions `quick brown`, - // `brown quick`, and `quick fox` match "The quick brown fox jumps over the lazy dog". However, `quick foxes` and `qui` do not match. - Text *CustomerTextFilter `json:"text,omitempty" url:"text,omitempty"` - // A filter for a query based on the display name for a `Selection`-type custom attribute value. This filter is case-sensitive - // and can contain `any`, `all`, or both. The `none` condition is not supported. - // - // Provide the display name of each item that you want to search for. To find the display names for the selection, use the - // [Customer Custom Attributes API](api:CustomerCustomAttributes) to retrieve the corresponding custom attribute definition - // and then check the `schema.items.names` field. For more information, see - // [Search based on selection](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#custom-attribute-value-filter-selection). - // - // Note that when a `Selection`-type custom attribute is assigned to a customer profile, the custom attribute value is a list of one - // or more UUIDs (sourced from the `schema.items.enum` field) that map to the item names. These UUIDs are unique per seller. - Selection *FilterValue `json:"selection,omitempty" url:"selection,omitempty"` - // A filter for a query based on the value of a `Date`-type custom attribute. - // - // Provide a date range for this filter using `start_at`, `end_at`, or both. Range boundaries are inclusive. Dates can be specified - // in `YYYY-MM-DD` format or as RFC 3339 timestamps. - Date *TimeRange `json:"date,omitempty" url:"date,omitempty"` - // A filter for a query based on the value of a `Number`-type custom attribute, which can be an integer or a decimal with up to - // 5 digits of precision. - // - // Provide a numerical range for this filter using `start_at`, `end_at`, or both. Range boundaries are inclusive. Numbers are specified - // as decimals or integers. The absolute value of range boundaries must not exceed `(2^63-1)/10^5`, or 92233720368547. - Number *FloatNumberRange `json:"number,omitempty" url:"number,omitempty"` - // A filter for a query based on the value of a `Boolean`-type custom attribute. - Boolean *bool `json:"boolean,omitempty" url:"boolean,omitempty"` - // A filter for a query based on the value of an `Address`-type custom attribute. The filter can include `postal_code`, `country`, or both. - Address *CustomerAddressFilter `json:"address,omitempty" url:"address,omitempty"` - +type GetPaymentLinkRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CustomerCustomAttributeFilterValue) GetExtraProperties() map[string]interface{} { - return c.extraProperties +func (g *GetPaymentLinkRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (c *CustomerCustomAttributeFilterValue) UnmarshalJSON(data []byte) error { - type unmarshaler CustomerCustomAttributeFilterValue +func (g *GetPaymentLinkRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetPaymentLinkRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CustomerCustomAttributeFilterValue(value) + *g = GetPaymentLinkRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *c) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - c.extraProperties = extraProperties + g.extraProperties = extraProperties - c._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (c *CustomerCustomAttributeFilterValue) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { +func (g *GetPaymentLinkRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(c); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", c) + return fmt.Sprintf("%#v", g) } -// The custom attribute filters in a set of [customer filters]($m/CustomerFilter) used in a search query. Use this filter -// to search based on [custom attributes]($m/CustomAttribute) that are assigned to customer profiles. For more information, see -// [Search by custom attribute](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#search-by-custom-attribute). -type CustomerCustomAttributeFilters struct { - // The custom attribute filters. Each filter must specify `key` and include the `filter` field with a type-specific filter, - // the `updated_at` field, or both. The provided keys must be unique within the list of custom attribute filters. - Filters []*CustomerCustomAttributeFilter `json:"filters,omitempty" url:"filters,omitempty"` +type GetPaymentLinkResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The payment link that is retrieved. + PaymentLink *PaymentLink `json:"payment_link,omitempty" url:"payment_link,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CustomerCustomAttributeFilters) GetExtraProperties() map[string]interface{} { - return c.extraProperties +func (g *GetPaymentLinkResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (c *CustomerCustomAttributeFilters) UnmarshalJSON(data []byte) error { - type unmarshaler CustomerCustomAttributeFilters +func (g *GetPaymentLinkResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetPaymentLinkResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CustomerCustomAttributeFilters(value) + *g = GetPaymentLinkResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *c) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - c.extraProperties = extraProperties + g.extraProperties = extraProperties - c._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (c *CustomerCustomAttributeFilters) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { +func (g *GetPaymentLinkResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(c); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", c) + return fmt.Sprintf("%#v", g) } -// Details about the customer making the payment. -type CustomerDetails struct { - // Indicates whether the customer initiated the payment. - CustomerInitiated *bool `json:"customer_initiated,omitempty" url:"customer_initiated,omitempty"` - // Indicates that the seller keyed in payment details on behalf of the customer. - // This is used to flag a payment as Mail Order / Telephone Order (MOTO). - SellerKeyedIn *bool `json:"seller_keyed_in,omitempty" url:"seller_keyed_in,omitempty"` - +// Describes a request to retrieve a refund using +// [GetPaymentRefund](api-endpoint:Refunds-GetPaymentRefund). +type GetPaymentRefundRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CustomerDetails) GetExtraProperties() map[string]interface{} { - return c.extraProperties +func (g *GetPaymentRefundRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (c *CustomerDetails) UnmarshalJSON(data []byte) error { - type unmarshaler CustomerDetails +func (g *GetPaymentRefundRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetPaymentRefundRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CustomerDetails(value) + *g = GetPaymentRefundRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *c) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - c.extraProperties = extraProperties + g.extraProperties = extraProperties - c._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (c *CustomerDetails) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { +func (g *GetPaymentRefundRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(c); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", c) + return fmt.Sprintf("%#v", g) } -// Represents the filtering criteria in a [search query]($m/CustomerQuery) that defines how to filter -// customer profiles returned in [SearchCustomers]($e/Customers/SearchCustomers) results. -type CustomerFilter struct { - // A filter to select customers based on their creation source. - CreationSource *CustomerCreationSourceFilter `json:"creation_source,omitempty" url:"creation_source,omitempty"` - // A filter to select customers based on when they were created. - CreatedAt *TimeRange `json:"created_at,omitempty" url:"created_at,omitempty"` - // A filter to select customers based on when they were last updated. - UpdatedAt *TimeRange `json:"updated_at,omitempty" url:"updated_at,omitempty"` - // A filter to [select customers by their email address](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#search-by-email-address) - // visible to the seller. - // This filter is case-insensitive. - // - // For [exact matching](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#exact-search-by-email-address), this - // filter causes the search to return customer profiles - // whose `email_address` field value are identical to the email address provided - // in the query. - // - // For [fuzzy matching](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#fuzzy-search-by-email-address), - // this filter causes the search to return customer profiles - // whose `email_address` field value has a token-wise partial match against the filtering - // expression in the query. For example, with `Steven gmail` provided in a search - // query, the search returns customers whose email address is `steven.johnson@gmail.com` - // or `mygmail@stevensbakery.com`. Square removes any punctuation (including periods (.), - // underscores (\_), and the @ symbol) and tokenizes the email addresses on spaces. A match is - // found if a tokenized email address contains all the tokens in the search query, - // irrespective of the token order. - EmailAddress *CustomerTextFilter `json:"email_address,omitempty" url:"email_address,omitempty"` - // A filter to [select customers by their phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#search-by-phone-number) - // visible to the seller. - // - // For [exact matching](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#exact-search-by-phone-number), - // this filter returns customers whose phone number matches the specified query expression. The number in the query must be of an - // E.164-compliant form. In particular, it must include the leading `+` sign followed by a country code and then a subscriber number. - // For example, the standard E.164 form of a US phone number is `+12062223333` and an E.164-compliant variation is `+1 (206) 222-3333`. - // To match the query expression, stored customer phone numbers are converted to the standard E.164 form. - // - // For [fuzzy matching](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#fuzzy-search-by-phone-number), - // this filter returns customers whose phone number matches the token or tokens provided in the query expression. For example, with `415` - // provided in a search query, the search returns customers with the phone numbers `+1-415-212-1200`, `+1-212-415-1234`, and `+1 (551) 234-1567`. - // Similarly, a search query of `415 123` returns customers with the phone numbers `+1-212-415-1234` and `+1 (551) 234-1567` but not - // `+1-212-415-1200`. A match is found if a tokenized phone number contains all the tokens in the search query, irrespective of the token order. - PhoneNumber *CustomerTextFilter `json:"phone_number,omitempty" url:"phone_number,omitempty"` - // A filter to [select customers by their reference IDs](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#search-by-reference-id). - // This filter is case-insensitive. - // - // [Exact matching](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#exact-search-by-reference-id) - // of a customer's reference ID against a query's reference ID is evaluated as an - // exact match between two strings, character by character in the given order. - // - // [Fuzzy matching](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#fuzzy-search-by-reference-id) - // of stored reference IDs against queried reference IDs works - // exactly the same as fuzzy matching on email addresses. Non-alphanumeric characters - // are replaced by spaces to tokenize stored and queried reference IDs. A match is found - // if a tokenized stored reference ID contains all tokens specified in any order in the query. For example, - // a query of `NYC M` matches customer profiles with the `reference_id` value of `NYC_M_35_JOHNSON` - // and `NYC_27_MURRAY`. - ReferenceID *CustomerTextFilter `json:"reference_id,omitempty" url:"reference_id,omitempty"` - // A filter to select customers based on the [groups](entity:CustomerGroup) they belong to. - // Group membership is controlled by sellers and developers. - // - // The `group_ids` filter has the following syntax: - // - // ``` - // "group_ids": { - // "any": ["{group_a_id}", "{group_b_id}", ...], - // "all": ["{group_1_id}", "{group_2_id}", ...], - // "none": ["{group_i_id}", "{group_ii_id}", ...] - // } - // ``` - // - // You can use any combination of the `any`, `all`, and `none` fields in the filter. - // With `any`, the search returns customers in groups `a` or `b` or any other group specified in the list. - // With `all`, the search returns customers in groups `1` and `2` and all other groups specified in the list. - // With `none`, the search returns customers not in groups `i` or `ii` or any other group specified in the list. - // - // If any of the search conditions are not met, including when an invalid or non-existent group ID is provided, - // the result is an empty object (`{}`). - GroupIDs *FilterValue `json:"group_ids,omitempty" url:"group_ids,omitempty"` - // A filter to select customers based on one or more custom attributes. - // This filter can contain up to 10 custom attribute filters. Each custom attribute filter specifies filtering criteria for a target custom - // attribute. If multiple custom attribute filters are provided, they are combined as an `AND` operation. - // - // To be valid for a search, the custom attributes must be visible to the requesting application. For more information, including example queries, - // see [Search by custom attribute](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#search-by-custom-attribute). - // - // Square returns matching customer profiles, which do not contain custom attributes. To retrieve customer-related custom attributes, - // use the [Customer Custom Attributes API](api:CustomerCustomAttributes). For example, you can call - // [RetrieveCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-RetrieveCustomerCustomAttribute) using a customer ID from the result set. - CustomAttribute *CustomerCustomAttributeFilters `json:"custom_attribute,omitempty" url:"custom_attribute,omitempty"` - // A filter to select customers based on the [segments](entity:CustomerSegment) they belong to. - // Segment membership is dynamic and adjusts automatically based on whether customers meet the segment criteria. - // - // You can provide up to three segment IDs in the filter, using any combination of the `all`, `any`, and `none` fields. - // For the following example, the results include customers who belong to both segment A and segment B but do not belong to segment C. - // - // ``` - // "segment_ids": { - // "all": ["{segment_A_id}", "{segment_B_id}"], - // "none": ["{segment_C_id}"] - // } - // ``` - // - // If an invalid or non-existent segment ID is provided in the filter, Square stops processing the request - // and returns a `400 BAD_REQUEST` error that includes the segment ID. - SegmentIDs *FilterValue `json:"segment_ids,omitempty" url:"segment_ids,omitempty"` +// Defines the response returned by [GetRefund](api-endpoint:Refunds-GetPaymentRefund). +// +// Note: If there are errors processing the request, the refund field might not be +// present or it might be present in a FAILED state. +type GetPaymentRefundResponse struct { + // Information about errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The requested `PaymentRefund`. + Refund *PaymentRefund `json:"refund,omitempty" url:"refund,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CustomerFilter) GetExtraProperties() map[string]interface{} { - return c.extraProperties +func (g *GetPaymentRefundResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (c *CustomerFilter) UnmarshalJSON(data []byte) error { - type unmarshaler CustomerFilter +func (g *GetPaymentRefundResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetPaymentRefundResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CustomerFilter(value) + *g = GetPaymentRefundResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *c) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - c.extraProperties = extraProperties + g.extraProperties = extraProperties - c._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (c *CustomerFilter) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { +func (g *GetPaymentRefundResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(c); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", c) + return fmt.Sprintf("%#v", g) } -// Represents a group of customer profiles. -// -// Customer groups can be created, be modified, and have their membership defined using -// the Customers API or within the Customer Directory in the Square Seller Dashboard or Point of Sale. -type CustomerGroup struct { - // A unique Square-generated ID for the customer group. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The name of the customer group. - Name string `json:"name" url:"name"` - // The timestamp when the customer group was created, in RFC 3339 format. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The timestamp when the customer group was last updated, in RFC 3339 format. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` - +// Describes a request to retrieve a payment using +// [GetPayment](api-endpoint:Payments-GetPayment). +type GetPaymentRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CustomerGroup) GetExtraProperties() map[string]interface{} { - return c.extraProperties +func (g *GetPaymentRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (c *CustomerGroup) UnmarshalJSON(data []byte) error { - type unmarshaler CustomerGroup +func (g *GetPaymentRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetPaymentRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CustomerGroup(value) + *g = GetPaymentRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *c) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - c.extraProperties = extraProperties + g.extraProperties = extraProperties - c._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (c *CustomerGroup) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { +func (g *GetPaymentRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(c); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", c) -} - -// Indicates whether customers should be included in, or excluded from, -// the result set when they match the filtering criteria. -type CustomerInclusionExclusion string - -const ( - CustomerInclusionExclusionInclude CustomerInclusionExclusion = "INCLUDE" - CustomerInclusionExclusionExclude CustomerInclusionExclusion = "EXCLUDE" -) - -func NewCustomerInclusionExclusionFromString(s string) (CustomerInclusionExclusion, error) { - switch s { - case "INCLUDE": - return CustomerInclusionExclusionInclude, nil - case "EXCLUDE": - return CustomerInclusionExclusionExclude, nil - } - var t CustomerInclusionExclusion - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (c CustomerInclusionExclusion) Ptr() *CustomerInclusionExclusion { - return &c + return fmt.Sprintf("%#v", g) } -// Represents communication preferences for the customer profile. -type CustomerPreferences struct { - // Indicates whether the customer has unsubscribed from marketing campaign emails. A value of `true` means that the customer chose to opt out of email marketing from the current Square seller or from all Square sellers. This value is read-only from the Customers API. - EmailUnsubscribed *bool `json:"email_unsubscribed,omitempty" url:"email_unsubscribed,omitempty"` +// Defines the response returned by [GetPayment](api-endpoint:Payments-GetPayment). +type GetPaymentResponse struct { + // Information about errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The requested `Payment`. + Payment *Payment `json:"payment,omitempty" url:"payment,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CustomerPreferences) GetExtraProperties() map[string]interface{} { - return c.extraProperties +func (g *GetPaymentResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (c *CustomerPreferences) UnmarshalJSON(data []byte) error { - type unmarshaler CustomerPreferences +func (g *GetPaymentResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetPaymentResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CustomerPreferences(value) + *g = GetPaymentResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *c) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - c.extraProperties = extraProperties + g.extraProperties = extraProperties - c._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (c *CustomerPreferences) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { +func (g *GetPaymentResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(c); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", c) + return fmt.Sprintf("%#v", g) } -// Represents filtering and sorting criteria for a [SearchCustomers]($e/Customers/SearchCustomers) request. -type CustomerQuery struct { - // The filtering criteria for the search query. A query can contain multiple filters in any combination. - // Multiple filters are combined as `AND` statements. - // - // **Note:** Combining multiple filters as `OR` statements is not supported. Instead, send multiple single-filter - // searches and join the result sets. - Filter *CustomerFilter `json:"filter,omitempty" url:"filter,omitempty"` - // Sorting criteria for query results. The default behavior is to sort - // customers alphabetically by `given_name` and `family_name`. - Sort *CustomerSort `json:"sort,omitempty" url:"sort,omitempty"` - +type GetPayoutRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CustomerQuery) GetExtraProperties() map[string]interface{} { - return c.extraProperties +func (g *GetPayoutRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (c *CustomerQuery) UnmarshalJSON(data []byte) error { - type unmarshaler CustomerQuery +func (g *GetPayoutRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetPayoutRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CustomerQuery(value) + *g = GetPayoutRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *c) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - c.extraProperties = extraProperties + g.extraProperties = extraProperties - c._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (c *CustomerQuery) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { +func (g *GetPayoutRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(c); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", c) + return fmt.Sprintf("%#v", g) } -// Represents a group of customer profiles that match one or more predefined filter criteria. -// -// Segments (also known as Smart Groups) are defined and created within the Customer Directory in the -// Square Seller Dashboard or Point of Sale. -type CustomerSegment struct { - // A unique Square-generated ID for the segment. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The name of the segment. - Name string `json:"name" url:"name"` - // The timestamp when the segment was created, in RFC 3339 format. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The timestamp when the segment was last updated, in RFC 3339 format. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` +type GetPayoutResponse struct { + // The requested payout. + Payout *Payout `json:"payout,omitempty" url:"payout,omitempty"` + // Information about errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CustomerSegment) GetExtraProperties() map[string]interface{} { - return c.extraProperties +func (g *GetPayoutResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (c *CustomerSegment) UnmarshalJSON(data []byte) error { - type unmarshaler CustomerSegment +func (g *GetPayoutResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetPayoutResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CustomerSegment(value) + *g = GetPayoutResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *c) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - c.extraProperties = extraProperties + g.extraProperties = extraProperties - c._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (c *CustomerSegment) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { +func (g *GetPayoutResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(c); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", c) + return fmt.Sprintf("%#v", g) } -// Represents the sorting criteria in a [search query]($m/CustomerQuery) that defines how to sort -// customer profiles returned in [SearchCustomers]($e/Customers/SearchCustomers) results. -type CustomerSort struct { - // Indicates the fields to use as the sort key, which is either the default set of fields or `created_at`. - // - // The default value is `DEFAULT`. - // See [CustomerSortField](#type-customersortfield) for possible values - Field *CustomerSortField `json:"field,omitempty" url:"field,omitempty"` - // Indicates the order in which results should be sorted based on the - // sort field value. Strings use standard alphabetic comparison - // to determine order. Strings representing numbers are sorted as strings. - // - // The default value is `ASC`. - // See [SortOrder](#type-sortorder) for possible values - Order *SortOrder `json:"order,omitempty" url:"order,omitempty"` - +// A request to get a `Shift` by ID. +type GetShiftRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CustomerSort) GetExtraProperties() map[string]interface{} { - return c.extraProperties +func (g *GetShiftRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (c *CustomerSort) UnmarshalJSON(data []byte) error { - type unmarshaler CustomerSort +func (g *GetShiftRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetShiftRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CustomerSort(value) + *g = GetShiftRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *c) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - c.extraProperties = extraProperties + g.extraProperties = extraProperties - c._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (c *CustomerSort) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { +func (g *GetShiftRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(c); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", c) -} - -// Specifies customer attributes as the sort key to customer profiles returned from a search. -type CustomerSortField string - -const ( - CustomerSortFieldDefault CustomerSortField = "DEFAULT" - CustomerSortFieldCreatedAt CustomerSortField = "CREATED_AT" -) - -func NewCustomerSortFieldFromString(s string) (CustomerSortField, error) { - switch s { - case "DEFAULT": - return CustomerSortFieldDefault, nil - case "CREATED_AT": - return CustomerSortFieldCreatedAt, nil - } - var t CustomerSortField - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (c CustomerSortField) Ptr() *CustomerSortField { - return &c + return fmt.Sprintf("%#v", g) } -// Represents the tax ID associated with a [customer profile]($m/Customer). The corresponding `tax_ids` field is available only for customers of sellers in EU countries or the United Kingdom. -// For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids). -type CustomerTaxIDs struct { - // The EU VAT identification number for the customer. For example, `IE3426675K`. The ID can contain alphanumeric characters only. - EuVat *string `json:"eu_vat,omitempty" url:"eu_vat,omitempty"` +// A response to a request to get a `Shift`. The response contains +// the requested `Shift` object and might contain a set of `Error` objects if +// the request resulted in errors. +type GetShiftResponse struct { + // The requested `Shift`. + Shift *Shift `json:"shift,omitempty" url:"shift,omitempty"` + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CustomerTaxIDs) GetExtraProperties() map[string]interface{} { - return c.extraProperties +func (g *GetShiftResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (c *CustomerTaxIDs) UnmarshalJSON(data []byte) error { - type unmarshaler CustomerTaxIDs +func (g *GetShiftResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetShiftResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CustomerTaxIDs(value) + *g = GetShiftResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *c) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - c.extraProperties = extraProperties + g.extraProperties = extraProperties - c._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (c *CustomerTaxIDs) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { +func (g *GetShiftResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(c); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", c) -} - -// A filter to select customers based on exact or fuzzy matching of -// customer attributes against a specified query. Depending on the customer attributes, -// the filter can be case-sensitive. This filter can be exact or fuzzy, but it cannot be both. -type CustomerTextFilter struct { - // Use the exact filter to select customers whose attributes match exactly the specified query. - Exact *string `json:"exact,omitempty" url:"exact,omitempty"` - // Use the fuzzy filter to select customers whose attributes match the specified query - // in a fuzzy manner. When the fuzzy option is used, search queries are tokenized, and then - // each query token must be matched somewhere in the searched attribute. For single token queries, - // this is effectively the same behavior as a partial match operation. - Fuzzy *string `json:"fuzzy,omitempty" url:"fuzzy,omitempty"` + return fmt.Sprintf("%#v", g) +} +// Represents a `RetrieveSnippet` request. +type GetSnippetRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (c *CustomerTextFilter) GetExtraProperties() map[string]interface{} { - return c.extraProperties +func (g *GetSnippetRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (c *CustomerTextFilter) UnmarshalJSON(data []byte) error { - type unmarshaler CustomerTextFilter +func (g *GetSnippetRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetSnippetRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = CustomerTextFilter(value) + *g = GetSnippetRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *c) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - c.extraProperties = extraProperties + g.extraProperties = extraProperties - c._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (c *CustomerTextFilter) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { +func (g *GetSnippetRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(c); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", c) + return fmt.Sprintf("%#v", g) } -type DataCollectionOptions struct { - // The title text to display in the data collection flow on the Terminal. - Title string `json:"title" url:"title"` - // The body text to display under the title in the data collection screen flow on the - // Terminal. - Body string `json:"body" url:"body"` - // Represents the type of the input text. - // See [InputType](#type-inputtype) for possible values - InputType DataCollectionOptionsInputType `json:"input_type" url:"input_type"` - // The buyer’s input text from the data collection screen. - CollectedData *CollectedData `json:"collected_data,omitempty" url:"collected_data,omitempty"` +// Represents a `RetrieveSnippet` response. The response can include either `snippet` or `errors`. +type GetSnippetResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The retrieved snippet. + Snippet *Snippet `json:"snippet,omitempty" url:"snippet,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DataCollectionOptions) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GetSnippetResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DataCollectionOptions) UnmarshalJSON(data []byte) error { - type unmarshaler DataCollectionOptions +func (g *GetSnippetResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetSnippetResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DataCollectionOptions(value) + *g = GetSnippetResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DataCollectionOptions) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GetSnippetResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) -} - -// Describes the input type of the data. -type DataCollectionOptionsInputType string - -const ( - DataCollectionOptionsInputTypeEmail DataCollectionOptionsInputType = "EMAIL" - DataCollectionOptionsInputTypePhoneNumber DataCollectionOptionsInputType = "PHONE_NUMBER" -) - -func NewDataCollectionOptionsInputTypeFromString(s string) (DataCollectionOptionsInputType, error) { - switch s { - case "EMAIL": - return DataCollectionOptionsInputTypeEmail, nil - case "PHONE_NUMBER": - return DataCollectionOptionsInputTypePhoneNumber, nil - } - var t DataCollectionOptionsInputType - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (d DataCollectionOptionsInputType) Ptr() *DataCollectionOptionsInputType { - return &d + return fmt.Sprintf("%#v", g) } -// A range defined by two dates. Used for filtering a query for Connect v2 -// objects that have date properties. -type DateRange struct { - // A string in `YYYY-MM-DD` format, such as `2017-10-31`, per the ISO 8601 - // extended format for calendar dates. - // The beginning of a date range (inclusive). - StartDate *string `json:"start_date,omitempty" url:"start_date,omitempty"` - // A string in `YYYY-MM-DD` format, such as `2017-10-31`, per the ISO 8601 - // extended format for calendar dates. - // The end of a date range (inclusive). - EndDate *string `json:"end_date,omitempty" url:"end_date,omitempty"` +// Defines output parameters in a response from the +// [RetrieveSubscription](api-endpoint:Subscriptions-RetrieveSubscription) endpoint. +type GetSubscriptionResponse struct { + // Errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The subscription retrieved. + Subscription *Subscription `json:"subscription,omitempty" url:"subscription,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DateRange) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GetSubscriptionResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DateRange) UnmarshalJSON(data []byte) error { - type unmarshaler DateRange +func (g *GetSubscriptionResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetSubscriptionResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DateRange(value) + *g = GetSubscriptionResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DateRange) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GetSubscriptionResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) -} - -// Indicates the specific day of the week. -type DayOfWeek string - -const ( - DayOfWeekSun DayOfWeek = "SUN" - DayOfWeekMon DayOfWeek = "MON" - DayOfWeekTue DayOfWeek = "TUE" - DayOfWeekWed DayOfWeek = "WED" - DayOfWeekThu DayOfWeek = "THU" - DayOfWeekFri DayOfWeek = "FRI" - DayOfWeekSat DayOfWeek = "SAT" -) - -func NewDayOfWeekFromString(s string) (DayOfWeek, error) { - switch s { - case "SUN": - return DayOfWeekSun, nil - case "MON": - return DayOfWeekMon, nil - case "TUE": - return DayOfWeekTue, nil - case "WED": - return DayOfWeekWed, nil - case "THU": - return DayOfWeekThu, nil - case "FRI": - return DayOfWeekFri, nil - case "SAT": - return DayOfWeekSat, nil - } - var t DayOfWeek - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (d DayOfWeek) Ptr() *DayOfWeek { - return &d + return fmt.Sprintf("%#v", g) } -// Represents a [DeleteBookingCustomAttributeDefinition]($e/BookingCustomAttributes/DeleteBookingCustomAttributeDefinition) request. -type DeleteBookingCustomAttributeDefinitionRequest struct { +type GetTeamMemberBookingProfileRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteBookingCustomAttributeDefinitionRequest) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GetTeamMemberBookingProfileRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteBookingCustomAttributeDefinitionRequest) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteBookingCustomAttributeDefinitionRequest +func (g *GetTeamMemberBookingProfileRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetTeamMemberBookingProfileRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteBookingCustomAttributeDefinitionRequest(value) + *g = GetTeamMemberBookingProfileRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteBookingCustomAttributeDefinitionRequest) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GetTeamMemberBookingProfileRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Represents a [DeleteBookingCustomAttributeDefinition]($e/BookingCustomAttributes/DeleteBookingCustomAttributeDefinition) response -// containing error messages when errors occurred during the request. The successful response does not contain any payload. -type DeleteBookingCustomAttributeDefinitionResponse struct { - // Any errors that occurred during the request. +type GetTeamMemberBookingProfileResponse struct { + // The returned team member booking profile. + TeamMemberBookingProfile *TeamMemberBookingProfile `json:"team_member_booking_profile,omitempty" url:"team_member_booking_profile,omitempty"` + // Errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteBookingCustomAttributeDefinitionResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GetTeamMemberBookingProfileResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteBookingCustomAttributeDefinitionResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteBookingCustomAttributeDefinitionResponse +func (g *GetTeamMemberBookingProfileResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetTeamMemberBookingProfileResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteBookingCustomAttributeDefinitionResponse(value) + *g = GetTeamMemberBookingProfileResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteBookingCustomAttributeDefinitionResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GetTeamMemberBookingProfileResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Represents a [DeleteBookingCustomAttribute]($e/BookingCustomAttributes/DeleteBookingCustomAttribute) request. -type DeleteBookingCustomAttributeRequest struct { +// Represents a retrieve request for a `TeamMember` object. +type GetTeamMemberRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteBookingCustomAttributeRequest) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GetTeamMemberRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteBookingCustomAttributeRequest) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteBookingCustomAttributeRequest +func (g *GetTeamMemberRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetTeamMemberRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteBookingCustomAttributeRequest(value) + *g = GetTeamMemberRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteBookingCustomAttributeRequest) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GetTeamMemberRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Represents a [DeleteBookingCustomAttribute]($e/BookingCustomAttributes/DeleteBookingCustomAttribute) response. -// Either an empty object `{}` (for a successful deletion) or `errors` is present in the response. -type DeleteBookingCustomAttributeResponse struct { - // Any errors that occurred during the request. +// Represents a response from a retrieve request containing a `TeamMember` object or error messages. +type GetTeamMemberResponse struct { + // The successfully retrieved `TeamMember` object. + TeamMember *TeamMember `json:"team_member,omitempty" url:"team_member,omitempty"` + // The errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteBookingCustomAttributeResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GetTeamMemberResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteBookingCustomAttributeResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteBookingCustomAttributeResponse +func (g *GetTeamMemberResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetTeamMemberResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteBookingCustomAttributeResponse(value) + *g = GetTeamMemberResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteBookingCustomAttributeResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GetTeamMemberResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// A request to delete a `BreakType`. -type DeleteBreakTypeRequest struct { +// A request to get a `TeamMemberWage`. +type GetTeamMemberWageRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteBreakTypeRequest) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GetTeamMemberWageRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteBreakTypeRequest) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteBreakTypeRequest +func (g *GetTeamMemberWageRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetTeamMemberWageRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteBreakTypeRequest(value) + *g = GetTeamMemberWageRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteBreakTypeRequest) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GetTeamMemberWageRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// The response to a request to delete a `BreakType`. The response might contain a set -// of `Error` objects if the request resulted in errors. -type DeleteBreakTypeResponse struct { +// A response to a request to get a `TeamMemberWage`. The response contains +// the requested `TeamMemberWage` objects and might contain a set of `Error` objects if +// the request resulted in errors. +type GetTeamMemberWageResponse struct { + // The requested `TeamMemberWage` object. + TeamMemberWage *TeamMemberWage `json:"team_member_wage,omitempty" url:"team_member_wage,omitempty"` // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` @@ -19012,8527 +34308,9244 @@ type DeleteBreakTypeResponse struct { _rawJSON json.RawMessage } -func (d *DeleteBreakTypeResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GetTeamMemberWageResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteBreakTypeResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteBreakTypeResponse +func (g *GetTeamMemberWageResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetTeamMemberWageResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteBreakTypeResponse(value) + *g = GetTeamMemberWageResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteBreakTypeResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GetTeamMemberWageResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -type DeleteCatalogObjectRequest struct { +type GetTerminalActionRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteCatalogObjectRequest) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GetTerminalActionRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteCatalogObjectRequest) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteCatalogObjectRequest +func (g *GetTerminalActionRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetTerminalActionRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteCatalogObjectRequest(value) + *g = GetTerminalActionRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteCatalogObjectRequest) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GetTerminalActionRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -type DeleteCatalogObjectResponse struct { - // Any errors that occurred during the request. +type GetTerminalActionResponse struct { + // Information on errors encountered during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The IDs of all catalog objects deleted by this request. - // Multiple IDs may be returned when associated objects are also deleted, for example - // a catalog item variation will be deleted (and its ID included in this field) - // when its parent catalog item is deleted. - DeletedObjectIDs []string `json:"deleted_object_ids,omitempty" url:"deleted_object_ids,omitempty"` - // The database [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // of this deletion in RFC 3339 format, e.g., `2016-09-04T23:59:33.123Z`. - DeletedAt *string `json:"deleted_at,omitempty" url:"deleted_at,omitempty"` + // The requested `TerminalAction` + Action *TerminalAction `json:"action,omitempty" url:"action,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteCatalogObjectResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GetTerminalActionResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteCatalogObjectResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteCatalogObjectResponse +func (g *GetTerminalActionResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetTerminalActionResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteCatalogObjectResponse(value) + *g = GetTerminalActionResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteCatalogObjectResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GetTerminalActionResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Defines the fields that are included in requests to the -// `DeleteCustomerCard` endpoint. -type DeleteCustomerCardRequest struct { +type GetTerminalCheckoutRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteCustomerCardRequest) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GetTerminalCheckoutRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteCustomerCardRequest) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteCustomerCardRequest +func (g *GetTerminalCheckoutRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetTerminalCheckoutRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteCustomerCardRequest(value) + *g = GetTerminalCheckoutRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteCustomerCardRequest) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GetTerminalCheckoutRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Defines the fields that are included in the response body of -// a request to the `DeleteCustomerCard` endpoint. -type DeleteCustomerCardResponse struct { - // Any errors that occurred during the request. +type GetTerminalCheckoutResponse struct { + // Information about errors encountered during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The requested `TerminalCheckout`. + Checkout *TerminalCheckout `json:"checkout,omitempty" url:"checkout,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteCustomerCardResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GetTerminalCheckoutResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteCustomerCardResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteCustomerCardResponse +func (g *GetTerminalCheckoutResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetTerminalCheckoutResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteCustomerCardResponse(value) + *g = GetTerminalCheckoutResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteCustomerCardResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GetTerminalCheckoutResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Represents a [DeleteCustomerCustomAttributeDefinition]($e/CustomerCustomAttributes/DeleteCustomerCustomAttributeDefinition) request. -type DeleteCustomerCustomAttributeDefinitionRequest struct { +type GetTerminalRefundRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteCustomerCustomAttributeDefinitionRequest) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GetTerminalRefundRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteCustomerCustomAttributeDefinitionRequest) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteCustomerCustomAttributeDefinitionRequest +func (g *GetTerminalRefundRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetTerminalRefundRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteCustomerCustomAttributeDefinitionRequest(value) + *g = GetTerminalRefundRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteCustomerCustomAttributeDefinitionRequest) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GetTerminalRefundRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Represents a response from a delete request containing error messages if there are any. -type DeleteCustomerCustomAttributeDefinitionResponse struct { - // Any errors that occurred during the request. +type GetTerminalRefundResponse struct { + // Information about errors encountered during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The requested `Refund`. + Refund *TerminalRefund `json:"refund,omitempty" url:"refund,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteCustomerCustomAttributeDefinitionResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GetTerminalRefundResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteCustomerCustomAttributeDefinitionResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteCustomerCustomAttributeDefinitionResponse +func (g *GetTerminalRefundResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetTerminalRefundResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteCustomerCustomAttributeDefinitionResponse(value) + *g = GetTerminalRefundResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteCustomerCustomAttributeDefinitionResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GetTerminalRefundResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Represents a [DeleteCustomerCustomAttribute]($e/CustomerCustomAttributes/DeleteCustomerCustomAttribute) request. -type DeleteCustomerCustomAttributeRequest struct { +type GetTransactionRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteCustomerCustomAttributeRequest) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GetTransactionRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteCustomerCustomAttributeRequest) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteCustomerCustomAttributeRequest +func (g *GetTransactionRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetTransactionRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteCustomerCustomAttributeRequest(value) + *g = GetTransactionRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteCustomerCustomAttributeRequest) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GetTransactionRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Represents a [DeleteCustomerCustomAttribute]($e/CustomerCustomAttributes/DeleteCustomerCustomAttribute) response. -// Either an empty object `{}` (for a successful deletion) or `errors` is present in the response. -type DeleteCustomerCustomAttributeResponse struct { +// Defines the fields that are included in the response body of +// a request to the [RetrieveTransaction](api-endpoint:Transactions-RetrieveTransaction) endpoint. +// +// One of `errors` or `transaction` is present in a given response (never both). +type GetTransactionResponse struct { // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The requested transaction. + Transaction *Transaction `json:"transaction,omitempty" url:"transaction,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteCustomerCustomAttributeResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GetTransactionResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteCustomerCustomAttributeResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteCustomerCustomAttributeResponse +func (g *GetTransactionResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetTransactionResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteCustomerCustomAttributeResponse(value) + *g = GetTransactionResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteCustomerCustomAttributeResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GetTransactionResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Defines the fields that can be included in a request to the -// [DeleteCustomerGroup]($e/CustomerGroups/DeleteCustomerGroup) endpoint. -type DeleteCustomerGroupRequest struct { +// Represents an input to a call to [RetrieveVendor](api-endpoint:Vendors-RetrieveVendor). +type GetVendorRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteCustomerGroupRequest) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GetVendorRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteCustomerGroupRequest) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteCustomerGroupRequest +func (g *GetVendorRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetVendorRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteCustomerGroupRequest(value) + *g = GetVendorRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteCustomerGroupRequest) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GetVendorRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Defines the fields that are included in the response body of -// a request to the [DeleteCustomerGroup]($e/CustomerGroups/DeleteCustomerGroup) endpoint. -type DeleteCustomerGroupResponse struct { - // Any errors that occurred during the request. +// Represents an output from a call to [RetrieveVendor](api-endpoint:Vendors-RetrieveVendor). +type GetVendorResponse struct { + // Errors encountered when the request fails. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The successfully retrieved [Vendor](entity:Vendor) object. + Vendor *Vendor `json:"vendor,omitempty" url:"vendor,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteCustomerGroupResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GetVendorResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteCustomerGroupResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteCustomerGroupResponse +func (g *GetVendorResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetVendorResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteCustomerGroupResponse(value) + *g = GetVendorResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteCustomerGroupResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GetVendorResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Defines the fields that are included in a request to the `DeleteCustomer` -// endpoint. -type DeleteCustomerRequest struct { - // The current version of the customer profile. - // - // As a best practice, you should include this parameter to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control. For more information, see [Delete a customer profile](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#delete-customer-profile). - Version *int64 `json:"version,omitempty" url:"version,omitempty"` - +// Represents a retrieve request for the wage setting of a team member. +type GetWageSettingRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteCustomerRequest) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GetWageSettingRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteCustomerRequest) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteCustomerRequest +func (g *GetWageSettingRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetWageSettingRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteCustomerRequest(value) + *g = GetWageSettingRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteCustomerRequest) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GetWageSettingRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Defines the fields that are included in the response body of -// a request to the `DeleteCustomer` endpoint. -type DeleteCustomerResponse struct { - // Any errors that occurred during the request. +// Represents a response from a retrieve request containing the specified `WageSetting` object or error messages. +type GetWageSettingResponse struct { + // The successfully retrieved `WageSetting` object. + WageSetting *WageSetting `json:"wage_setting,omitempty" url:"wage_setting,omitempty"` + // The errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteCustomerResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GetWageSettingResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteCustomerResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteCustomerResponse +func (g *GetWageSettingResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetWageSettingResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteCustomerResponse(value) + *g = GetWageSettingResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteCustomerResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GetWageSettingResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Defines the parameters for a `DeleteDisputeEvidence` request. -type DeleteDisputeEvidenceRequest struct { +// Retrieves a [Subscription](entity:WebhookSubscription) using its id. +type GetWebhookSubscriptionRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteDisputeEvidenceRequest) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GetWebhookSubscriptionRequest) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteDisputeEvidenceRequest) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteDisputeEvidenceRequest +func (g *GetWebhookSubscriptionRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetWebhookSubscriptionRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteDisputeEvidenceRequest(value) + *g = GetWebhookSubscriptionRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteDisputeEvidenceRequest) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GetWebhookSubscriptionRequest) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Defines the fields in a `DeleteDisputeEvidence` response. -type DeleteDisputeEvidenceResponse struct { - // Information about errors encountered during the request. +// Defines the fields that are included in the response body of +// a request to the [RetrieveWebhookSubscription](api-endpoint:WebhookSubscriptions-RetrieveWebhookSubscription) endpoint. +// +// Note: if there are errors processing the request, the [Subscription](entity:WebhookSubscription) will not be +// present. +type GetWebhookSubscriptionResponse struct { + // Information on errors encountered during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The requested [Subscription](entity:WebhookSubscription). + Subscription *WebhookSubscription `json:"subscription,omitempty" url:"subscription,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteDisputeEvidenceResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GetWebhookSubscriptionResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteDisputeEvidenceResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteDisputeEvidenceResponse +func (g *GetWebhookSubscriptionResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetWebhookSubscriptionResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteDisputeEvidenceResponse(value) + *g = GetWebhookSubscriptionResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteDisputeEvidenceResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GetWebhookSubscriptionResponse) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Represents a [DeleteInvoiceAttachment]($e/Invoices/DeleteInvoiceAttachment) request. -type DeleteInvoiceAttachmentRequest struct { +// Represents a Square gift card. +type GiftCard struct { + // The Square-assigned ID of the gift card. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The gift card type. + // See [Type](#type-type) for possible values + Type GiftCardType `json:"type" url:"type"` + // The source that generated the gift card account number (GAN). The default value is `SQUARE`. + // See [GANSource](#type-gansource) for possible values + GanSource *GiftCardGanSource `json:"gan_source,omitempty" url:"gan_source,omitempty"` + // The current gift card state. + // See [Status](#type-status) for possible values + State *GiftCardStatus `json:"state,omitempty" url:"state,omitempty"` + // The current gift card balance. This balance is always greater than or equal to zero. + BalanceMoney *Money `json:"balance_money,omitempty" url:"balance_money,omitempty"` + // The gift card account number (GAN). Buyers can use the GAN to make purchases or check + // the gift card balance. + Gan *string `json:"gan,omitempty" url:"gan,omitempty"` + // The timestamp when the gift card was created, in RFC 3339 format. + // In the case of a digital gift card, it is the time when you create a card + // (using the Square Point of Sale application, Seller Dashboard, or Gift Cards API). + // In the case of a plastic gift card, it is the time when Square associates the card with the + // seller at the time of activation. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The IDs of the [customer profiles](entity:Customer) to whom this gift card is linked. + CustomerIDs []string `json:"customer_ids,omitempty" url:"customer_ids,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteInvoiceAttachmentRequest) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCard) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteInvoiceAttachmentRequest) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteInvoiceAttachmentRequest +func (g *GiftCard) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCard var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteInvoiceAttachmentRequest(value) + *g = GiftCard(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteInvoiceAttachmentRequest) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCard) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Represents a [DeleteInvoiceAttachment]($e/Invoices/DeleteInvoiceAttachment) response. -type DeleteInvoiceAttachmentResponse struct { - // Information about errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Represents an action performed on a [gift card](entity:GiftCard) that affects its state or balance. +// A gift card activity contains information about a specific activity type. For example, a `REDEEM` activity +// includes a `redeem_activity_details` field that contains information about the redemption. +type GiftCardActivity struct { + // The Square-assigned ID of the gift card activity. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The type of gift card activity. + // See [Type](#type-type) for possible values + Type GiftCardActivityType `json:"type" url:"type"` + // The ID of the [business location](entity:Location) where the activity occurred. + LocationID string `json:"location_id" url:"location_id"` + // The timestamp when the gift card activity was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The gift card ID. When creating a gift card activity, `gift_card_id` is not required if + // `gift_card_gan` is specified. + GiftCardID *string `json:"gift_card_id,omitempty" url:"gift_card_id,omitempty"` + // The gift card account number (GAN). When creating a gift card activity, `gift_card_gan` + // is not required if `gift_card_id` is specified. + GiftCardGan *string `json:"gift_card_gan,omitempty" url:"gift_card_gan,omitempty"` + // The final balance on the gift card after the action is completed. + GiftCardBalanceMoney *Money `json:"gift_card_balance_money,omitempty" url:"gift_card_balance_money,omitempty"` + // Additional details about a `LOAD` activity, which is used to reload money onto a gift card. + LoadActivityDetails *GiftCardActivityLoad `json:"load_activity_details,omitempty" url:"load_activity_details,omitempty"` + // Additional details about an `ACTIVATE` activity, which is used to activate a gift card with + // an initial balance. + ActivateActivityDetails *GiftCardActivityActivate `json:"activate_activity_details,omitempty" url:"activate_activity_details,omitempty"` + // Additional details about a `REDEEM` activity, which is used to redeem a gift card for a purchase. + // + // For applications that process payments using the Square Payments API, Square creates a `REDEEM` activity that + // updates the gift card balance after the corresponding [CreatePayment](api-endpoint:Payments-CreatePayment) + // request is completed. Applications that use a custom payment processing system must call + // [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) to create the `REDEEM` activity. + RedeemActivityDetails *GiftCardActivityRedeem `json:"redeem_activity_details,omitempty" url:"redeem_activity_details,omitempty"` + // Additional details about a `CLEAR_BALANCE` activity, which is used to set the balance of a gift card to zero. + ClearBalanceActivityDetails *GiftCardActivityClearBalance `json:"clear_balance_activity_details,omitempty" url:"clear_balance_activity_details,omitempty"` + // Additional details about a `DEACTIVATE` activity, which is used to deactivate a gift card. + DeactivateActivityDetails *GiftCardActivityDeactivate `json:"deactivate_activity_details,omitempty" url:"deactivate_activity_details,omitempty"` + // Additional details about an `ADJUST_INCREMENT` activity, which is used to add money to a gift card + // outside of a typical `ACTIVATE`, `LOAD`, or `REFUND` activity flow. + AdjustIncrementActivityDetails *GiftCardActivityAdjustIncrement `json:"adjust_increment_activity_details,omitempty" url:"adjust_increment_activity_details,omitempty"` + // Additional details about an `ADJUST_DECREMENT` activity, which is used to deduct money from a gift + // card outside of a typical `REDEEM` activity flow. + AdjustDecrementActivityDetails *GiftCardActivityAdjustDecrement `json:"adjust_decrement_activity_details,omitempty" url:"adjust_decrement_activity_details,omitempty"` + // Additional details about a `REFUND` activity, which is used to add money to a gift card when + // refunding a payment. + // + // For applications that refund payments to a gift card using the Square Refunds API, Square automatically + // creates a `REFUND` activity that updates the gift card balance after a [RefundPayment](api-endpoint:Refunds-RefundPayment) + // request is completed. Applications that use a custom processing system must call + // [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) to create the `REFUND` activity. + RefundActivityDetails *GiftCardActivityRefund `json:"refund_activity_details,omitempty" url:"refund_activity_details,omitempty"` + // Additional details about an `UNLINKED_ACTIVITY_REFUND` activity. This activity is used to add money + // to a gift card when refunding a payment that was processed using a custom payment processing system + // and not linked to the gift card. + UnlinkedActivityRefundActivityDetails *GiftCardActivityUnlinkedActivityRefund `json:"unlinked_activity_refund_activity_details,omitempty" url:"unlinked_activity_refund_activity_details,omitempty"` + // Additional details about an `IMPORT` activity, which Square uses to import a third-party + // gift card with a balance. + ImportActivityDetails *GiftCardActivityImport `json:"import_activity_details,omitempty" url:"import_activity_details,omitempty"` + // Additional details about a `BLOCK` activity, which Square uses to temporarily block a gift card. + BlockActivityDetails *GiftCardActivityBlock `json:"block_activity_details,omitempty" url:"block_activity_details,omitempty"` + // Additional details about an `UNBLOCK` activity, which Square uses to unblock a gift card. + UnblockActivityDetails *GiftCardActivityUnblock `json:"unblock_activity_details,omitempty" url:"unblock_activity_details,omitempty"` + // Additional details about an `IMPORT_REVERSAL` activity, which Square uses to reverse the + // import of a third-party gift card. + ImportReversalActivityDetails *GiftCardActivityImportReversal `json:"import_reversal_activity_details,omitempty" url:"import_reversal_activity_details,omitempty"` + // Additional details about a `TRANSFER_BALANCE_TO` activity, which Square uses to add money to + // a gift card as the result of a transfer from another gift card. + TransferBalanceToActivityDetails *GiftCardActivityTransferBalanceTo `json:"transfer_balance_to_activity_details,omitempty" url:"transfer_balance_to_activity_details,omitempty"` + // Additional details about a `TRANSFER_BALANCE_FROM` activity, which Square uses to deduct money from + // a gift as the result of a transfer to another gift card. + TransferBalanceFromActivityDetails *GiftCardActivityTransferBalanceFrom `json:"transfer_balance_from_activity_details,omitempty" url:"transfer_balance_from_activity_details,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteInvoiceAttachmentResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardActivity) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteInvoiceAttachmentResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteInvoiceAttachmentResponse +func (g *GiftCardActivity) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardActivity var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteInvoiceAttachmentResponse(value) + *g = GiftCardActivity(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteInvoiceAttachmentResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardActivity) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Describes a `DeleteInvoice` request. -type DeleteInvoiceRequest struct { - // The version of the [invoice](entity:Invoice) to delete. - // If you do not know the version, you can call [GetInvoice](api-endpoint:Invoices-GetInvoice) or - // [ListInvoices](api-endpoint:Invoices-ListInvoices). - Version *int `json:"version,omitempty" url:"version,omitempty"` +// Represents details about an `ACTIVATE` [gift card activity type](entity:GiftCardActivityType). +type GiftCardActivityActivate struct { + // The amount added to the gift card. This value is a positive integer. + // + // Applications that use a custom order processing system must specify this amount in the + // [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. + AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` + // The ID of the [order](entity:Order) that contains the `GIFT_CARD` line item. + // + // Applications that use the Square Orders API to process orders must specify the order ID + // [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. + OrderID *string `json:"order_id,omitempty" url:"order_id,omitempty"` + // The UID of the `GIFT_CARD` line item in the order that represents the gift card purchase. + // + // Applications that use the Square Orders API to process orders must specify the line item UID + // in the [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. + LineItemUID *string `json:"line_item_uid,omitempty" url:"line_item_uid,omitempty"` + // A client-specified ID that associates the gift card activity with an entity in another system. + // + // Applications that use a custom order processing system can use this field to track information + // related to an order or payment. + ReferenceID *string `json:"reference_id,omitempty" url:"reference_id,omitempty"` + // The payment instrument IDs used to process the gift card purchase, such as a credit card ID + // or bank account ID. + // + // Applications that use a custom order processing system must specify payment instrument IDs in + // the [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. + // Square uses this information to perform compliance checks. + // + // For applications that use the Square Orders API to process payments, Square has the necessary + // instrument IDs to perform compliance checks. + // + // Each buyer payment instrument ID can contain a maximum of 255 characters. + BuyerPaymentInstrumentIDs []string `json:"buyer_payment_instrument_ids,omitempty" url:"buyer_payment_instrument_ids,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteInvoiceRequest) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardActivityActivate) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteInvoiceRequest) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteInvoiceRequest +func (g *GiftCardActivityActivate) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardActivityActivate var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteInvoiceRequest(value) + *g = GiftCardActivityActivate(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteInvoiceRequest) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardActivityActivate) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Describes a `DeleteInvoice` response. -type DeleteInvoiceResponse struct { - // Information about errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Represents details about an `ADJUST_DECREMENT` [gift card activity type](entity:GiftCardActivityType). +type GiftCardActivityAdjustDecrement struct { + // The amount deducted from the gift card balance. This value is a positive integer. + AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` + // The reason the gift card balance was adjusted. + // See [Reason](#type-reason) for possible values + Reason GiftCardActivityAdjustDecrementReason `json:"reason" url:"reason"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteInvoiceResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardActivityAdjustDecrement) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteInvoiceResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteInvoiceResponse +func (g *GiftCardActivityAdjustDecrement) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardActivityAdjustDecrement var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteInvoiceResponse(value) + *g = GiftCardActivityAdjustDecrement(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteInvoiceResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardActivityAdjustDecrement) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Represents a [DeleteLocationCustomAttributeDefinition]($e/LocationCustomAttributes/DeleteLocationCustomAttributeDefinition) request. -type DeleteLocationCustomAttributeDefinitionRequest struct { +// Indicates the reason for deducting money from a [gift card](entity:GiftCard). +type GiftCardActivityAdjustDecrementReason string + +const ( + GiftCardActivityAdjustDecrementReasonReasonDoNotUse GiftCardActivityAdjustDecrementReason = "REASON_DO_NOT_USE" + GiftCardActivityAdjustDecrementReasonSuspiciousActivity GiftCardActivityAdjustDecrementReason = "SUSPICIOUS_ACTIVITY" + GiftCardActivityAdjustDecrementReasonBalanceAccidentallyIncreased GiftCardActivityAdjustDecrementReason = "BALANCE_ACCIDENTALLY_INCREASED" + GiftCardActivityAdjustDecrementReasonSupportIssue GiftCardActivityAdjustDecrementReason = "SUPPORT_ISSUE" + GiftCardActivityAdjustDecrementReasonPurchaseWasRefunded GiftCardActivityAdjustDecrementReason = "PURCHASE_WAS_REFUNDED" +) + +func NewGiftCardActivityAdjustDecrementReasonFromString(s string) (GiftCardActivityAdjustDecrementReason, error) { + switch s { + case "REASON_DO_NOT_USE": + return GiftCardActivityAdjustDecrementReasonReasonDoNotUse, nil + case "SUSPICIOUS_ACTIVITY": + return GiftCardActivityAdjustDecrementReasonSuspiciousActivity, nil + case "BALANCE_ACCIDENTALLY_INCREASED": + return GiftCardActivityAdjustDecrementReasonBalanceAccidentallyIncreased, nil + case "SUPPORT_ISSUE": + return GiftCardActivityAdjustDecrementReasonSupportIssue, nil + case "PURCHASE_WAS_REFUNDED": + return GiftCardActivityAdjustDecrementReasonPurchaseWasRefunded, nil + } + var t GiftCardActivityAdjustDecrementReason + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (g GiftCardActivityAdjustDecrementReason) Ptr() *GiftCardActivityAdjustDecrementReason { + return &g +} + +// Represents details about an `ADJUST_INCREMENT` [gift card activity type](entity:GiftCardActivityType). +type GiftCardActivityAdjustIncrement struct { + // The amount added to the gift card balance. This value is a positive integer. + AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` + // The reason the gift card balance was adjusted. + // See [Reason](#type-reason) for possible values + Reason GiftCardActivityAdjustIncrementReason `json:"reason" url:"reason"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteLocationCustomAttributeDefinitionRequest) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardActivityAdjustIncrement) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteLocationCustomAttributeDefinitionRequest) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteLocationCustomAttributeDefinitionRequest +func (g *GiftCardActivityAdjustIncrement) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardActivityAdjustIncrement var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteLocationCustomAttributeDefinitionRequest(value) + *g = GiftCardActivityAdjustIncrement(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteLocationCustomAttributeDefinitionRequest) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardActivityAdjustIncrement) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Represents a response from a delete request containing error messages if there are any. -type DeleteLocationCustomAttributeDefinitionResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Indicates the reason for adding money to a [gift card](entity:GiftCard). +type GiftCardActivityAdjustIncrementReason string + +const ( + GiftCardActivityAdjustIncrementReasonReasonDoNotUse GiftCardActivityAdjustIncrementReason = "REASON_DO_NOT_USE" + GiftCardActivityAdjustIncrementReasonComplimentary GiftCardActivityAdjustIncrementReason = "COMPLIMENTARY" + GiftCardActivityAdjustIncrementReasonSupportIssue GiftCardActivityAdjustIncrementReason = "SUPPORT_ISSUE" + GiftCardActivityAdjustIncrementReasonTransactionVoided GiftCardActivityAdjustIncrementReason = "TRANSACTION_VOIDED" +) + +func NewGiftCardActivityAdjustIncrementReasonFromString(s string) (GiftCardActivityAdjustIncrementReason, error) { + switch s { + case "REASON_DO_NOT_USE": + return GiftCardActivityAdjustIncrementReasonReasonDoNotUse, nil + case "COMPLIMENTARY": + return GiftCardActivityAdjustIncrementReasonComplimentary, nil + case "SUPPORT_ISSUE": + return GiftCardActivityAdjustIncrementReasonSupportIssue, nil + case "TRANSACTION_VOIDED": + return GiftCardActivityAdjustIncrementReasonTransactionVoided, nil + } + var t GiftCardActivityAdjustIncrementReason + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (g GiftCardActivityAdjustIncrementReason) Ptr() *GiftCardActivityAdjustIncrementReason { + return &g +} + +// Represents details about a `BLOCK` [gift card activity type](entity:GiftCardActivityType). +type GiftCardActivityBlock struct { + // The reason the gift card was blocked. + // See [Reason](#type-reason) for possible values + Reason GiftCardActivityBlockReason `json:"reason" url:"reason"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteLocationCustomAttributeDefinitionResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardActivityBlock) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteLocationCustomAttributeDefinitionResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteLocationCustomAttributeDefinitionResponse +func (g *GiftCardActivityBlock) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardActivityBlock var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteLocationCustomAttributeDefinitionResponse(value) + *g = GiftCardActivityBlock(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteLocationCustomAttributeDefinitionResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardActivityBlock) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Represents a [DeleteLocationCustomAttribute]($e/LocationCustomAttributes/DeleteLocationCustomAttribute) request. -type DeleteLocationCustomAttributeRequest struct { +// Indicates the reason for blocking a [gift card](entity:GiftCard). +type GiftCardActivityBlockReason string + +const ( + GiftCardActivityBlockReasonReasonDoNotUse GiftCardActivityBlockReason = "REASON_DO_NOT_USE" + GiftCardActivityBlockReasonChargebackBlock GiftCardActivityBlockReason = "CHARGEBACK_BLOCK" +) + +func NewGiftCardActivityBlockReasonFromString(s string) (GiftCardActivityBlockReason, error) { + switch s { + case "REASON_DO_NOT_USE": + return GiftCardActivityBlockReasonReasonDoNotUse, nil + case "CHARGEBACK_BLOCK": + return GiftCardActivityBlockReasonChargebackBlock, nil + } + var t GiftCardActivityBlockReason + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (g GiftCardActivityBlockReason) Ptr() *GiftCardActivityBlockReason { + return &g +} + +// Represents details about a `CLEAR_BALANCE` [gift card activity type](entity:GiftCardActivityType). +type GiftCardActivityClearBalance struct { + // The reason the gift card balance was cleared. + // See [Reason](#type-reason) for possible values + Reason GiftCardActivityClearBalanceReason `json:"reason" url:"reason"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteLocationCustomAttributeRequest) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardActivityClearBalance) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteLocationCustomAttributeRequest) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteLocationCustomAttributeRequest +func (g *GiftCardActivityClearBalance) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardActivityClearBalance var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteLocationCustomAttributeRequest(value) + *g = GiftCardActivityClearBalance(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteLocationCustomAttributeRequest) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardActivityClearBalance) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Represents a [DeleteLocationCustomAttribute]($e/LocationCustomAttributes/DeleteLocationCustomAttribute) response. -// Either an empty object `{}` (for a successful deletion) or `errors` is present in the response. -type DeleteLocationCustomAttributeResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Indicates the reason for clearing the balance of a [gift card](entity:GiftCard). +type GiftCardActivityClearBalanceReason string + +const ( + GiftCardActivityClearBalanceReasonReasonDoNotUse GiftCardActivityClearBalanceReason = "REASON_DO_NOT_USE" + GiftCardActivityClearBalanceReasonSuspiciousActivity GiftCardActivityClearBalanceReason = "SUSPICIOUS_ACTIVITY" + GiftCardActivityClearBalanceReasonReuseGiftcard GiftCardActivityClearBalanceReason = "REUSE_GIFTCARD" + GiftCardActivityClearBalanceReasonUnknownReason GiftCardActivityClearBalanceReason = "UNKNOWN_REASON" +) + +func NewGiftCardActivityClearBalanceReasonFromString(s string) (GiftCardActivityClearBalanceReason, error) { + switch s { + case "REASON_DO_NOT_USE": + return GiftCardActivityClearBalanceReasonReasonDoNotUse, nil + case "SUSPICIOUS_ACTIVITY": + return GiftCardActivityClearBalanceReasonSuspiciousActivity, nil + case "REUSE_GIFTCARD": + return GiftCardActivityClearBalanceReasonReuseGiftcard, nil + case "UNKNOWN_REASON": + return GiftCardActivityClearBalanceReasonUnknownReason, nil + } + var t GiftCardActivityClearBalanceReason + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (g GiftCardActivityClearBalanceReason) Ptr() *GiftCardActivityClearBalanceReason { + return &g +} + +// Published when a [gift card activity](entity:GiftCardActivity) is created. +type GiftCardActivityCreatedEvent struct { + // The ID of the Square seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event. For this event, the value is `gift_card.activity.created`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The unique ID of the event, which is used for + // [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *GiftCardActivityCreatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteLocationCustomAttributeResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardActivityCreatedEvent) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteLocationCustomAttributeResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteLocationCustomAttributeResponse +func (g *GiftCardActivityCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardActivityCreatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteLocationCustomAttributeResponse(value) + *g = GiftCardActivityCreatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteLocationCustomAttributeResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardActivityCreatedEvent) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// A request to delete a loyalty reward. -type DeleteLoyaltyRewardRequest struct { +// Represents the data associated with a `gift_card.activity.created` event. +type GiftCardActivityCreatedEventData struct { + // The type of object affected by the event. For this event, the value is `gift_card_activity`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The ID of the new gift card activity. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object that contains the new gift card activity. + Object *GiftCardActivityCreatedEventObject `json:"object,omitempty" url:"object,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteLoyaltyRewardRequest) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardActivityCreatedEventData) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteLoyaltyRewardRequest) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteLoyaltyRewardRequest +func (g *GiftCardActivityCreatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardActivityCreatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteLoyaltyRewardRequest(value) + *g = GiftCardActivityCreatedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteLoyaltyRewardRequest) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardActivityCreatedEventData) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// A response returned by the API call. -type DeleteLoyaltyRewardResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// An object that contains the gift card activity associated with a +// `gift_card.activity.created` event. +type GiftCardActivityCreatedEventObject struct { + // The new gift card activity. + GiftCardActivity *GiftCardActivity `json:"gift_card_activity,omitempty" url:"gift_card_activity,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteLoyaltyRewardResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardActivityCreatedEventObject) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteLoyaltyRewardResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteLoyaltyRewardResponse +func (g *GiftCardActivityCreatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardActivityCreatedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteLoyaltyRewardResponse(value) + *g = GiftCardActivityCreatedEventObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteLoyaltyRewardResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardActivityCreatedEventObject) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Represents a [DeleteMerchantCustomAttributeDefinition]($e/MerchantCustomAttributes/DeleteMerchantCustomAttributeDefinition) request. -type DeleteMerchantCustomAttributeDefinitionRequest struct { +// Represents details about a `DEACTIVATE` [gift card activity type](entity:GiftCardActivityType). +type GiftCardActivityDeactivate struct { + // The reason the gift card was deactivated. + // See [Reason](#type-reason) for possible values + Reason GiftCardActivityDeactivateReason `json:"reason" url:"reason"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteMerchantCustomAttributeDefinitionRequest) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardActivityDeactivate) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteMerchantCustomAttributeDefinitionRequest) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteMerchantCustomAttributeDefinitionRequest +func (g *GiftCardActivityDeactivate) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardActivityDeactivate var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteMerchantCustomAttributeDefinitionRequest(value) + *g = GiftCardActivityDeactivate(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteMerchantCustomAttributeDefinitionRequest) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardActivityDeactivate) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Represents a response from a delete request containing error messages if there are any. -type DeleteMerchantCustomAttributeDefinitionResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Indicates the reason for deactivating a [gift card](entity:GiftCard). +type GiftCardActivityDeactivateReason string + +const ( + GiftCardActivityDeactivateReasonReasonDoNotUse GiftCardActivityDeactivateReason = "REASON_DO_NOT_USE" + GiftCardActivityDeactivateReasonSuspiciousActivity GiftCardActivityDeactivateReason = "SUSPICIOUS_ACTIVITY" + GiftCardActivityDeactivateReasonUnknownReason GiftCardActivityDeactivateReason = "UNKNOWN_REASON" + GiftCardActivityDeactivateReasonChargebackDeactivate GiftCardActivityDeactivateReason = "CHARGEBACK_DEACTIVATE" +) + +func NewGiftCardActivityDeactivateReasonFromString(s string) (GiftCardActivityDeactivateReason, error) { + switch s { + case "REASON_DO_NOT_USE": + return GiftCardActivityDeactivateReasonReasonDoNotUse, nil + case "SUSPICIOUS_ACTIVITY": + return GiftCardActivityDeactivateReasonSuspiciousActivity, nil + case "UNKNOWN_REASON": + return GiftCardActivityDeactivateReasonUnknownReason, nil + case "CHARGEBACK_DEACTIVATE": + return GiftCardActivityDeactivateReasonChargebackDeactivate, nil + } + var t GiftCardActivityDeactivateReason + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (g GiftCardActivityDeactivateReason) Ptr() *GiftCardActivityDeactivateReason { + return &g +} + +// Represents details about an `IMPORT` [gift card activity type](entity:GiftCardActivityType). +// This activity type is used when Square imports a third-party gift card, in which case the +// `gan_source` of the gift card is set to `OTHER`. +type GiftCardActivityImport struct { + // The balance amount on the imported gift card. + AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteMerchantCustomAttributeDefinitionResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardActivityImport) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteMerchantCustomAttributeDefinitionResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteMerchantCustomAttributeDefinitionResponse +func (g *GiftCardActivityImport) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardActivityImport var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteMerchantCustomAttributeDefinitionResponse(value) + *g = GiftCardActivityImport(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteMerchantCustomAttributeDefinitionResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardActivityImport) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Represents a [DeleteMerchantCustomAttribute]($e/MerchantCustomAttributes/DeleteMerchantCustomAttribute) request. -type DeleteMerchantCustomAttributeRequest struct { +// Represents details about an `IMPORT_REVERSAL` [gift card activity type](entity:GiftCardActivityType). +type GiftCardActivityImportReversal struct { + // The amount of money cleared from the third-party gift card when + // the import was reversed. + AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteMerchantCustomAttributeRequest) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardActivityImportReversal) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteMerchantCustomAttributeRequest) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteMerchantCustomAttributeRequest +func (g *GiftCardActivityImportReversal) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardActivityImportReversal var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteMerchantCustomAttributeRequest(value) + *g = GiftCardActivityImportReversal(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteMerchantCustomAttributeRequest) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardActivityImportReversal) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Represents a [DeleteMerchantCustomAttribute]($e/MerchantCustomAttributes/DeleteMerchantCustomAttribute) response. -// Either an empty object `{}` (for a successful deletion) or `errors` is present in the response. -type DeleteMerchantCustomAttributeResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Represents details about a `LOAD` [gift card activity type](entity:GiftCardActivityType). +type GiftCardActivityLoad struct { + // The amount added to the gift card. This value is a positive integer. + // + // Applications that use a custom order processing system must specify this amount in the + // [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. + AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` + // The ID of the [order](entity:Order) that contains the `GIFT_CARD` line item. + // + // Applications that use the Square Orders API to process orders must specify the order ID in the + // [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. + OrderID *string `json:"order_id,omitempty" url:"order_id,omitempty"` + // The UID of the `GIFT_CARD` line item in the order that represents the additional funds for the gift card. + // + // Applications that use the Square Orders API to process orders must specify the line item UID + // in the [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. + LineItemUID *string `json:"line_item_uid,omitempty" url:"line_item_uid,omitempty"` + // A client-specified ID that associates the gift card activity with an entity in another system. + // + // Applications that use a custom order processing system can use this field to track information related to + // an order or payment. + ReferenceID *string `json:"reference_id,omitempty" url:"reference_id,omitempty"` + // The payment instrument IDs used to process the order for the additional funds, such as a credit card ID + // or bank account ID. + // + // Applications that use a custom order processing system must specify payment instrument IDs in + // the [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. + // Square uses this information to perform compliance checks. + // + // For applications that use the Square Orders API to process payments, Square has the necessary + // instrument IDs to perform compliance checks. + // + // Each buyer payment instrument ID can contain a maximum of 255 characters. + BuyerPaymentInstrumentIDs []string `json:"buyer_payment_instrument_ids,omitempty" url:"buyer_payment_instrument_ids,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteMerchantCustomAttributeResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardActivityLoad) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteMerchantCustomAttributeResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteMerchantCustomAttributeResponse +func (g *GiftCardActivityLoad) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardActivityLoad var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteMerchantCustomAttributeResponse(value) + *g = GiftCardActivityLoad(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteMerchantCustomAttributeResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardActivityLoad) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Represents a delete request for an order custom attribute definition. -type DeleteOrderCustomAttributeDefinitionRequest struct { +// Represents details about a `REDEEM` [gift card activity type](entity:GiftCardActivityType). +type GiftCardActivityRedeem struct { + // The amount deducted from the gift card for the redemption. This value is a positive integer. + // + // Applications that use a custom payment processing system must specify this amount in the + // [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. + AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` + // The ID of the payment that represents the gift card redemption. Square populates this field + // if the payment was processed by Square. + PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` + // A client-specified ID that associates the gift card activity with an entity in another system. + // + // Applications that use a custom payment processing system can use this field to track information + // related to an order or payment. + ReferenceID *string `json:"reference_id,omitempty" url:"reference_id,omitempty"` + // The status of the gift card redemption. Gift cards redeemed from Square Point of Sale or the + // Square Seller Dashboard use a two-state process: `PENDING` + // to `COMPLETED` or `PENDING` to `CANCELED`. Gift cards redeemed using the Gift Card Activities API + // always have a `COMPLETED` status. + // See [Status](#type-status) for possible values + Status *GiftCardActivityRedeemStatus `json:"status,omitempty" url:"status,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteOrderCustomAttributeDefinitionRequest) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardActivityRedeem) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteOrderCustomAttributeDefinitionRequest) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteOrderCustomAttributeDefinitionRequest +func (g *GiftCardActivityRedeem) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardActivityRedeem var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteOrderCustomAttributeDefinitionRequest(value) + *g = GiftCardActivityRedeem(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteOrderCustomAttributeDefinitionRequest) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardActivityRedeem) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Represents a response from deleting an order custom attribute definition. -type DeleteOrderCustomAttributeDefinitionResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Indicates the status of a [gift card](entity:GiftCard) redemption. This status is relevant only for +// redemptions made from Square products (such as Square Point of Sale) because Square products use a +// two-state process. Gift cards redeemed using the Gift Card Activities API always have a `COMPLETED` status. +type GiftCardActivityRedeemStatus string + +const ( + GiftCardActivityRedeemStatusTypeDoNotUse GiftCardActivityRedeemStatus = "TYPE_DO_NOT_USE" + GiftCardActivityRedeemStatusPending GiftCardActivityRedeemStatus = "PENDING" + GiftCardActivityRedeemStatusCompleted GiftCardActivityRedeemStatus = "COMPLETED" + GiftCardActivityRedeemStatusCanceled GiftCardActivityRedeemStatus = "CANCELED" +) + +func NewGiftCardActivityRedeemStatusFromString(s string) (GiftCardActivityRedeemStatus, error) { + switch s { + case "TYPE_DO_NOT_USE": + return GiftCardActivityRedeemStatusTypeDoNotUse, nil + case "PENDING": + return GiftCardActivityRedeemStatusPending, nil + case "COMPLETED": + return GiftCardActivityRedeemStatusCompleted, nil + case "CANCELED": + return GiftCardActivityRedeemStatusCanceled, nil + } + var t GiftCardActivityRedeemStatus + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (g GiftCardActivityRedeemStatus) Ptr() *GiftCardActivityRedeemStatus { + return &g +} + +// Represents details about a `REFUND` [gift card activity type](entity:GiftCardActivityType). +type GiftCardActivityRefund struct { + // The ID of the refunded `REDEEM` gift card activity. Square populates this field if the + // `payment_id` in the corresponding [RefundPayment](api-endpoint:Refunds-RefundPayment) request + // represents a gift card redemption. + // + // For applications that use a custom payment processing system, this field is required when creating + // a `REFUND` activity. The provided `REDEEM` activity ID must be linked to the same gift card. + RedeemActivityID *string `json:"redeem_activity_id,omitempty" url:"redeem_activity_id,omitempty"` + // The amount added to the gift card for the refund. This value is a positive integer. + // + // This field is required when creating a `REFUND` activity. The amount can represent a full or partial refund. + AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` + // A client-specified ID that associates the gift card activity with an entity in another system. + ReferenceID *string `json:"reference_id,omitempty" url:"reference_id,omitempty"` + // The ID of the refunded payment. Square populates this field if the refund is for a + // payment processed by Square. This field matches the `payment_id` in the corresponding + // [RefundPayment](api-endpoint:Refunds-RefundPayment) request. + PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteOrderCustomAttributeDefinitionResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardActivityRefund) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteOrderCustomAttributeDefinitionResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteOrderCustomAttributeDefinitionResponse +func (g *GiftCardActivityRefund) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardActivityRefund var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteOrderCustomAttributeDefinitionResponse(value) + *g = GiftCardActivityRefund(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteOrderCustomAttributeDefinitionResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardActivityRefund) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Represents a delete request for an order custom attribute. -type DeleteOrderCustomAttributeRequest struct { +// Represents details about a `TRANSFER_BALANCE_FROM` [gift card activity type](entity:GiftCardActivityType). +type GiftCardActivityTransferBalanceFrom struct { + // The ID of the gift card to which the specified amount was transferred. + TransferToGiftCardID string `json:"transfer_to_gift_card_id" url:"transfer_to_gift_card_id"` + // The amount deducted from the gift card for the transfer. This value is a positive integer. + AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteOrderCustomAttributeRequest) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardActivityTransferBalanceFrom) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteOrderCustomAttributeRequest) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteOrderCustomAttributeRequest +func (g *GiftCardActivityTransferBalanceFrom) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardActivityTransferBalanceFrom var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteOrderCustomAttributeRequest(value) + *g = GiftCardActivityTransferBalanceFrom(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteOrderCustomAttributeRequest) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardActivityTransferBalanceFrom) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Represents a response from deleting an order custom attribute. -type DeleteOrderCustomAttributeResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Represents details about a `TRANSFER_BALANCE_TO` [gift card activity type](entity:GiftCardActivityType). +type GiftCardActivityTransferBalanceTo struct { + // The ID of the gift card from which the specified amount was transferred. + TransferFromGiftCardID string `json:"transfer_from_gift_card_id" url:"transfer_from_gift_card_id"` + // The amount added to the gift card balance for the transfer. This value is a positive integer. + AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteOrderCustomAttributeResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardActivityTransferBalanceTo) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteOrderCustomAttributeResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteOrderCustomAttributeResponse +func (g *GiftCardActivityTransferBalanceTo) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardActivityTransferBalanceTo var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteOrderCustomAttributeResponse(value) + *g = GiftCardActivityTransferBalanceTo(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteOrderCustomAttributeResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardActivityTransferBalanceTo) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -type DeletePaymentLinkRequest struct { +// Indicates the type of [gift card activity](entity:GiftCardActivity). +type GiftCardActivityType string + +const ( + GiftCardActivityTypeTypeDoNotUse GiftCardActivityType = "TYPE_DO_NOT_USE" + GiftCardActivityTypeActivate GiftCardActivityType = "ACTIVATE" + GiftCardActivityTypeLoad GiftCardActivityType = "LOAD" + GiftCardActivityTypeRedeem GiftCardActivityType = "REDEEM" + GiftCardActivityTypeClearBalance GiftCardActivityType = "CLEAR_BALANCE" + GiftCardActivityTypeDeactivate GiftCardActivityType = "DEACTIVATE" + GiftCardActivityTypeAdjustIncrement GiftCardActivityType = "ADJUST_INCREMENT" + GiftCardActivityTypeAdjustDecrement GiftCardActivityType = "ADJUST_DECREMENT" + GiftCardActivityTypeRefund GiftCardActivityType = "REFUND" + GiftCardActivityTypeUnlinkedActivityRefund GiftCardActivityType = "UNLINKED_ACTIVITY_REFUND" + GiftCardActivityTypeImport GiftCardActivityType = "IMPORT" + GiftCardActivityTypeOther GiftCardActivityType = "OTHER" + GiftCardActivityTypeBlock GiftCardActivityType = "BLOCK" + GiftCardActivityTypeUnblock GiftCardActivityType = "UNBLOCK" + GiftCardActivityTypeImportReversal GiftCardActivityType = "IMPORT_REVERSAL" + GiftCardActivityTypeTransferBalanceFrom GiftCardActivityType = "TRANSFER_BALANCE_FROM" + GiftCardActivityTypeTransferBalanceTo GiftCardActivityType = "TRANSFER_BALANCE_TO" +) + +func NewGiftCardActivityTypeFromString(s string) (GiftCardActivityType, error) { + switch s { + case "TYPE_DO_NOT_USE": + return GiftCardActivityTypeTypeDoNotUse, nil + case "ACTIVATE": + return GiftCardActivityTypeActivate, nil + case "LOAD": + return GiftCardActivityTypeLoad, nil + case "REDEEM": + return GiftCardActivityTypeRedeem, nil + case "CLEAR_BALANCE": + return GiftCardActivityTypeClearBalance, nil + case "DEACTIVATE": + return GiftCardActivityTypeDeactivate, nil + case "ADJUST_INCREMENT": + return GiftCardActivityTypeAdjustIncrement, nil + case "ADJUST_DECREMENT": + return GiftCardActivityTypeAdjustDecrement, nil + case "REFUND": + return GiftCardActivityTypeRefund, nil + case "UNLINKED_ACTIVITY_REFUND": + return GiftCardActivityTypeUnlinkedActivityRefund, nil + case "IMPORT": + return GiftCardActivityTypeImport, nil + case "OTHER": + return GiftCardActivityTypeOther, nil + case "BLOCK": + return GiftCardActivityTypeBlock, nil + case "UNBLOCK": + return GiftCardActivityTypeUnblock, nil + case "IMPORT_REVERSAL": + return GiftCardActivityTypeImportReversal, nil + case "TRANSFER_BALANCE_FROM": + return GiftCardActivityTypeTransferBalanceFrom, nil + case "TRANSFER_BALANCE_TO": + return GiftCardActivityTypeTransferBalanceTo, nil + } + var t GiftCardActivityType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (g GiftCardActivityType) Ptr() *GiftCardActivityType { + return &g +} + +// Represents details about an `UNBLOCK` [gift card activity type](entity:GiftCardActivityType). +type GiftCardActivityUnblock struct { + // The reason the gift card was unblocked. + // See [Reason](#type-reason) for possible values + Reason GiftCardActivityUnblockReason `json:"reason" url:"reason"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeletePaymentLinkRequest) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardActivityUnblock) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeletePaymentLinkRequest) UnmarshalJSON(data []byte) error { - type unmarshaler DeletePaymentLinkRequest +func (g *GiftCardActivityUnblock) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardActivityUnblock var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeletePaymentLinkRequest(value) + *g = GiftCardActivityUnblock(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeletePaymentLinkRequest) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardActivityUnblock) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -type DeletePaymentLinkResponse struct { - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The ID of the link that is deleted. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The ID of the order that is canceled. When a payment link is deleted, Square updates the - // the `state` (of the order that the checkout link created) to CANCELED. - CancelledOrderID *string `json:"cancelled_order_id,omitempty" url:"cancelled_order_id,omitempty"` +// Indicates the reason for unblocking a [gift card](entity:GiftCard). +type GiftCardActivityUnblockReason string + +const ( + GiftCardActivityUnblockReasonReasonDoNotUse GiftCardActivityUnblockReason = "REASON_DO_NOT_USE" + GiftCardActivityUnblockReasonChargebackUnblock GiftCardActivityUnblockReason = "CHARGEBACK_UNBLOCK" +) + +func NewGiftCardActivityUnblockReasonFromString(s string) (GiftCardActivityUnblockReason, error) { + switch s { + case "REASON_DO_NOT_USE": + return GiftCardActivityUnblockReasonReasonDoNotUse, nil + case "CHARGEBACK_UNBLOCK": + return GiftCardActivityUnblockReasonChargebackUnblock, nil + } + var t GiftCardActivityUnblockReason + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (g GiftCardActivityUnblockReason) Ptr() *GiftCardActivityUnblockReason { + return &g +} + +// Represents details about an `UNLINKED_ACTIVITY_REFUND` [gift card activity type](entity:GiftCardActivityType). +type GiftCardActivityUnlinkedActivityRefund struct { + // The amount added to the gift card for the refund. This value is a positive integer. + AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` + // A client-specified ID that associates the gift card activity with an entity in another system. + ReferenceID *string `json:"reference_id,omitempty" url:"reference_id,omitempty"` + // The ID of the refunded payment. This field is not used starting in Square version 2022-06-16. + PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeletePaymentLinkResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardActivityUnlinkedActivityRefund) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeletePaymentLinkResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DeletePaymentLinkResponse +func (g *GiftCardActivityUnlinkedActivityRefund) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardActivityUnlinkedActivityRefund var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeletePaymentLinkResponse(value) + *g = GiftCardActivityUnlinkedActivityRefund(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeletePaymentLinkResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardActivityUnlinkedActivityRefund) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// A request to delete a `Shift`. -type DeleteShiftRequest struct { +// Published when a [gift card activity](entity:GiftCardActivity) is updated. +// Subscribe to this event to be notified about the following changes: +// +// - An update to the `REDEEM` activity for a gift card redemption made from a Square product (such as Square Point of Sale). +// These redemptions are initially assigned a `PENDING` state, but then change to a `COMPLETED` or `CANCELED` state. +// - An update to the `IMPORT` activity for an imported gift card when the balance is later adjusted by Square. +type GiftCardActivityUpdatedEvent struct { + // The ID of the Square seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event. For this event, the value is `gift_card.activity.updated`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The unique ID of the event, which is used for + // [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *GiftCardActivityUpdatedEventData `json:"data,omitempty" url:"data,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteShiftRequest) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardActivityUpdatedEvent) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteShiftRequest) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteShiftRequest +func (g *GiftCardActivityUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardActivityUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteShiftRequest(value) + *g = GiftCardActivityUpdatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteShiftRequest) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardActivityUpdatedEvent) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// The response to a request to delete a `Shift`. The response might contain a set of -// `Error` objects if the request resulted in errors. -type DeleteShiftResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// The data associated with a `gift_card.activity.updated` event. +type GiftCardActivityUpdatedEventData struct { + // The type of object affected by the event. For this event, the value is `gift_card_activity`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The ID of the updated gift card activity. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object that contains the updated gift card activity. + Object *GiftCardActivityUpdatedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteShiftResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardActivityUpdatedEventData) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteShiftResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteShiftResponse +func (g *GiftCardActivityUpdatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardActivityUpdatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteShiftResponse(value) + *g = GiftCardActivityUpdatedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteShiftResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardActivityUpdatedEventData) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Represents a `DeleteSnippet` request. -type DeleteSnippetRequest struct { +// An object that contains the gift card activity associated with a +// `gift_card.activity.updated` event. +type GiftCardActivityUpdatedEventObject struct { + // The updated gift card activity. + GiftCardActivity *GiftCardActivity `json:"gift_card_activity,omitempty" url:"gift_card_activity,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteSnippetRequest) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardActivityUpdatedEventObject) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteSnippetRequest) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteSnippetRequest +func (g *GiftCardActivityUpdatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardActivityUpdatedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteSnippetRequest(value) + *g = GiftCardActivityUpdatedEventObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteSnippetRequest) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardActivityUpdatedEventObject) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Represents a `DeleteSnippet` response. -type DeleteSnippetResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Published when a [gift card](entity:GiftCard) is created. +type GiftCardCreatedEvent struct { + // The ID of the Square seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event. For this event, the value is `gift_card.created`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The unique ID of the event, which is used for + // [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *GiftCardCreatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteSnippetResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardCreatedEvent) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteSnippetResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteSnippetResponse +func (g *GiftCardCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardCreatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteSnippetResponse(value) + *g = GiftCardCreatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteSnippetResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardCreatedEvent) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Defines input parameters in a call to the -// [DeleteSubscriptionAction]($e/Subscriptions/DeleteSubscriptionAction) -// endpoint. -type DeleteSubscriptionActionRequest struct { +// The data associated with a `gift_card.created` event. +type GiftCardCreatedEventData struct { + // The type of object affected by the event. For this event, the value is `gift_card`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The ID of the new gift card. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object that contains the new gift card. + Object *GiftCardCreatedEventObject `json:"object,omitempty" url:"object,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteSubscriptionActionRequest) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardCreatedEventData) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteSubscriptionActionRequest) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteSubscriptionActionRequest +func (g *GiftCardCreatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardCreatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteSubscriptionActionRequest(value) + *g = GiftCardCreatedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteSubscriptionActionRequest) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardCreatedEventData) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Defines output parameters in a response of the [DeleteSubscriptionAction]($e/Subscriptions/DeleteSubscriptionAction) -// endpoint. -type DeleteSubscriptionActionResponse struct { - // Errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The subscription that has the specified action deleted. - Subscription *Subscription `json:"subscription,omitempty" url:"subscription,omitempty"` +// An object that contains the gift card associated with a `gift_card.created` event. +type GiftCardCreatedEventObject struct { + // The new gift card. + GiftCard *GiftCard `json:"gift_card,omitempty" url:"gift_card,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteSubscriptionActionResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardCreatedEventObject) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteSubscriptionActionResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteSubscriptionActionResponse +func (g *GiftCardCreatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardCreatedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteSubscriptionActionResponse(value) + *g = GiftCardCreatedEventObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteSubscriptionActionResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardCreatedEventObject) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Deletes a [Subscription]($m/WebhookSubscription). -type DeleteWebhookSubscriptionRequest struct { +// Published when a [customer](entity:Customer) is linked to a [gift card](entity:GiftCard). +type GiftCardCustomerLinkedEvent struct { + // The ID of the Square seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event. For this event, the value is `gift_card.customer_linked`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The unique ID of the event, which is used for + // [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *GiftCardCustomerLinkedEventData `json:"data,omitempty" url:"data,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteWebhookSubscriptionRequest) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardCustomerLinkedEvent) GetExtraProperties() map[string]interface{} { + return g.extraProperties } - -func (d *DeleteWebhookSubscriptionRequest) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteWebhookSubscriptionRequest + +func (g *GiftCardCustomerLinkedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardCustomerLinkedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteWebhookSubscriptionRequest(value) + *g = GiftCardCustomerLinkedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteWebhookSubscriptionRequest) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardCustomerLinkedEvent) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Defines the fields that are included in the response body of -// a request to the [DeleteWebhookSubscription]($e/WebhookSubscriptions/DeleteWebhookSubscription) endpoint. -type DeleteWebhookSubscriptionResponse struct { - // Information on errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// The data associated with a `gift_card.customer_linked` event. +type GiftCardCustomerLinkedEventData struct { + // The type of object affected by the event. For this event, the value is `gift_card`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The ID of the updated gift card. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object that contains the updated gift card and the ID of the linked customer. + Object *GiftCardCustomerLinkedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeleteWebhookSubscriptionResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardCustomerLinkedEventData) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeleteWebhookSubscriptionResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteWebhookSubscriptionResponse +func (g *GiftCardCustomerLinkedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardCustomerLinkedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteWebhookSubscriptionResponse(value) + *g = GiftCardCustomerLinkedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeleteWebhookSubscriptionResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardCustomerLinkedEventData) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Defines the parameters for a `DeprecatedCreateDisputeEvidenceFile` request. -type DeprecatedCreateDisputeEvidenceFileRequest struct { - // The Unique ID. For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). - IdempotencyKey string `json:"idempotency_key" url:"idempotency_key"` - // The type of evidence you are uploading. - // See [DisputeEvidenceType](#type-disputeevidencetype) for possible values - EvidenceType *DisputeEvidenceType `json:"evidence_type,omitempty" url:"evidence_type,omitempty"` - // The MIME type of the uploaded file. - // The type can be image/heic, image/heif, image/jpeg, application/pdf, image/png, or image/tiff. - ContentType *string `json:"content_type,omitempty" url:"content_type,omitempty"` +// An object that contains the gift card and customer ID associated with a +// `gift_card.customer_linked` event. +type GiftCardCustomerLinkedEventObject struct { + // The gift card with the updated `customer_ids` field. + GiftCard *GiftCard `json:"gift_card,omitempty" url:"gift_card,omitempty"` + // The ID of the linked [customer](entity:Customer). + LinkedCustomerID *string `json:"linked_customer_id,omitempty" url:"linked_customer_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeprecatedCreateDisputeEvidenceFileRequest) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardCustomerLinkedEventObject) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeprecatedCreateDisputeEvidenceFileRequest) UnmarshalJSON(data []byte) error { - type unmarshaler DeprecatedCreateDisputeEvidenceFileRequest +func (g *GiftCardCustomerLinkedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardCustomerLinkedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeprecatedCreateDisputeEvidenceFileRequest(value) + *g = GiftCardCustomerLinkedEventObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeprecatedCreateDisputeEvidenceFileRequest) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardCustomerLinkedEventObject) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Defines the fields in a `DeprecatedCreateDisputeEvidenceFile` response. -type DeprecatedCreateDisputeEvidenceFileResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The metadata of the newly uploaded dispute evidence. - Evidence *DisputeEvidence `json:"evidence,omitempty" url:"evidence,omitempty"` +// Published when a [customer](entity:Customer) is unlinked from a [gift card](entity:GiftCard). +type GiftCardCustomerUnlinkedEvent struct { + // The ID of the Square seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event. For this event, the value is `gift_card.customer_unlinked`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The unique ID of the event, which is used for + // [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *GiftCardCustomerUnlinkedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeprecatedCreateDisputeEvidenceFileResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardCustomerUnlinkedEvent) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeprecatedCreateDisputeEvidenceFileResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DeprecatedCreateDisputeEvidenceFileResponse +func (g *GiftCardCustomerUnlinkedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardCustomerUnlinkedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeprecatedCreateDisputeEvidenceFileResponse(value) + *g = GiftCardCustomerUnlinkedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeprecatedCreateDisputeEvidenceFileResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardCustomerUnlinkedEvent) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Defines the parameters for a `DeprecatedCreateDisputeEvidenceText` request. -type DeprecatedCreateDisputeEvidenceTextRequest struct { - // The Unique ID. For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). - IdempotencyKey string `json:"idempotency_key" url:"idempotency_key"` - // The type of evidence you are uploading. - // See [DisputeEvidenceType](#type-disputeevidencetype) for possible values - EvidenceType *DisputeEvidenceType `json:"evidence_type,omitempty" url:"evidence_type,omitempty"` - // The evidence string. - EvidenceText string `json:"evidence_text" url:"evidence_text"` +// The data associated with a `gift_card.customer_unlinked` event. +type GiftCardCustomerUnlinkedEventData struct { + // The type of object affected by the event. For this event, the value is `gift_card`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The ID of the updated gift card. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object that contains the updated gift card and the ID of the unlinked customer. + Object *GiftCardCustomerUnlinkedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeprecatedCreateDisputeEvidenceTextRequest) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardCustomerUnlinkedEventData) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeprecatedCreateDisputeEvidenceTextRequest) UnmarshalJSON(data []byte) error { - type unmarshaler DeprecatedCreateDisputeEvidenceTextRequest +func (g *GiftCardCustomerUnlinkedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardCustomerUnlinkedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeprecatedCreateDisputeEvidenceTextRequest(value) + *g = GiftCardCustomerUnlinkedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeprecatedCreateDisputeEvidenceTextRequest) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardCustomerUnlinkedEventData) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Defines the fields in a `DeprecatedCreateDisputeEvidenceText` response. -type DeprecatedCreateDisputeEvidenceTextResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The newly uploaded dispute evidence metadata. - Evidence *DisputeEvidence `json:"evidence,omitempty" url:"evidence,omitempty"` +// An object that contains the gift card and the customer ID associated with a +// `gift_card.customer_linked` event. +type GiftCardCustomerUnlinkedEventObject struct { + // The gift card with the updated `customer_ids` field. + // The field is removed if the gift card is not linked to any customers. + GiftCard *GiftCard `json:"gift_card,omitempty" url:"gift_card,omitempty"` + // The ID of the unlinked [customer](entity:Customer). + UnlinkedCustomerID *string `json:"unlinked_customer_id,omitempty" url:"unlinked_customer_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeprecatedCreateDisputeEvidenceTextResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardCustomerUnlinkedEventObject) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DeprecatedCreateDisputeEvidenceTextResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DeprecatedCreateDisputeEvidenceTextResponse +func (g *GiftCardCustomerUnlinkedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardCustomerUnlinkedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeprecatedCreateDisputeEvidenceTextResponse(value) + *g = GiftCardCustomerUnlinkedEventObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DeprecatedCreateDisputeEvidenceTextResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardCustomerUnlinkedEventObject) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Information about the destination against which the payout was made. -type Destination struct { - // Type of the destination such as a bank account or debit card. - // See [DestinationType](#type-destinationtype) for possible values - Type *DestinationType `json:"type,omitempty" url:"type,omitempty"` - // Square issued unique ID (also known as the instrument ID) associated with this destination. - ID *string `json:"id,omitempty" url:"id,omitempty"` +// Indicates the source that generated the gift card +// account number (GAN). +type GiftCardGanSource string + +const ( + GiftCardGanSourceGanSourceDoNotUse GiftCardGanSource = "GAN_SOURCE_DO_NOT_USE" + GiftCardGanSourceSquare GiftCardGanSource = "SQUARE" + GiftCardGanSourceOther GiftCardGanSource = "OTHER" +) + +func NewGiftCardGanSourceFromString(s string) (GiftCardGanSource, error) { + switch s { + case "GAN_SOURCE_DO_NOT_USE": + return GiftCardGanSourceGanSourceDoNotUse, nil + case "SQUARE": + return GiftCardGanSourceSquare, nil + case "OTHER": + return GiftCardGanSourceOther, nil + } + var t GiftCardGanSource + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (g GiftCardGanSource) Ptr() *GiftCardGanSource { + return &g +} + +// Indicates the gift card state. +type GiftCardStatus string + +const ( + GiftCardStatusStatusDoNotUse GiftCardStatus = "STATUS_DO_NOT_USE" + GiftCardStatusNotActive GiftCardStatus = "NOT_ACTIVE" + GiftCardStatusActive GiftCardStatus = "ACTIVE" + GiftCardStatusDeactivated GiftCardStatus = "DEACTIVATED" + GiftCardStatusBlocked GiftCardStatus = "BLOCKED" + GiftCardStatusPending GiftCardStatus = "PENDING" + GiftCardStatusUnregistered GiftCardStatus = "UNREGISTERED" +) + +func NewGiftCardStatusFromString(s string) (GiftCardStatus, error) { + switch s { + case "STATUS_DO_NOT_USE": + return GiftCardStatusStatusDoNotUse, nil + case "NOT_ACTIVE": + return GiftCardStatusNotActive, nil + case "ACTIVE": + return GiftCardStatusActive, nil + case "DEACTIVATED": + return GiftCardStatusDeactivated, nil + case "BLOCKED": + return GiftCardStatusBlocked, nil + case "PENDING": + return GiftCardStatusPending, nil + case "UNREGISTERED": + return GiftCardStatusUnregistered, nil + } + var t GiftCardStatus + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (g GiftCardStatus) Ptr() *GiftCardStatus { + return &g +} + +// Indicates the gift card type. +type GiftCardType string + +const ( + GiftCardTypeTypeDoNotUse GiftCardType = "TYPE_DO_NOT_USE" + GiftCardTypePhysical GiftCardType = "PHYSICAL" + GiftCardTypeDigital GiftCardType = "DIGITAL" +) + +func NewGiftCardTypeFromString(s string) (GiftCardType, error) { + switch s { + case "TYPE_DO_NOT_USE": + return GiftCardTypeTypeDoNotUse, nil + case "PHYSICAL": + return GiftCardTypePhysical, nil + case "DIGITAL": + return GiftCardTypeDigital, nil + } + var t GiftCardType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (g GiftCardType) Ptr() *GiftCardType { + return &g +} + +// Published when a [gift card](entity:GiftCard) is updated. This includes +// changes to the state, balance, and customer association. +type GiftCardUpdatedEvent struct { + // The ID of the Square seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. For this event, the value is `gift_card.updated`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The unique ID of the event, which is used for + // [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *GiftCardUpdatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *Destination) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardUpdatedEvent) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *Destination) UnmarshalJSON(data []byte) error { - type unmarshaler Destination +func (g *GiftCardUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = Destination(value) + *g = GiftCardUpdatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *Destination) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardUpdatedEvent) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Details about a refund's destination. -type DestinationDetails struct { - // Details about a card refund. Only populated if the destination_type is `CARD`. - CardDetails *DestinationDetailsCardRefundDetails `json:"card_details,omitempty" url:"card_details,omitempty"` - // Details about a cash refund. Only populated if the destination_type is `CASH`. - CashDetails *DestinationDetailsCashRefundDetails `json:"cash_details,omitempty" url:"cash_details,omitempty"` - // Details about an external refund. Only populated if the destination_type is `EXTERNAL`. - ExternalDetails *DestinationDetailsExternalRefundDetails `json:"external_details,omitempty" url:"external_details,omitempty"` +// The data associated with a `gift_card.updated` event. +type GiftCardUpdatedEventData struct { + // The type of object affected by the event. For this event, the value is `gift_card`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The ID of the updated gift card. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object that contains the updated gift card. + Object *GiftCardUpdatedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DestinationDetails) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardUpdatedEventData) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DestinationDetails) UnmarshalJSON(data []byte) error { - type unmarshaler DestinationDetails +func (g *GiftCardUpdatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardUpdatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DestinationDetails(value) + *g = GiftCardUpdatedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DestinationDetails) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardUpdatedEventData) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -type DestinationDetailsCardRefundDetails struct { - // The card's non-confidential details. - Card *Card `json:"card,omitempty" url:"card,omitempty"` - // The method used to enter the card's details for the refund. The method can be - // `KEYED`, `SWIPED`, `EMV`, `ON_FILE`, or `CONTACTLESS`. - EntryMethod *string `json:"entry_method,omitempty" url:"entry_method,omitempty"` - // The authorization code provided by the issuer when a refund is approved. - AuthResultCode *string `json:"auth_result_code,omitempty" url:"auth_result_code,omitempty"` +// An object that contains the gift card associated with a `gift_card.updated` event. +type GiftCardUpdatedEventObject struct { + // The gift card with the updated `balance_money`, `state`, or `customer_ids` field. + // Some events can affect both `balance_money` and `state`. + GiftCard *GiftCard `json:"gift_card,omitempty" url:"gift_card,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DestinationDetailsCardRefundDetails) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (g *GiftCardUpdatedEventObject) GetExtraProperties() map[string]interface{} { + return g.extraProperties } -func (d *DestinationDetailsCardRefundDetails) UnmarshalJSON(data []byte) error { - type unmarshaler DestinationDetailsCardRefundDetails +func (g *GiftCardUpdatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler GiftCardUpdatedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DestinationDetailsCardRefundDetails(value) + *g = GiftCardUpdatedEventObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *g) if err != nil { return err } - d.extraProperties = extraProperties + g.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + g._rawJSON = json.RawMessage(data) return nil } -func (d *DestinationDetailsCardRefundDetails) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (g *GiftCardUpdatedEventObject) String() string { + if len(g._rawJSON) > 0 { + if value, err := core.StringifyJSON(g._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(g); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", g) } -// Stores details about a cash refund. Contains only non-confidential information. -type DestinationDetailsCashRefundDetails struct { - // The amount and currency of the money supplied by the seller. - SellerSuppliedMoney *Money `json:"seller_supplied_money,omitempty" url:"seller_supplied_money,omitempty"` - // The amount of change due back to the seller. - // This read-only field is calculated - // from the `amount_money` and `seller_supplied_money` fields. - ChangeBackMoney *Money `json:"change_back_money,omitempty" url:"change_back_money,omitempty"` +// 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. Replaced by the `from_state` field. + // See [InventoryState](#type-inventorystate) for possible values + FromStatus *InventoryState `json:"from_status,omitempty" url:"from_status,omitempty"` + // The [inventory state](entity:InventoryState) of the related quantity + // of items after the adjustment. Replaced by the `to_state` field. + // See [InventoryState](#type-inventorystate) for possible values + ToStatus *InventoryState `json:"to_status,omitempty" url:"to_status,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 before the adjustment. Replaced by + // `from_location_id` of [InventoryTransfer](entity:InventoryTransfer). + FromLocationID *string `json:"from_location_id,omitempty" url:"from_location_id,omitempty"` + // The Square-generated ID of the [Location](entity:Location) where the related + // quantity of items is being tracked after the adjustment. Replaced by + // `to_location_id` of [InventoryTransfer](entity:InventoryTransfer). + ToLocationID *string `json:"to_location_id,omitempty" url:"to_location_id,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 (d *DestinationDetailsCashRefundDetails) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (i *InventoryAdjustment) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (d *DestinationDetailsCashRefundDetails) UnmarshalJSON(data []byte) error { - type unmarshaler DestinationDetailsCashRefundDetails +func (i *InventoryAdjustment) UnmarshalJSON(data []byte) error { + type unmarshaler InventoryAdjustment var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DestinationDetailsCashRefundDetails(value) + *i = InventoryAdjustment(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - d.extraProperties = extraProperties + i.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (d *DestinationDetailsCashRefundDetails) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (i *InventoryAdjustment) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", i) } -// Stores details about an external refund. Contains only non-confidential information. -type DestinationDetailsExternalRefundDetails struct { - // The type of external refund the seller paid to the buyer. It can be one of the - // following: - // - // - CHECK - Refunded using a physical check. - // - BANK_TRANSFER - Refunded using external bank transfer. - // - OTHER_GIFT_CARD - Refunded using a non-Square gift card. - // - CRYPTO - Refunded using a crypto currency. - // - SQUARE_CASH - Refunded using Square Cash App. - // - SOCIAL - Refunded using peer-to-peer payment applications. - // - EXTERNAL - A third-party application gathered this refund outside of Square. - // - EMONEY - Refunded using an E-money provider. - // - CARD - A credit or debit card that Square does not support. - // - STORED_BALANCE - Use for house accounts, store credit, and so forth. - // - FOOD_VOUCHER - Restaurant voucher provided by employers to employees to pay for meals - // - OTHER - A type not listed here. - Type string `json:"type" url:"type"` - // A description of the external refund source. For example, - // "Food Delivery Service". - Source string `json:"source" url:"source"` - // An ID to associate the refund to its originating source. - SourceID *string `json:"source_id,omitempty" url:"source_id,omitempty"` +type InventoryAdjustmentGroup struct { + // A unique ID generated by Square for the + // `InventoryAdjustmentGroup`. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The inventory adjustment of the composed variation. + RootAdjustmentID *string `json:"root_adjustment_id,omitempty" url:"root_adjustment_id,omitempty"` + // Representative `from_state` for adjustments within the group. For example, for a group adjustment from `IN_STOCK` to `SOLD`, + // there can be two component adjustments in the group: one from `IN_STOCK`to `COMPOSED` and the other one from `COMPOSED` to `SOLD`. + // Here, the representative `from_state` for the `InventoryAdjustmentGroup` is `IN_STOCK`. + // See [InventoryState](#type-inventorystate) for possible values + FromState *InventoryState `json:"from_state,omitempty" url:"from_state,omitempty"` + // Representative `to_state` for adjustments within group. For example, for a group adjustment from `IN_STOCK` to `SOLD`, + // the two component adjustments in the group can be from `IN_STOCK` to `COMPOSED` and from `COMPOSED` to `SOLD`. + // Here, the representative `to_state` of the `InventoryAdjustmentGroup` is `SOLD`. + // See [InventoryState](#type-inventorystate) for possible values + ToState *InventoryState `json:"to_state,omitempty" url:"to_state,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DestinationDetailsExternalRefundDetails) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (i *InventoryAdjustmentGroup) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (d *DestinationDetailsExternalRefundDetails) UnmarshalJSON(data []byte) error { - type unmarshaler DestinationDetailsExternalRefundDetails +func (i *InventoryAdjustmentGroup) UnmarshalJSON(data []byte) error { + type unmarshaler InventoryAdjustmentGroup var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DestinationDetailsExternalRefundDetails(value) + *i = InventoryAdjustmentGroup(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - d.extraProperties = extraProperties + i.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (d *DestinationDetailsExternalRefundDetails) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (i *InventoryAdjustmentGroup) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", i) } -// List of possible destinations against which a payout can be made. -type DestinationType string +// Indicates whether Square should alert the merchant when the inventory quantity of a CatalogItemVariation is low. +type InventoryAlertType string const ( - DestinationTypeBankAccount DestinationType = "BANK_ACCOUNT" - DestinationTypeCard DestinationType = "CARD" - DestinationTypeSquareBalance DestinationType = "SQUARE_BALANCE" - DestinationTypeSquareStoredBalance DestinationType = "SQUARE_STORED_BALANCE" + InventoryAlertTypeInventoryAlertTypeDoNotUse InventoryAlertType = "INVENTORY_ALERT_TYPE_DO_NOT_USE" + InventoryAlertTypeNone InventoryAlertType = "NONE" + InventoryAlertTypeLowQuantity InventoryAlertType = "LOW_QUANTITY" ) -func NewDestinationTypeFromString(s string) (DestinationType, error) { +func NewInventoryAlertTypeFromString(s string) (InventoryAlertType, error) { switch s { - case "BANK_ACCOUNT": - return DestinationTypeBankAccount, nil - case "CARD": - return DestinationTypeCard, nil - case "SQUARE_BALANCE": - return DestinationTypeSquareBalance, nil - case "SQUARE_STORED_BALANCE": - return DestinationTypeSquareStoredBalance, nil + case "INVENTORY_ALERT_TYPE_DO_NOT_USE": + return InventoryAlertTypeInventoryAlertTypeDoNotUse, nil + case "NONE": + return InventoryAlertTypeNone, nil + case "LOW_QUANTITY": + return InventoryAlertTypeLowQuantity, nil } - var t DestinationType + var t InventoryAlertType return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (d DestinationType) Ptr() *DestinationType { - return &d +func (i InventoryAlertType) Ptr() *InventoryAlertType { + return &i } -type Device struct { - // A synthetic identifier for the device. The identifier includes a standardized prefix and - // is otherwise an opaque id generated from key device fields. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // A collection of DeviceAttributes representing the device. - Attributes *DeviceAttributes `json:"attributes,omitempty" url:"attributes,omitempty"` - // A list of components applicable to the device. - Components []*Component `json:"components,omitempty" url:"components,omitempty"` - // The current status of the device. - Status *DeviceStatus `json:"status,omitempty" url:"status,omitempty"` +// Represents a single physical count, inventory, adjustment, or transfer +// that is part of the history of inventory changes for a particular +// [CatalogObject](entity:CatalogObject) instance. +type InventoryChange struct { + // Indicates how the inventory change is applied. See + // [InventoryChangeType](entity:InventoryChangeType) for all possible values. + // See [InventoryChangeType](#type-inventorychangetype) for possible values + Type *InventoryChangeType `json:"type,omitempty" url:"type,omitempty"` + // Contains details about the physical count when `type` is + // `PHYSICAL_COUNT`, and is unset for all other change types. + PhysicalCount *InventoryPhysicalCount `json:"physical_count,omitempty" url:"physical_count,omitempty"` + // Contains details about the inventory adjustment when `type` is + // `ADJUSTMENT`, and is unset for all other change types. + Adjustment *InventoryAdjustment `json:"adjustment,omitempty" url:"adjustment,omitempty"` + // Contains details about the inventory transfer when `type` is + // `TRANSFER`, and is unset for all other change types. + // + // _Note:_ An [InventoryTransfer](entity:InventoryTransfer) object can only be set in the input to the + // [BatchChangeInventory](api-endpoint:Inventory-BatchChangeInventory) endpoint when the seller has an active Retail Plus subscription. + Transfer *InventoryTransfer `json:"transfer,omitempty" url:"transfer,omitempty"` + // The [CatalogMeasurementUnit](entity:CatalogMeasurementUnit) object representing the catalog measurement unit associated with the inventory change. + MeasurementUnit *CatalogMeasurementUnit `json:"measurement_unit,omitempty" url:"measurement_unit,omitempty"` + // The ID of the [CatalogMeasurementUnit](entity:CatalogMeasurementUnit) object representing the catalog measurement unit associated with the inventory change. + MeasurementUnitID *string `json:"measurement_unit_id,omitempty" url:"measurement_unit_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *Device) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (i *InventoryChange) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (d *Device) UnmarshalJSON(data []byte) error { - type unmarshaler Device +func (i *InventoryChange) UnmarshalJSON(data []byte) error { + type unmarshaler InventoryChange var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = Device(value) + *i = InventoryChange(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - d.extraProperties = extraProperties + i.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (d *Device) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (i *InventoryChange) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", d) -} - -type DeviceAttributes struct { - // The device type. - // See [DeviceType](#type-devicetype) for possible values - Type DeviceAttributesDeviceType `json:"type,omitempty" url:"type,omitempty"` - // The maker of the device. - Manufacturer string `json:"manufacturer" url:"manufacturer"` - // The specific model of the device. - Model *string `json:"model,omitempty" url:"model,omitempty"` - // A seller-specified name for the device. - Name *string `json:"name,omitempty" url:"name,omitempty"` - // The manufacturer-supplied identifier for the device (where available). In many cases, - // this identifier will be a serial number. - ManufacturersID *string `json:"manufacturers_id,omitempty" url:"manufacturers_id,omitempty"` - // The RFC 3339-formatted value of the most recent update to the device information. - // (Could represent any field update on the device.) - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` - // The current version of software installed on the device. - Version *string `json:"version,omitempty" url:"version,omitempty"` - // The merchant_token identifying the merchant controlling the device. - MerchantToken *string `json:"merchant_token,omitempty" url:"merchant_token,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage + return fmt.Sprintf("%#v", i) } -func (d *DeviceAttributes) GetExtraProperties() map[string]interface{} { - return d.extraProperties -} +// Indicates how the inventory change was applied to a tracked product quantity. +type InventoryChangeType string -func (d *DeviceAttributes) UnmarshalJSON(data []byte) error { - type unmarshaler DeviceAttributes - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *d = DeviceAttributes(value) +const ( + InventoryChangeTypeInventoryChangeTypeDoNotUse InventoryChangeType = "INVENTORY_CHANGE_TYPE_DO_NOT_USE" + InventoryChangeTypePhysicalCount InventoryChangeType = "PHYSICAL_COUNT" + InventoryChangeTypeAdjustment InventoryChangeType = "ADJUSTMENT" + InventoryChangeTypeTransfer InventoryChangeType = "TRANSFER" + InventoryChangeTypeAvailability InventoryChangeType = "AVAILABILITY" +) - extraProperties, err := core.ExtractExtraProperties(data, *d) - if err != nil { - return err +func NewInventoryChangeTypeFromString(s string) (InventoryChangeType, error) { + switch s { + case "INVENTORY_CHANGE_TYPE_DO_NOT_USE": + return InventoryChangeTypeInventoryChangeTypeDoNotUse, nil + case "PHYSICAL_COUNT": + return InventoryChangeTypePhysicalCount, nil + case "ADJUSTMENT": + return InventoryChangeTypeAdjustment, nil + case "TRANSFER": + return InventoryChangeTypeTransfer, nil + case "AVAILABILITY": + return InventoryChangeTypeAvailability, nil } - d.extraProperties = extraProperties - - d._rawJSON = json.RawMessage(data) - return nil + var t InventoryChangeType + return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (d *DeviceAttributes) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(d); err == nil { - return value - } - return fmt.Sprintf("%#v", d) +func (i InventoryChangeType) Ptr() *InventoryChangeType { + return &i } -// An enum identifier of the device type. -type DeviceAttributesDeviceType = string - -type DeviceCheckoutOptions struct { - // The unique ID of the device intended for this `TerminalCheckout`. - // A list of `DeviceCode` objects can be retrieved from the /v2/devices/codes endpoint. - // Match a `DeviceCode.device_id` value with `device_id` to get the associated device code. - DeviceID string `json:"device_id" url:"device_id"` - // Instructs the device to skip the receipt screen. Defaults to false. - SkipReceiptScreen *bool `json:"skip_receipt_screen,omitempty" url:"skip_receipt_screen,omitempty"` - // Indicates that signature collection is desired during checkout. Defaults to false. - CollectSignature *bool `json:"collect_signature,omitempty" url:"collect_signature,omitempty"` - // Tip-specific settings. - TipSettings *TipSettings `json:"tip_settings,omitempty" url:"tip_settings,omitempty"` - // Show the itemization screen prior to taking a payment. This field is only meaningful when the - // checkout includes an order ID. Defaults to true. - ShowItemizedCart *bool `json:"show_itemized_cart,omitempty" url:"show_itemized_cart,omitempty"` +// Represents Square-estimated quantity of items in a particular state at a +// particular seller location based on the known history of physical counts and +// inventory adjustments. +type InventoryCount struct { + // 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 current [inventory state](entity:InventoryState) for the related + // quantity of items. Replaced by the `state` field. + // See [InventoryState](#type-inventorystate) for possible values + Status *InventoryState `json:"status,omitempty" url:"status,omitempty"` + // The current [inventory state](entity:InventoryState) for the related + // quantity of items. + // See [InventoryState](#type-inventorystate) for possible values + State *InventoryState `json:"state,omitempty" url:"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 number of items affected by the estimated count as a decimal string. + // Can support up to 5 digits after the decimal point. + Quantity *string `json:"quantity,omitempty" url:"quantity,omitempty"` + // An RFC 3339-formatted timestamp that indicates when the most recent physical count or adjustment affecting + // the estimated count is received. + CalculatedAt *string `json:"calculated_at,omitempty" url:"calculated_at,omitempty"` + // Whether the inventory count is for composed variation (TRUE) or not (FALSE). If true, the inventory count will not be present in the response of + // any of these endpoints: [BatchChangeInventory](api-endpoint:Inventory-BatchChangeInventory), + // [BatchRetrieveInventoryChanges](api-endpoint:Inventory-BatchRetrieveInventoryChanges), + // [BatchRetrieveInventoryCounts](api-endpoint:Inventory-BatchRetrieveInventoryCounts), and + // [RetrieveInventoryChanges](api-endpoint:Inventory-RetrieveInventoryChanges). + IsEstimated *bool `json:"is_estimated,omitempty" url:"is_estimated,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeviceCheckoutOptions) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (i *InventoryCount) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (d *DeviceCheckoutOptions) UnmarshalJSON(data []byte) error { - type unmarshaler DeviceCheckoutOptions +func (i *InventoryCount) UnmarshalJSON(data []byte) error { + type unmarshaler InventoryCount var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeviceCheckoutOptions(value) + *i = InventoryCount(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - d.extraProperties = extraProperties + i.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (d *DeviceCheckoutOptions) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (i *InventoryCount) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", i) } -type DeviceCode struct { - // The unique id for this device code. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // An optional user-defined name for the device code. - Name *string `json:"name,omitempty" url:"name,omitempty"` - // The unique code that can be used to login. - Code *string `json:"code,omitempty" url:"code,omitempty"` - // The unique id of the device that used this code. Populated when the device is paired up. - DeviceID *string `json:"device_id,omitempty" url:"device_id,omitempty"` - // The targeting product type of the device code. - ProductType ProductType `json:"product_type,omitempty" url:"product_type,omitempty"` - // The location assigned to this code. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` - // The pairing status of the device code. - // See [DeviceCodeStatus](#type-devicecodestatus) for possible values - Status *DeviceCodeStatus `json:"status,omitempty" url:"status,omitempty"` - // When this DeviceCode will expire and no longer login. Timestamp in RFC 3339 format. - PairBy *string `json:"pair_by,omitempty" url:"pair_by,omitempty"` - // When this DeviceCode was created. Timestamp in RFC 3339 format. +// Published when the quantity is updated for a +// [CatalogItemVariation](entity:CatalogItemVariation). +type InventoryCountUpdatedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // When this DeviceCode's status was last changed. Timestamp in RFC 3339 format. - StatusChangedAt *string `json:"status_changed_at,omitempty" url:"status_changed_at,omitempty"` - // When this DeviceCode was paired. Timestamp in RFC 3339 format. - PairedAt *string `json:"paired_at,omitempty" url:"paired_at,omitempty"` + // Data associated with the event. + Data *InventoryCountUpdatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeviceCode) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (i *InventoryCountUpdatedEvent) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (d *DeviceCode) UnmarshalJSON(data []byte) error { - type unmarshaler DeviceCode +func (i *InventoryCountUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler InventoryCountUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeviceCode(value) + *i = InventoryCountUpdatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - d.extraProperties = extraProperties + i.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (d *DeviceCode) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (i *InventoryCountUpdatedEvent) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", d) -} - -// DeviceCode.Status enum. -type DeviceCodeStatus string - -const ( - DeviceCodeStatusUnknown DeviceCodeStatus = "UNKNOWN" - DeviceCodeStatusUnpaired DeviceCodeStatus = "UNPAIRED" - DeviceCodeStatusPaired DeviceCodeStatus = "PAIRED" - DeviceCodeStatusExpired DeviceCodeStatus = "EXPIRED" -) - -func NewDeviceCodeStatusFromString(s string) (DeviceCodeStatus, error) { - switch s { - case "UNKNOWN": - return DeviceCodeStatusUnknown, nil - case "UNPAIRED": - return DeviceCodeStatusUnpaired, nil - case "PAIRED": - return DeviceCodeStatusPaired, nil - case "EXPIRED": - return DeviceCodeStatusExpired, nil - } - var t DeviceCodeStatus - return "", fmt.Errorf("%s is not a valid %T", s, t) + return fmt.Sprintf("%#v", i) } -func (d DeviceCodeStatus) Ptr() *DeviceCodeStatus { - return &d -} +type InventoryCountUpdatedEventData struct { + // Name of the affected object’s type. For this event, the value is `inventory_counts`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the affected object. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing fields and values relevant to the event. Is absent if affected object was deleted. + Object *InventoryCountUpdatedEventObject `json:"object,omitempty" url:"object,omitempty"` -type DeviceComponentDetails struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeviceComponentDetails) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (i *InventoryCountUpdatedEventData) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (d *DeviceComponentDetails) UnmarshalJSON(data []byte) error { - type unmarshaler DeviceComponentDetails +func (i *InventoryCountUpdatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler InventoryCountUpdatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeviceComponentDetails(value) + *i = InventoryCountUpdatedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - d.extraProperties = extraProperties + i.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (d *DeviceComponentDetails) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (i *InventoryCountUpdatedEventData) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", i) } -type DeviceComponentDetailsApplicationDetails struct { - // The type of application. - // See [ApplicationType](#type-applicationtype) for possible values - ApplicationType *ApplicationType `json:"application_type,omitempty" url:"application_type,omitempty"` - // The version of the application. - Version *string `json:"version,omitempty" url:"version,omitempty"` - // The location_id of the session for the application. - SessionLocation *string `json:"session_location,omitempty" url:"session_location,omitempty"` - // The id of the device code that was used to log in to the device. - DeviceCodeID *string `json:"device_code_id,omitempty" url:"device_code_id,omitempty"` +type InventoryCountUpdatedEventObject struct { + // The inventory counts. + InventoryCounts []*InventoryCount `json:"inventory_counts,omitempty" url:"inventory_counts,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeviceComponentDetailsApplicationDetails) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (i *InventoryCountUpdatedEventObject) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (d *DeviceComponentDetailsApplicationDetails) UnmarshalJSON(data []byte) error { - type unmarshaler DeviceComponentDetailsApplicationDetails +func (i *InventoryCountUpdatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler InventoryCountUpdatedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeviceComponentDetailsApplicationDetails(value) + *i = InventoryCountUpdatedEventObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - d.extraProperties = extraProperties + i.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (d *DeviceComponentDetailsApplicationDetails) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (i *InventoryCountUpdatedEventObject) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", i) } -type DeviceComponentDetailsBatteryDetails struct { - // The battery charge percentage as displayed on the device. - VisiblePercent *int `json:"visible_percent,omitempty" url:"visible_percent,omitempty"` - // The status of external_power. - // See [ExternalPower](#type-externalpower) for possible values - ExternalPower *DeviceComponentDetailsExternalPower `json:"external_power,omitempty" url:"external_power,omitempty"` +// Represents the quantity of an item variation that is physically present +// at a specific location, verified by a seller or a seller's employee. For example, +// a physical count might come from an employee counting the item variations on +// hand or from syncing with an external system. +type InventoryPhysicalCount struct { + // A unique Square-generated ID for the + // [InventoryPhysicalCount](entity:InventoryPhysicalCount). + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An optional ID provided by the application to tie the + // [InventoryPhysicalCount](entity:InventoryPhysicalCount) to an external + // system. + ReferenceID *string `json:"reference_id,omitempty" url:"reference_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 current [inventory state](entity:InventoryState) for the related + // quantity of items. It is replaced by the `state` field. + // See [InventoryState](#type-inventorystate) for possible values + Status *InventoryState `json:"status,omitempty" url:"status,omitempty"` + // The current [inventory state](entity:InventoryState) for the related + // quantity of items. + // See [InventoryState](#type-inventorystate) for possible values + State *InventoryState `json:"state,omitempty" url:"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 number of items affected by the physical count as a decimal string. + // The number can support up to 5 digits after the decimal point. + Quantity *string `json:"quantity,omitempty" url:"quantity,omitempty"` + // Information about the application with which the + // physical count is submitted. + Source *SourceApplication `json:"source,omitempty" url:"source,omitempty"` + // The Square-generated ID of the [Employee](entity:Employee) responsible for the + // physical count. + EmployeeID *string `json:"employee_id,omitempty" url:"employee_id,omitempty"` + // The Square-generated ID of the [Team Member](entity:TeamMember) responsible for the + // physical count. + TeamMemberID *string `json:"team_member_id,omitempty" url:"team_member_id,omitempty"` + // A client-generated RFC 3339-formatted timestamp that indicates when + // the physical count was examined. For physical count 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 physical count is received. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeviceComponentDetailsBatteryDetails) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (i *InventoryPhysicalCount) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (d *DeviceComponentDetailsBatteryDetails) UnmarshalJSON(data []byte) error { - type unmarshaler DeviceComponentDetailsBatteryDetails +func (i *InventoryPhysicalCount) UnmarshalJSON(data []byte) error { + type unmarshaler InventoryPhysicalCount var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeviceComponentDetailsBatteryDetails(value) + *i = InventoryPhysicalCount(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - d.extraProperties = extraProperties + i.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (d *DeviceComponentDetailsBatteryDetails) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (i *InventoryPhysicalCount) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", i) } -type DeviceComponentDetailsCardReaderDetails struct { - // The version of the card reader. - Version *string `json:"version,omitempty" url:"version,omitempty"` +// Indicates the state of a tracked item quantity in the lifecycle of goods. +type InventoryState string + +const ( + InventoryStateInventoryStateDoNotUse InventoryState = "INVENTORY_STATE_DO_NOT_USE" + InventoryStateCustom InventoryState = "CUSTOM" + InventoryStateInStock InventoryState = "IN_STOCK" + InventoryStateSold InventoryState = "SOLD" + InventoryStateReturnedByCustomer InventoryState = "RETURNED_BY_CUSTOMER" + InventoryStateReservedForSale InventoryState = "RESERVED_FOR_SALE" + InventoryStateSoldOnline InventoryState = "SOLD_ONLINE" + InventoryStateOrderedFromVendor InventoryState = "ORDERED_FROM_VENDOR" + InventoryStateReceivedFromVendor InventoryState = "RECEIVED_FROM_VENDOR" + InventoryStateInTransitTo InventoryState = "IN_TRANSIT_TO" + InventoryStateNone InventoryState = "NONE" + InventoryStateWaste InventoryState = "WASTE" + InventoryStateUnlinkedReturn InventoryState = "UNLINKED_RETURN" + InventoryStateComposed InventoryState = "COMPOSED" + InventoryStateDecomposed InventoryState = "DECOMPOSED" + InventoryStateSupportedByNewerVersion InventoryState = "SUPPORTED_BY_NEWER_VERSION" + InventoryStateInTransit InventoryState = "IN_TRANSIT" +) + +func NewInventoryStateFromString(s string) (InventoryState, error) { + switch s { + case "INVENTORY_STATE_DO_NOT_USE": + return InventoryStateInventoryStateDoNotUse, nil + case "CUSTOM": + return InventoryStateCustom, nil + case "IN_STOCK": + return InventoryStateInStock, nil + case "SOLD": + return InventoryStateSold, nil + case "RETURNED_BY_CUSTOMER": + return InventoryStateReturnedByCustomer, nil + case "RESERVED_FOR_SALE": + return InventoryStateReservedForSale, nil + case "SOLD_ONLINE": + return InventoryStateSoldOnline, nil + case "ORDERED_FROM_VENDOR": + return InventoryStateOrderedFromVendor, nil + case "RECEIVED_FROM_VENDOR": + return InventoryStateReceivedFromVendor, nil + case "IN_TRANSIT_TO": + return InventoryStateInTransitTo, nil + case "NONE": + return InventoryStateNone, nil + case "WASTE": + return InventoryStateWaste, nil + case "UNLINKED_RETURN": + return InventoryStateUnlinkedReturn, nil + case "COMPOSED": + return InventoryStateComposed, nil + case "DECOMPOSED": + return InventoryStateDecomposed, nil + case "SUPPORTED_BY_NEWER_VERSION": + return InventoryStateSupportedByNewerVersion, nil + case "IN_TRANSIT": + return InventoryStateInTransit, nil + } + var t InventoryState + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (i InventoryState) Ptr() *InventoryState { + return &i +} + +// Represents the transfer of a quantity of product inventory at a +// particular time from one location to another. +type InventoryTransfer struct { + // A unique ID generated by Square for the + // `InventoryTransfer`. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An optional ID provided by the application to tie the + // `InventoryTransfer` to an external system. + ReferenceID *string `json:"reference_id,omitempty" url:"reference_id,omitempty"` + // The [inventory state](entity:InventoryState) for the quantity of + // items being transferred. + // See [InventoryState](#type-inventorystate) for possible values + State *InventoryState `json:"state,omitempty" url:"state,omitempty"` + // The Square-generated ID of the [Location](entity:Location) where the related + // quantity of items was tracked before the transfer. + FromLocationID *string `json:"from_location_id,omitempty" url:"from_location_id,omitempty"` + // The Square-generated ID of the [Location](entity:Location) where the related + // quantity of items was tracked after the transfer. + ToLocationID *string `json:"to_location_id,omitempty" url:"to_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 transfer as a decimal string. + // Can support up to 5 digits after the decimal point. + Quantity *string `json:"quantity,omitempty" url:"quantity,omitempty"` + // A client-generated RFC 3339-formatted timestamp that indicates when + // the transfer took place. For write actions, 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 Square + // received the transfer request. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Information about the application that initiated the + // inventory transfer. + Source *SourceApplication `json:"source,omitempty" url:"source,omitempty"` + // The Square-generated ID of the [Employee](entity:Employee) responsible for the + // inventory transfer. + EmployeeID *string `json:"employee_id,omitempty" url:"employee_id,omitempty"` + // The Square-generated ID of the [Team Member](entity:TeamMember) responsible for the + // inventory transfer. + TeamMemberID *string `json:"team_member_id,omitempty" url:"team_member_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeviceComponentDetailsCardReaderDetails) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (i *InventoryTransfer) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (d *DeviceComponentDetailsCardReaderDetails) UnmarshalJSON(data []byte) error { - type unmarshaler DeviceComponentDetailsCardReaderDetails +func (i *InventoryTransfer) UnmarshalJSON(data []byte) error { + type unmarshaler InventoryTransfer var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeviceComponentDetailsCardReaderDetails(value) + *i = InventoryTransfer(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - d.extraProperties = extraProperties + i.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (d *DeviceComponentDetailsCardReaderDetails) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (i *InventoryTransfer) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", i) } -type DeviceComponentDetailsEthernetDetails struct { - // A boolean to represent whether the Ethernet interface is currently active. - Active *bool `json:"active,omitempty" url:"active,omitempty"` - // The string representation of the device’s IPv4 address. - IPAddressV4 *string `json:"ip_address_v4,omitempty" url:"ip_address_v4,omitempty"` +// Stores information about an invoice. You use the Invoices API to create and manage +// invoices. For more information, see [Invoices API Overview](https://developer.squareup.com/docs/invoices-api/overview). +type Invoice struct { + // The Square-assigned ID of the invoice. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The Square-assigned version number, which is incremented each time an update is committed to the invoice. + Version *int `json:"version,omitempty" url:"version,omitempty"` + // The ID of the location that this invoice is associated with. + // + // If specified in a `CreateInvoice` request, the value must match the `location_id` of the associated order. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The ID of the [order](entity:Order) for which the invoice is created. + // This field is required when creating an invoice, and the order must be in the `OPEN` state. + // + // To view the line items and other information for the associated order, call the + // [RetrieveOrder](api-endpoint:Orders-RetrieveOrder) endpoint using the order ID. + OrderID *string `json:"order_id,omitempty" url:"order_id,omitempty"` + // The customer who receives the invoice. This customer data is displayed on the invoice and used by Square to deliver the invoice. + // + // This field is required to publish an invoice, and it must specify the `customer_id`. + PrimaryRecipient *InvoiceRecipient `json:"primary_recipient,omitempty" url:"primary_recipient,omitempty"` + // The payment schedule for the invoice, represented by one or more payment requests that + // define payment settings, such as amount due and due date. An invoice supports the following payment request combinations: + // + // - One balance + // - One deposit with one balance + // - 2–12 installments + // - One deposit with 2–12 installments + // + // This field is required when creating an invoice. It must contain at least one payment request. + // All payment requests for the invoice must equal the total order amount. For more information, see + // [Configuring payment requests](https://developer.squareup.com/docs/invoices-api/create-publish-invoices#payment-requests). + // + // Adding `INSTALLMENT` payment requests to an invoice requires an + // [Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription). + PaymentRequests []*InvoicePaymentRequest `json:"payment_requests,omitempty" url:"payment_requests,omitempty"` + // The delivery method that Square uses to send the invoice, reminders, and receipts to + // the customer. After the invoice is published, Square processes the invoice based on the delivery + // method and payment request settings, either immediately or on the `scheduled_at` date, if specified. + // For example, Square might send the invoice or receipt for an automatic payment. For invoices with + // automatic payments, this field must be set to `EMAIL`. + // + // One of the following is required when creating an invoice: + // + // - (Recommended) This `delivery_method` field. To configure an automatic payment, the + // `automatic_payment_source` field of the payment request is also required. + // - The deprecated `request_method` field of the payment request. Note that `invoice` + // objects returned in responses do not include `request_method`. + // See [InvoiceDeliveryMethod](#type-invoicedeliverymethod) for possible values + DeliveryMethod *InvoiceDeliveryMethod `json:"delivery_method,omitempty" url:"delivery_method,omitempty"` + // A user-friendly invoice number that is displayed on the invoice. The value is unique within a location. + // If not provided when creating an invoice, Square assigns a value. + // It increments from 1 and is padded with zeros making it 7 characters long + // (for example, 0000001 and 0000002). + InvoiceNumber *string `json:"invoice_number,omitempty" url:"invoice_number,omitempty"` + // The title of the invoice, which is displayed on the invoice. + Title *string `json:"title,omitempty" url:"title,omitempty"` + // The description of the invoice, which is displayed on the invoice. + Description *string `json:"description,omitempty" url:"description,omitempty"` + // The timestamp when the invoice is scheduled for processing, in RFC 3339 format. + // After the invoice is published, Square processes the invoice on the specified date, + // according to the delivery method and payment request settings. + // + // If the field is not set, Square processes the invoice immediately after it is published. + ScheduledAt *string `json:"scheduled_at,omitempty" url:"scheduled_at,omitempty"` + // The URL of the Square-hosted invoice page. + // After you publish the invoice using the `PublishInvoice` endpoint, Square hosts the invoice + // page and returns the page URL in the response. + PublicURL *string `json:"public_url,omitempty" url:"public_url,omitempty"` + // The current amount due for the invoice. In addition to the + // amount due on the next payment request, this includes any overdue payment amounts. + NextPaymentAmountMoney *Money `json:"next_payment_amount_money,omitempty" url:"next_payment_amount_money,omitempty"` + // The status of the invoice. + // See [InvoiceStatus](#type-invoicestatus) for possible values + Status *InvoiceStatus `json:"status,omitempty" url:"status,omitempty"` + // The time zone used to interpret calendar dates on the invoice, such as `due_date`. + // When an invoice is created, this field is set to the `timezone` specified for the seller + // location. The value cannot be changed. + // + // For example, a payment `due_date` of 2021-03-09 with a `timezone` of America/Los_Angeles + // becomes overdue at midnight on March 9 in America/Los_Angeles (which equals a UTC timestamp + // of 2021-03-10T08:00:00Z). + Timezone *string `json:"timezone,omitempty" url:"timezone,omitempty"` + // The timestamp when the invoice was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The timestamp when the invoice was last updated, in RFC 3339 format. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // The payment methods that customers can use to pay the invoice on the Square-hosted + // invoice page. This setting is independent of any automatic payment requests for the invoice. + // + // This field is required when creating an invoice and must set at least one payment method to `true`. + AcceptedPaymentMethods *InvoiceAcceptedPaymentMethods `json:"accepted_payment_methods,omitempty" url:"accepted_payment_methods,omitempty"` + // Additional seller-defined fields that are displayed on the invoice. For more information, see + // [Custom fields](https://developer.squareup.com/docs/invoices-api/overview#custom-fields). + // + // Adding custom fields to an invoice requires an + // [Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription). + // + // Max: 2 custom fields + CustomFields []*InvoiceCustomField `json:"custom_fields,omitempty" url:"custom_fields,omitempty"` + // The ID of the [subscription](entity:Subscription) associated with the invoice. + // This field is present only on subscription billing invoices. + SubscriptionID *string `json:"subscription_id,omitempty" url:"subscription_id,omitempty"` + // The date of the sale or the date that the service is rendered, in `YYYY-MM-DD` format. + // This field can be used to specify a past or future date which is displayed on the invoice. + SaleOrServiceDate *string `json:"sale_or_service_date,omitempty" url:"sale_or_service_date,omitempty"` + // **France only.** The payment terms and conditions that are displayed on the invoice. For more information, + // see [Payment conditions](https://developer.squareup.com/docs/invoices-api/overview#payment-conditions). + // + // For countries other than France, Square returns an `INVALID_REQUEST_ERROR` with a `BAD_REQUEST` code and + // "Payment conditions are not supported for this location's country" detail if this field is included in `CreateInvoice` or `UpdateInvoice` requests. + PaymentConditions *string `json:"payment_conditions,omitempty" url:"payment_conditions,omitempty"` + // Indicates whether to allow a customer to save a credit or debit card as a card on file or a bank transfer as a + // bank account on file. If `true`, Square displays a **Save my card on file** or **Save my bank on file** checkbox on the + // invoice payment page. Stored payment information can be used for future automatic payments. The default value is `false`. + StorePaymentMethodEnabled *bool `json:"store_payment_method_enabled,omitempty" url:"store_payment_method_enabled,omitempty"` + // Metadata about the attachments on the invoice. Invoice attachments are managed using the + // [CreateInvoiceAttachment](api-endpoint:Invoices-CreateInvoiceAttachment) and [DeleteInvoiceAttachment](api-endpoint:Invoices-DeleteInvoiceAttachment) endpoints. + Attachments []*InvoiceAttachment `json:"attachments,omitempty" url:"attachments,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeviceComponentDetailsEthernetDetails) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (i *Invoice) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (d *DeviceComponentDetailsEthernetDetails) UnmarshalJSON(data []byte) error { - type unmarshaler DeviceComponentDetailsEthernetDetails +func (i *Invoice) UnmarshalJSON(data []byte) error { + type unmarshaler Invoice var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeviceComponentDetailsEthernetDetails(value) + *i = Invoice(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - d.extraProperties = extraProperties + i.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (d *DeviceComponentDetailsEthernetDetails) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (i *Invoice) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", d) -} - -// An enum for ExternalPower. -type DeviceComponentDetailsExternalPower string - -const ( - DeviceComponentDetailsExternalPowerAvailableCharging DeviceComponentDetailsExternalPower = "AVAILABLE_CHARGING" - DeviceComponentDetailsExternalPowerAvailableNotInUse DeviceComponentDetailsExternalPower = "AVAILABLE_NOT_IN_USE" - DeviceComponentDetailsExternalPowerUnavailable DeviceComponentDetailsExternalPower = "UNAVAILABLE" - DeviceComponentDetailsExternalPowerAvailableInsufficient DeviceComponentDetailsExternalPower = "AVAILABLE_INSUFFICIENT" -) - -func NewDeviceComponentDetailsExternalPowerFromString(s string) (DeviceComponentDetailsExternalPower, error) { - switch s { - case "AVAILABLE_CHARGING": - return DeviceComponentDetailsExternalPowerAvailableCharging, nil - case "AVAILABLE_NOT_IN_USE": - return DeviceComponentDetailsExternalPowerAvailableNotInUse, nil - case "UNAVAILABLE": - return DeviceComponentDetailsExternalPowerUnavailable, nil - case "AVAILABLE_INSUFFICIENT": - return DeviceComponentDetailsExternalPowerAvailableInsufficient, nil - } - var t DeviceComponentDetailsExternalPower - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (d DeviceComponentDetailsExternalPower) Ptr() *DeviceComponentDetailsExternalPower { - return &d + return fmt.Sprintf("%#v", i) } -// A value qualified by unit of measure. -type DeviceComponentDetailsMeasurement struct { - Value *int `json:"value,omitempty" url:"value,omitempty"` +// The payment methods that customers can use to pay an [invoice](entity:Invoice) on the Square-hosted invoice payment page. +type InvoiceAcceptedPaymentMethods struct { + // Indicates whether credit card or debit card payments are accepted. The default value is `false`. + Card *bool `json:"card,omitempty" url:"card,omitempty"` + // Indicates whether Square gift card payments are accepted. The default value is `false`. + SquareGiftCard *bool `json:"square_gift_card,omitempty" url:"square_gift_card,omitempty"` + // Indicates whether ACH bank transfer payments are accepted. The default value is `false`. + BankAccount *bool `json:"bank_account,omitempty" url:"bank_account,omitempty"` + // Indicates whether Afterpay (also known as Clearpay) payments are accepted. The default value is `false`. + // + // This option is allowed only for invoices that have a single payment request of the `BALANCE` type. This payment method is + // supported if the seller account accepts Afterpay payments and the seller location is in a country where Afterpay + // invoice payments are supported. As a best practice, consider enabling an additional payment method when allowing + // `buy_now_pay_later` payments. For more information, including detailed requirements and processing limits, see + // [Buy Now Pay Later payments with Afterpay](https://developer.squareup.com/docs/invoices-api/overview#buy-now-pay-later). + BuyNowPayLater *bool `json:"buy_now_pay_later,omitempty" url:"buy_now_pay_later,omitempty"` + // Indicates whether Cash App payments are accepted. The default value is `false`. + // + // This payment method is supported only for seller [locations](entity:Location) in the United States. + CashAppPay *bool `json:"cash_app_pay,omitempty" url:"cash_app_pay,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeviceComponentDetailsMeasurement) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (i *InvoiceAcceptedPaymentMethods) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (d *DeviceComponentDetailsMeasurement) UnmarshalJSON(data []byte) error { - type unmarshaler DeviceComponentDetailsMeasurement +func (i *InvoiceAcceptedPaymentMethods) UnmarshalJSON(data []byte) error { + type unmarshaler InvoiceAcceptedPaymentMethods var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeviceComponentDetailsMeasurement(value) + *i = InvoiceAcceptedPaymentMethods(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - d.extraProperties = extraProperties + i.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (d *DeviceComponentDetailsMeasurement) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (i *InvoiceAcceptedPaymentMethods) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", i) } -type DeviceComponentDetailsNetworkInterfaceDetails struct { - // The string representation of the device’s IPv4 address. - IPAddressV4 *string `json:"ip_address_v4,omitempty" url:"ip_address_v4,omitempty"` +// Represents a file attached to an [invoice](entity:Invoice). +type InvoiceAttachment struct { + // The Square-assigned ID of the attachment. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The file name of the attachment, which is displayed on the invoice. + Filename *string `json:"filename,omitempty" url:"filename,omitempty"` + // The description of the attachment, which is displayed on the invoice. + // This field maps to the seller-defined **Message** field. + Description *string `json:"description,omitempty" url:"description,omitempty"` + // The file size of the attachment in bytes. + Filesize *int `json:"filesize,omitempty" url:"filesize,omitempty"` + // The MD5 hash that was generated from the file contents. + Hash *string `json:"hash,omitempty" url:"hash,omitempty"` + // The mime type of the attachment. + // The following mime types are supported: + // image/gif, image/jpeg, image/png, image/tiff, image/bmp, application/pdf. + MimeType *string `json:"mime_type,omitempty" url:"mime_type,omitempty"` + // The timestamp when the attachment was uploaded, in RFC 3339 format. + UploadedAt *string `json:"uploaded_at,omitempty" url:"uploaded_at,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeviceComponentDetailsNetworkInterfaceDetails) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (i *InvoiceAttachment) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (d *DeviceComponentDetailsNetworkInterfaceDetails) UnmarshalJSON(data []byte) error { - type unmarshaler DeviceComponentDetailsNetworkInterfaceDetails +func (i *InvoiceAttachment) UnmarshalJSON(data []byte) error { + type unmarshaler InvoiceAttachment var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeviceComponentDetailsNetworkInterfaceDetails(value) + *i = InvoiceAttachment(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - d.extraProperties = extraProperties + i.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (d *DeviceComponentDetailsNetworkInterfaceDetails) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (i *InvoiceAttachment) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", d) -} - -type DeviceComponentDetailsWiFiDetails struct { - // A boolean to represent whether the WiFI interface is currently active. - Active *bool `json:"active,omitempty" url:"active,omitempty"` - // The name of the connected WIFI network. - Ssid *string `json:"ssid,omitempty" url:"ssid,omitempty"` - // The string representation of the device’s IPv4 address. - IPAddressV4 *string `json:"ip_address_v4,omitempty" url:"ip_address_v4,omitempty"` - // The security protocol for a secure connection (e.g. WPA2). None provided if the connection - // is unsecured. - SecureConnection *string `json:"secure_connection,omitempty" url:"secure_connection,omitempty"` - // A representation of signal strength of the WIFI network connection. - SignalStrength *DeviceComponentDetailsMeasurement `json:"signal_strength,omitempty" url:"signal_strength,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage + return fmt.Sprintf("%#v", i) } -func (d *DeviceComponentDetailsWiFiDetails) GetExtraProperties() map[string]interface{} { - return d.extraProperties -} +// Indicates the automatic payment method for an [invoice payment request](entity:InvoicePaymentRequest). +type InvoiceAutomaticPaymentSource string -func (d *DeviceComponentDetailsWiFiDetails) UnmarshalJSON(data []byte) error { - type unmarshaler DeviceComponentDetailsWiFiDetails - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *d = DeviceComponentDetailsWiFiDetails(value) +const ( + InvoiceAutomaticPaymentSourceInvoiceAutomaticPaymentSourceDoNotUse InvoiceAutomaticPaymentSource = "INVOICE_AUTOMATIC_PAYMENT_SOURCE_DO_NOT_USE" + InvoiceAutomaticPaymentSourceNone InvoiceAutomaticPaymentSource = "NONE" + InvoiceAutomaticPaymentSourceCardOnFile InvoiceAutomaticPaymentSource = "CARD_ON_FILE" + InvoiceAutomaticPaymentSourceBankOnFile InvoiceAutomaticPaymentSource = "BANK_ON_FILE" +) - extraProperties, err := core.ExtractExtraProperties(data, *d) - if err != nil { - return err +func NewInvoiceAutomaticPaymentSourceFromString(s string) (InvoiceAutomaticPaymentSource, error) { + switch s { + case "INVOICE_AUTOMATIC_PAYMENT_SOURCE_DO_NOT_USE": + return InvoiceAutomaticPaymentSourceInvoiceAutomaticPaymentSourceDoNotUse, nil + case "NONE": + return InvoiceAutomaticPaymentSourceNone, nil + case "CARD_ON_FILE": + return InvoiceAutomaticPaymentSourceCardOnFile, nil + case "BANK_ON_FILE": + return InvoiceAutomaticPaymentSourceBankOnFile, nil } - d.extraProperties = extraProperties - - d._rawJSON = json.RawMessage(data) - return nil + var t InvoiceAutomaticPaymentSource + return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (d *DeviceComponentDetailsWiFiDetails) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(d); err == nil { - return value - } - return fmt.Sprintf("%#v", d) +func (i InvoiceAutomaticPaymentSource) Ptr() *InvoiceAutomaticPaymentSource { + return &i } -// Details about the device that took the payment. -type DeviceDetails struct { - // The Square-issued ID of the device. - DeviceID *string `json:"device_id,omitempty" url:"device_id,omitempty"` - // The Square-issued installation ID for the device. - DeviceInstallationID *string `json:"device_installation_id,omitempty" url:"device_installation_id,omitempty"` - // The name of the device set by the seller. - DeviceName *string `json:"device_name,omitempty" url:"device_name,omitempty"` +// Published when an [Invoice](entity:Invoice) is canceled. +type InvoiceCanceledEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents, `"invoice.canceled"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *InvoiceCanceledEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeviceDetails) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (i *InvoiceCanceledEvent) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (d *DeviceDetails) UnmarshalJSON(data []byte) error { - type unmarshaler DeviceDetails +func (i *InvoiceCanceledEvent) UnmarshalJSON(data []byte) error { + type unmarshaler InvoiceCanceledEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeviceDetails(value) + *i = InvoiceCanceledEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - d.extraProperties = extraProperties + i.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (d *DeviceDetails) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (i *InvoiceCanceledEvent) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", i) } -type DeviceMetadata struct { - // The Terminal’s remaining battery percentage, between 1-100. - BatteryPercentage *string `json:"battery_percentage,omitempty" url:"battery_percentage,omitempty"` - // The current charging state of the Terminal. - // Options: `CHARGING`, `NOT_CHARGING` - ChargingState *string `json:"charging_state,omitempty" url:"charging_state,omitempty"` - // The ID of the Square seller business location associated with the Terminal. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` - // The ID of the Square merchant account that is currently signed-in to the Terminal. - MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` - // The Terminal’s current network connection type. - // Options: `WIFI`, `ETHERNET` - NetworkConnectionType *string `json:"network_connection_type,omitempty" url:"network_connection_type,omitempty"` - // The country in which the Terminal is authorized to take payments. - PaymentRegion *string `json:"payment_region,omitempty" url:"payment_region,omitempty"` - // The unique identifier assigned to the Terminal, which can be found on the lower back - // of the device. - SerialNumber *string `json:"serial_number,omitempty" url:"serial_number,omitempty"` - // The current version of the Terminal’s operating system. - OsVersion *string `json:"os_version,omitempty" url:"os_version,omitempty"` - // The current version of the application running on the Terminal. - AppVersion *string `json:"app_version,omitempty" url:"app_version,omitempty"` - // The name of the Wi-Fi network to which the Terminal is connected. - WifiNetworkName *string `json:"wifi_network_name,omitempty" url:"wifi_network_name,omitempty"` - // The signal strength of the Wi-FI network connection. - // Options: `POOR`, `FAIR`, `GOOD`, `EXCELLENT` - WifiNetworkStrength *string `json:"wifi_network_strength,omitempty" url:"wifi_network_strength,omitempty"` - // The IP address of the Terminal. - IPAddress *string `json:"ip_address,omitempty" url:"ip_address,omitempty"` +type InvoiceCanceledEventData struct { + // Name of the affected object’s type, `"invoice"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the affected invoice. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the canceled invoice. + Object *InvoiceCanceledEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeviceMetadata) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (i *InvoiceCanceledEventData) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (d *DeviceMetadata) UnmarshalJSON(data []byte) error { - type unmarshaler DeviceMetadata +func (i *InvoiceCanceledEventData) UnmarshalJSON(data []byte) error { + type unmarshaler InvoiceCanceledEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeviceMetadata(value) + *i = InvoiceCanceledEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - d.extraProperties = extraProperties + i.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (d *DeviceMetadata) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (i *InvoiceCanceledEventData) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", i) } -type DeviceStatus struct { - // See [Category](#type-category) for possible values - Category *DeviceStatusCategory `json:"category,omitempty" url:"category,omitempty"` +type InvoiceCanceledEventObject struct { + // The related invoice. + Invoice *Invoice `json:"invoice,omitempty" url:"invoice,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DeviceStatus) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (i *InvoiceCanceledEventObject) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (d *DeviceStatus) UnmarshalJSON(data []byte) error { - type unmarshaler DeviceStatus +func (i *InvoiceCanceledEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler InvoiceCanceledEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeviceStatus(value) + *i = InvoiceCanceledEventObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - d.extraProperties = extraProperties + i.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (d *DeviceStatus) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (i *InvoiceCanceledEventObject) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", d) -} - -type DeviceStatusCategory string - -const ( - DeviceStatusCategoryAvailable DeviceStatusCategory = "AVAILABLE" - DeviceStatusCategoryNeedsAttention DeviceStatusCategory = "NEEDS_ATTENTION" - DeviceStatusCategoryOffline DeviceStatusCategory = "OFFLINE" -) - -func NewDeviceStatusCategoryFromString(s string) (DeviceStatusCategory, error) { - switch s { - case "AVAILABLE": - return DeviceStatusCategoryAvailable, nil - case "NEEDS_ATTENTION": - return DeviceStatusCategoryNeedsAttention, nil - case "OFFLINE": - return DeviceStatusCategoryOffline, nil - } - var t DeviceStatusCategory - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (d DeviceStatusCategory) Ptr() *DeviceStatusCategory { - return &d + return fmt.Sprintf("%#v", i) } -// Additional details about `WALLET` type payments. Contains only non-confidential information. -type DigitalWalletDetails struct { - // The status of the `WALLET` payment. The status can be `AUTHORIZED`, `CAPTURED`, `VOIDED`, or - // `FAILED`. - Status *string `json:"status,omitempty" url:"status,omitempty"` - // The brand used for the `WALLET` payment. The brand can be `CASH_APP`, `PAYPAY`, `ALIPAY`, - // `RAKUTEN_PAY`, `AU_PAY`, `D_BARAI`, `MERPAY`, `WECHAT_PAY` or `UNKNOWN`. - Brand *string `json:"brand,omitempty" url:"brand,omitempty"` - // Brand-specific details for payments with the `brand` of `CASH_APP`. - CashAppDetails *CashAppDetails `json:"cash_app_details,omitempty" url:"cash_app_details,omitempty"` +// Published when an [Invoice](entity:Invoice) is created. +type InvoiceCreatedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents, `"invoice.created"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *InvoiceCreatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DigitalWalletDetails) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (i *InvoiceCreatedEvent) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (d *DigitalWalletDetails) UnmarshalJSON(data []byte) error { - type unmarshaler DigitalWalletDetails +func (i *InvoiceCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler InvoiceCreatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DigitalWalletDetails(value) + *i = InvoiceCreatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - d.extraProperties = extraProperties + i.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (d *DigitalWalletDetails) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (i *InvoiceCreatedEvent) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", i) } -// Disables the card, preventing any further updates or charges. Disabling -// an already disabled card is allowed but has no effect. Accessible via -// HTTP requests at POST https://connect.squareup.com/v2/cards/{card_id}/disable -type DisableCardRequest struct { +type InvoiceCreatedEventData struct { + // Name of the affected object’s type, `"invoice"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the affected invoice. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the created invoice. + Object *InvoiceCreatedEventObject `json:"object,omitempty" url:"object,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DisableCardRequest) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (i *InvoiceCreatedEventData) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (d *DisableCardRequest) UnmarshalJSON(data []byte) error { - type unmarshaler DisableCardRequest +func (i *InvoiceCreatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler InvoiceCreatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DisableCardRequest(value) + *i = InvoiceCreatedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - d.extraProperties = extraProperties + i.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (d *DisableCardRequest) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (i *InvoiceCreatedEventData) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", i) } -// Defines the fields that are included in the response body of -// a request to the [DisableCard]($e/Cards/DisableCard) endpoint. -// -// Note: if there are errors processing the request, the card field will not be -// present. -type DisableCardResponse struct { - // Information on errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The retrieved card. - Card *Card `json:"card,omitempty" url:"card,omitempty"` +type InvoiceCreatedEventObject struct { + // The related invoice. + Invoice *Invoice `json:"invoice,omitempty" url:"invoice,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DisableCardResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (i *InvoiceCreatedEventObject) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (d *DisableCardResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DisableCardResponse +func (i *InvoiceCreatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler InvoiceCreatedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DisableCardResponse(value) + *i = InvoiceCreatedEventObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - d.extraProperties = extraProperties + i.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (d *DisableCardResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (i *InvoiceCreatedEventObject) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", i) } -// Disables [Event]($m/Event)s for your application. -type DisableEventsRequest struct { +// An additional seller-defined and customer-facing field to include on the invoice. For more information, +// see [Custom fields](https://developer.squareup.com/docs/invoices-api/overview#custom-fields). +// +// Adding custom fields to an invoice requires an +// [Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription). +type InvoiceCustomField struct { + // The label or title of the custom field. This field is required for a custom field. + Label *string `json:"label,omitempty" url:"label,omitempty"` + // The text of the custom field. If omitted, only the label is rendered. + Value *string `json:"value,omitempty" url:"value,omitempty"` + // The location of the custom field on the invoice. This field is required for a custom field. + // See [InvoiceCustomFieldPlacement](#type-invoicecustomfieldplacement) for possible values + Placement *InvoiceCustomFieldPlacement `json:"placement,omitempty" url:"placement,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DisableEventsRequest) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (i *InvoiceCustomField) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (d *DisableEventsRequest) UnmarshalJSON(data []byte) error { - type unmarshaler DisableEventsRequest +func (i *InvoiceCustomField) UnmarshalJSON(data []byte) error { + type unmarshaler InvoiceCustomField var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DisableEventsRequest(value) + *i = InvoiceCustomField(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - d.extraProperties = extraProperties + i.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (d *DisableEventsRequest) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (i *InvoiceCustomField) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", i) } -// Defines the fields that are included in the response body of -// a request to the [DisableEvents]($e/Events/DisableEvents) endpoint. -// -// Note: if there are errors processing the request, the events field will not be -// present. -type DisableEventsResponse struct { - // Information on errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Indicates where to render a custom field on the Square-hosted invoice page and in emailed or PDF +// copies of the invoice. +type InvoiceCustomFieldPlacement string + +const ( + InvoiceCustomFieldPlacementUnknownPlacementDoNotUse InvoiceCustomFieldPlacement = "UNKNOWN_PLACEMENT_DO_NOT_USE" + InvoiceCustomFieldPlacementAboveLineItems InvoiceCustomFieldPlacement = "ABOVE_LINE_ITEMS" + InvoiceCustomFieldPlacementBelowLineItems InvoiceCustomFieldPlacement = "BELOW_LINE_ITEMS" +) + +func NewInvoiceCustomFieldPlacementFromString(s string) (InvoiceCustomFieldPlacement, error) { + switch s { + case "UNKNOWN_PLACEMENT_DO_NOT_USE": + return InvoiceCustomFieldPlacementUnknownPlacementDoNotUse, nil + case "ABOVE_LINE_ITEMS": + return InvoiceCustomFieldPlacementAboveLineItems, nil + case "BELOW_LINE_ITEMS": + return InvoiceCustomFieldPlacementBelowLineItems, nil + } + var t InvoiceCustomFieldPlacement + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (i InvoiceCustomFieldPlacement) Ptr() *InvoiceCustomFieldPlacement { + return &i +} + +// Published when a draft [Invoice](entity:Invoice) is deleted. +type InvoiceDeletedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents, `"invoice.deleted"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *InvoiceDeletedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DisableEventsResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (i *InvoiceDeletedEvent) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (d *DisableEventsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DisableEventsResponse +func (i *InvoiceDeletedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler InvoiceDeletedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DisableEventsResponse(value) + *i = InvoiceDeletedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - d.extraProperties = extraProperties + i.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (d *DisableEventsResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (i *InvoiceDeletedEvent) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", i) } -type DismissTerminalActionRequest struct { +type InvoiceDeletedEventData struct { + // Name of the affected object’s type, `"invoice"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the affected invoice. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // Indicates that the invoice was deleted. + Deleted *bool `json:"deleted,omitempty" url:"deleted,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DismissTerminalActionRequest) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (i *InvoiceDeletedEventData) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (d *DismissTerminalActionRequest) UnmarshalJSON(data []byte) error { - type unmarshaler DismissTerminalActionRequest +func (i *InvoiceDeletedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler InvoiceDeletedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DismissTerminalActionRequest(value) + *i = InvoiceDeletedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - d.extraProperties = extraProperties + i.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (d *DismissTerminalActionRequest) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (i *InvoiceDeletedEventData) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", i) } -type DismissTerminalActionResponse struct { - // Information on errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // Current state of the action to be dismissed. - Action *TerminalAction `json:"action,omitempty" url:"action,omitempty"` +// Indicates how Square delivers the [invoice](entity:Invoice) to the customer. +type InvoiceDeliveryMethod string + +const ( + InvoiceDeliveryMethodInvoiceDeliveryMethodDoNotUse InvoiceDeliveryMethod = "INVOICE_DELIVERY_METHOD_DO_NOT_USE" + InvoiceDeliveryMethodEmail InvoiceDeliveryMethod = "EMAIL" + InvoiceDeliveryMethodShareManually InvoiceDeliveryMethod = "SHARE_MANUALLY" + InvoiceDeliveryMethodSms InvoiceDeliveryMethod = "SMS" +) + +func NewInvoiceDeliveryMethodFromString(s string) (InvoiceDeliveryMethod, error) { + switch s { + case "INVOICE_DELIVERY_METHOD_DO_NOT_USE": + return InvoiceDeliveryMethodInvoiceDeliveryMethodDoNotUse, nil + case "EMAIL": + return InvoiceDeliveryMethodEmail, nil + case "SHARE_MANUALLY": + return InvoiceDeliveryMethodShareManually, nil + case "SMS": + return InvoiceDeliveryMethodSms, nil + } + var t InvoiceDeliveryMethod + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (i InvoiceDeliveryMethod) Ptr() *InvoiceDeliveryMethod { + return &i +} + +// Describes query filters to apply. +type InvoiceFilter struct { + // Limits the search to the specified locations. A location is required. + // In the current implementation, only one location can be specified. + LocationIDs []string `json:"location_ids,omitempty" url:"location_ids,omitempty"` + // Limits the search to the specified customers, within the specified locations. + // Specifying a customer is optional. In the current implementation, + // a maximum of one customer can be specified. + CustomerIDs []string `json:"customer_ids,omitempty" url:"customer_ids,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DismissTerminalActionResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (i *InvoiceFilter) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (d *DismissTerminalActionResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DismissTerminalActionResponse +func (i *InvoiceFilter) UnmarshalJSON(data []byte) error { + type unmarshaler InvoiceFilter var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DismissTerminalActionResponse(value) + *i = InvoiceFilter(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - d.extraProperties = extraProperties + i.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (d *DismissTerminalActionResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (i *InvoiceFilter) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", i) } -type DismissTerminalCheckoutRequest struct { +// Published when a payment that is associated with an [invoice](entity:Invoice) is completed. +// For more information about invoice payments, see [Pay an invoice](https://developer.squareup.com/docs/invoices-api/pay-refund-invoices#pay-invoice). +type InvoicePaymentMadeEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents, `"invoice.payment_made"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *InvoicePaymentMadeEventData `json:"data,omitempty" url:"data,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DismissTerminalCheckoutRequest) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (i *InvoicePaymentMadeEvent) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (d *DismissTerminalCheckoutRequest) UnmarshalJSON(data []byte) error { - type unmarshaler DismissTerminalCheckoutRequest +func (i *InvoicePaymentMadeEvent) UnmarshalJSON(data []byte) error { + type unmarshaler InvoicePaymentMadeEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DismissTerminalCheckoutRequest(value) + *i = InvoicePaymentMadeEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - d.extraProperties = extraProperties + i.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (d *DismissTerminalCheckoutRequest) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (i *InvoicePaymentMadeEvent) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", i) } -type DismissTerminalCheckoutResponse struct { - // Information on errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // Current state of the checkout to be dismissed. - Checkout *TerminalCheckout `json:"checkout,omitempty" url:"checkout,omitempty"` +type InvoicePaymentMadeEventData struct { + // Name of the affected object’s type, `"invoice"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the affected invoice. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the invoice that was paid. + Object *InvoicePaymentMadeEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DismissTerminalCheckoutResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (i *InvoicePaymentMadeEventData) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (d *DismissTerminalCheckoutResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DismissTerminalCheckoutResponse +func (i *InvoicePaymentMadeEventData) UnmarshalJSON(data []byte) error { + type unmarshaler InvoicePaymentMadeEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DismissTerminalCheckoutResponse(value) + *i = InvoicePaymentMadeEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - d.extraProperties = extraProperties + i.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (d *DismissTerminalCheckoutResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (i *InvoicePaymentMadeEventData) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", i) } -type DismissTerminalRefundRequest struct { +type InvoicePaymentMadeEventObject struct { + // The related invoice. + Invoice *Invoice `json:"invoice,omitempty" url:"invoice,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DismissTerminalRefundRequest) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (i *InvoicePaymentMadeEventObject) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (d *DismissTerminalRefundRequest) UnmarshalJSON(data []byte) error { - type unmarshaler DismissTerminalRefundRequest +func (i *InvoicePaymentMadeEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler InvoicePaymentMadeEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DismissTerminalRefundRequest(value) + *i = InvoicePaymentMadeEventObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - d.extraProperties = extraProperties + i.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (d *DismissTerminalRefundRequest) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (i *InvoicePaymentMadeEventObject) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", i) } -type DismissTerminalRefundResponse struct { - // Information on errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // Current state of the refund to be dismissed. - Refund *TerminalRefund `json:"refund,omitempty" url:"refund,omitempty"` +// Describes a payment request reminder (automatic notification) that Square sends +// to the customer. You configure a reminder relative to the payment request +// `due_date`. +type InvoicePaymentReminder struct { + // A Square-assigned ID that uniquely identifies the reminder within the + // `InvoicePaymentRequest`. + UID *string `json:"uid,omitempty" url:"uid,omitempty"` + // The number of days before (a negative number) or after (a positive number) + // the payment request `due_date` when the reminder is sent. For example, -3 indicates that + // the reminder should be sent 3 days before the payment request `due_date`. + RelativeScheduledDays *int `json:"relative_scheduled_days,omitempty" url:"relative_scheduled_days,omitempty"` + // The reminder message. + Message *string `json:"message,omitempty" url:"message,omitempty"` + // The status of the reminder. + // See [InvoicePaymentReminderStatus](#type-invoicepaymentreminderstatus) for possible values + Status *InvoicePaymentReminderStatus `json:"status,omitempty" url:"status,omitempty"` + // If sent, the timestamp when the reminder was sent, in RFC 3339 format. + SentAt *string `json:"sent_at,omitempty" url:"sent_at,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DismissTerminalRefundResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (i *InvoicePaymentReminder) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (d *DismissTerminalRefundResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DismissTerminalRefundResponse +func (i *InvoicePaymentReminder) UnmarshalJSON(data []byte) error { + type unmarshaler InvoicePaymentReminder var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DismissTerminalRefundResponse(value) + *i = InvoicePaymentReminder(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - d.extraProperties = extraProperties + i.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (d *DismissTerminalRefundResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (i *InvoicePaymentReminder) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", i) } -// Represents a [dispute](https://developer.squareup.com/docs/disputes-api/overview) a cardholder initiated with their bank. -type Dispute struct { - // The unique ID for this `Dispute`, generated by Square. - DisputeID *string `json:"dispute_id,omitempty" url:"dispute_id,omitempty"` - // The unique ID for this `Dispute`, generated by Square. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The disputed amount, which can be less than the total transaction amount. - // For instance, if multiple items were purchased but the cardholder only initiates a dispute over some of the items. - AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` - // The reason why the cardholder initiated the dispute. - // See [DisputeReason](#type-disputereason) for possible values - Reason *DisputeReason `json:"reason,omitempty" url:"reason,omitempty"` - // The current state of this dispute. - // See [DisputeState](#type-disputestate) for possible values - State *DisputeState `json:"state,omitempty" url:"state,omitempty"` - // The deadline by which the seller must respond to the dispute, in [RFC 3339 format](https://developer.squareup.com/docs/build-basics/common-data-types/working-with-dates). - DueAt *string `json:"due_at,omitempty" url:"due_at,omitempty"` - // The payment challenged in this dispute. - DisputedPayment *DisputedPayment `json:"disputed_payment,omitempty" url:"disputed_payment,omitempty"` - // The IDs of the evidence associated with the dispute. - EvidenceIDs []string `json:"evidence_ids,omitempty" url:"evidence_ids,omitempty"` - // The card brand used in the disputed payment. - // See [CardBrand](#type-cardbrand) for possible values - CardBrand *CardBrand `json:"card_brand,omitempty" url:"card_brand,omitempty"` - // The timestamp when the dispute was created, in RFC 3339 format. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The timestamp when the dispute was last updated, in RFC 3339 format. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` - // The ID of the dispute in the card brand system, generated by the card brand. - BrandDisputeID *string `json:"brand_dispute_id,omitempty" url:"brand_dispute_id,omitempty"` - // The timestamp when the dispute was reported, in RFC 3339 format. - ReportedDate *string `json:"reported_date,omitempty" url:"reported_date,omitempty"` - // The timestamp when the dispute was reported, in RFC 3339 format. - ReportedAt *string `json:"reported_at,omitempty" url:"reported_at,omitempty"` - // The current version of the `Dispute`. - Version *int `json:"version,omitempty" url:"version,omitempty"` - // The ID of the location where the dispute originated. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` +// The status of a payment request reminder. +type InvoicePaymentReminderStatus string + +const ( + InvoicePaymentReminderStatusInvoicePaymentReminderStatusDoNotUse InvoicePaymentReminderStatus = "INVOICE_PAYMENT_REMINDER_STATUS_DO_NOT_USE" + InvoicePaymentReminderStatusPending InvoicePaymentReminderStatus = "PENDING" + InvoicePaymentReminderStatusNotApplicable InvoicePaymentReminderStatus = "NOT_APPLICABLE" + InvoicePaymentReminderStatusSent InvoicePaymentReminderStatus = "SENT" +) + +func NewInvoicePaymentReminderStatusFromString(s string) (InvoicePaymentReminderStatus, error) { + switch s { + case "INVOICE_PAYMENT_REMINDER_STATUS_DO_NOT_USE": + return InvoicePaymentReminderStatusInvoicePaymentReminderStatusDoNotUse, nil + case "PENDING": + return InvoicePaymentReminderStatusPending, nil + case "NOT_APPLICABLE": + return InvoicePaymentReminderStatusNotApplicable, nil + case "SENT": + return InvoicePaymentReminderStatusSent, nil + } + var t InvoicePaymentReminderStatus + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (i InvoicePaymentReminderStatus) Ptr() *InvoicePaymentReminderStatus { + return &i +} + +// Represents a payment request for an [invoice](entity:Invoice). Invoices can specify a maximum +// of 13 payment requests, with up to 12 `INSTALLMENT` request types. For more information, +// see [Configuring payment requests](https://developer.squareup.com/docs/invoices-api/create-publish-invoices#payment-requests). +// +// Adding `INSTALLMENT` payment requests to an invoice requires an +// [Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription). +type InvoicePaymentRequest struct { + // The Square-generated ID of the payment request in an [invoice](entity:Invoice). + UID *string `json:"uid,omitempty" url:"uid,omitempty"` + // Indicates how Square processes the payment request. DEPRECATED at version 2021-01-21. Replaced by the + // `Invoice.delivery_method` and `InvoicePaymentRequest.automatic_payment_source` fields. + // + // One of the following is required when creating an invoice: + // + // - (Recommended) The `delivery_method` field of the invoice. To configure an automatic payment, the + // `automatic_payment_source` field of the payment request is also required. + // - This `request_method` field. Note that `invoice` objects returned in responses do not include `request_method`. + // See [InvoiceRequestMethod](#type-invoicerequestmethod) for possible values + RequestMethod *InvoiceRequestMethod `json:"request_method,omitempty" url:"request_method,omitempty"` + // Identifies the payment request type. This type defines how the payment request amount is determined. + // This field is required to create a payment request. + // See [InvoiceRequestType](#type-invoicerequesttype) for possible values + RequestType *InvoiceRequestType `json:"request_type,omitempty" url:"request_type,omitempty"` + // The due date (in the invoice's time zone) for the payment request, in `YYYY-MM-DD` format. This field + // is required to create a payment request. If an `automatic_payment_source` is defined for the request, Square + // charges the payment source on this date. + // + // After this date, the invoice becomes overdue. For example, a payment `due_date` of 2021-03-09 with a `timezone` + // of America/Los_Angeles becomes overdue at midnight on March 9 in America/Los_Angeles (which equals a UTC + // timestamp of 2021-03-10T08:00:00Z). + DueDate *string `json:"due_date,omitempty" url:"due_date,omitempty"` + // If the payment request specifies `DEPOSIT` or `INSTALLMENT` as the `request_type`, + // this indicates the request amount. + // You cannot specify this when `request_type` is `BALANCE` or when the + // payment request includes the `percentage_requested` field. + FixedAmountRequestedMoney *Money `json:"fixed_amount_requested_money,omitempty" url:"fixed_amount_requested_money,omitempty"` + // Specifies the amount for the payment request in percentage: + // + // - When the payment `request_type` is `DEPOSIT`, it is the percentage of the order's total amount. + // - When the payment `request_type` is `INSTALLMENT`, it is the percentage of the order's total less + // the deposit, if requested. The sum of the `percentage_requested` in all installment + // payment requests must be equal to 100. + // + // You cannot specify this when the payment `request_type` is `BALANCE` or when the + // payment request specifies the `fixed_amount_requested_money` field. + PercentageRequested *string `json:"percentage_requested,omitempty" url:"percentage_requested,omitempty"` + // If set to true, the Square-hosted invoice page (the `public_url` field of the invoice) + // provides a place for the customer to pay a tip. + // + // This field is allowed only on the final payment request + // and the payment `request_type` must be `BALANCE` or `INSTALLMENT`. + TippingEnabled *bool `json:"tipping_enabled,omitempty" url:"tipping_enabled,omitempty"` + // The payment method for an automatic payment. + // + // The default value is `NONE`. + // See [InvoiceAutomaticPaymentSource](#type-invoiceautomaticpaymentsource) for possible values + AutomaticPaymentSource *InvoiceAutomaticPaymentSource `json:"automatic_payment_source,omitempty" url:"automatic_payment_source,omitempty"` + // The ID of the credit or debit card on file to charge for the payment request. To get the cards on file for a customer, + // call [ListCards](api-endpoint:Cards-ListCards) and include the `customer_id` of the invoice recipient. + CardID *string `json:"card_id,omitempty" url:"card_id,omitempty"` + // A list of one or more reminders to send for the payment request. + Reminders []*InvoicePaymentReminder `json:"reminders,omitempty" url:"reminders,omitempty"` + // The amount of the payment request, computed using the order amount and information from the various payment + // request fields (`request_type`, `fixed_amount_requested_money`, and `percentage_requested`). + ComputedAmountMoney *Money `json:"computed_amount_money,omitempty" url:"computed_amount_money,omitempty"` + // The amount of money already paid for the specific payment request. + // This amount might include a rounding adjustment if the most recent invoice payment + // was in cash in a currency that rounds cash payments (such as, `CAD` or `AUD`). + TotalCompletedAmountMoney *Money `json:"total_completed_amount_money,omitempty" url:"total_completed_amount_money,omitempty"` + // If the most recent payment was a cash payment + // in a currency that rounds cash payments (such as, `CAD` or `AUD`) and the payment + // is rounded from `computed_amount_money` in the payment request, then this + // field specifies the rounding adjustment applied. This amount + // might be negative. + RoundingAdjustmentIncludedMoney *Money `json:"rounding_adjustment_included_money,omitempty" url:"rounding_adjustment_included_money,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *Dispute) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (i *InvoicePaymentRequest) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (d *Dispute) UnmarshalJSON(data []byte) error { - type unmarshaler Dispute +func (i *InvoicePaymentRequest) UnmarshalJSON(data []byte) error { + type unmarshaler InvoicePaymentRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = Dispute(value) + *i = InvoicePaymentRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - d.extraProperties = extraProperties + i.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (d *Dispute) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (i *InvoicePaymentRequest) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", i) } -type DisputeEvidence struct { - // The Square-generated ID of the evidence. - EvidenceID *string `json:"evidence_id,omitempty" url:"evidence_id,omitempty"` - // The Square-generated ID of the evidence. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The ID of the dispute the evidence is associated with. - DisputeID *string `json:"dispute_id,omitempty" url:"dispute_id,omitempty"` - // Image, PDF, TXT - EvidenceFile *DisputeEvidenceFile `json:"evidence_file,omitempty" url:"evidence_file,omitempty"` - // Raw text - EvidenceText *string `json:"evidence_text,omitempty" url:"evidence_text,omitempty"` - // The time when the evidence was uploaded, in RFC 3339 format. - UploadedAt *string `json:"uploaded_at,omitempty" url:"uploaded_at,omitempty"` - // The type of the evidence. - // See [DisputeEvidenceType](#type-disputeevidencetype) for possible values - EvidenceType *DisputeEvidenceType `json:"evidence_type,omitempty" url:"evidence_type,omitempty"` +// Published when an [Invoice](entity:Invoice) transitions from a draft to a non-draft status. +type InvoicePublishedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents, `"invoice.published"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *InvoicePublishedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DisputeEvidence) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (i *InvoicePublishedEvent) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (d *DisputeEvidence) UnmarshalJSON(data []byte) error { - type unmarshaler DisputeEvidence +func (i *InvoicePublishedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler InvoicePublishedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DisputeEvidence(value) + *i = InvoicePublishedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - d.extraProperties = extraProperties + i.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (d *DisputeEvidence) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (i *InvoicePublishedEvent) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", i) } -// A file to be uploaded as dispute evidence. -type DisputeEvidenceFile struct { - // The file name including the file extension. For example: "receipt.tiff". - Filename *string `json:"filename,omitempty" url:"filename,omitempty"` - // Dispute evidence files must be application/pdf, image/heic, image/heif, image/jpeg, image/png, or image/tiff formats. - Filetype *string `json:"filetype,omitempty" url:"filetype,omitempty"` +type InvoicePublishedEventData struct { + // Name of the affected object’s type, `"invoice"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the affected invoice. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the published invoice. + Object *InvoicePublishedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DisputeEvidenceFile) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (i *InvoicePublishedEventData) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (d *DisputeEvidenceFile) UnmarshalJSON(data []byte) error { - type unmarshaler DisputeEvidenceFile +func (i *InvoicePublishedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler InvoicePublishedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DisputeEvidenceFile(value) + *i = InvoicePublishedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - d.extraProperties = extraProperties + i.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (d *DisputeEvidenceFile) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (i *InvoicePublishedEventData) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", d) + return fmt.Sprintf("%#v", i) } -// The type of the dispute evidence. -type DisputeEvidenceType string - -const ( - DisputeEvidenceTypeGenericEvidence DisputeEvidenceType = "GENERIC_EVIDENCE" - DisputeEvidenceTypeOnlineOrAppAccessLog DisputeEvidenceType = "ONLINE_OR_APP_ACCESS_LOG" - DisputeEvidenceTypeAuthorizationDocumentation DisputeEvidenceType = "AUTHORIZATION_DOCUMENTATION" - DisputeEvidenceTypeCancellationOrRefundDocumentation DisputeEvidenceType = "CANCELLATION_OR_REFUND_DOCUMENTATION" - DisputeEvidenceTypeCardholderCommunication DisputeEvidenceType = "CARDHOLDER_COMMUNICATION" - DisputeEvidenceTypeCardholderInformation DisputeEvidenceType = "CARDHOLDER_INFORMATION" - DisputeEvidenceTypePurchaseAcknowledgement DisputeEvidenceType = "PURCHASE_ACKNOWLEDGEMENT" - DisputeEvidenceTypeDuplicateChargeDocumentation DisputeEvidenceType = "DUPLICATE_CHARGE_DOCUMENTATION" - DisputeEvidenceTypeProductOrServiceDescription DisputeEvidenceType = "PRODUCT_OR_SERVICE_DESCRIPTION" - DisputeEvidenceTypeReceipt DisputeEvidenceType = "RECEIPT" - DisputeEvidenceTypeServiceReceivedDocumentation DisputeEvidenceType = "SERVICE_RECEIVED_DOCUMENTATION" - DisputeEvidenceTypeProofOfDeliveryDocumentation DisputeEvidenceType = "PROOF_OF_DELIVERY_DOCUMENTATION" - DisputeEvidenceTypeRelatedTransactionDocumentation DisputeEvidenceType = "RELATED_TRANSACTION_DOCUMENTATION" - DisputeEvidenceTypeRebuttalExplanation DisputeEvidenceType = "REBUTTAL_EXPLANATION" - DisputeEvidenceTypeTrackingNumber DisputeEvidenceType = "TRACKING_NUMBER" -) +type InvoicePublishedEventObject struct { + // The related invoice. + Invoice *Invoice `json:"invoice,omitempty" url:"invoice,omitempty"` -func NewDisputeEvidenceTypeFromString(s string) (DisputeEvidenceType, error) { - switch s { - case "GENERIC_EVIDENCE": - return DisputeEvidenceTypeGenericEvidence, nil - case "ONLINE_OR_APP_ACCESS_LOG": - return DisputeEvidenceTypeOnlineOrAppAccessLog, nil - case "AUTHORIZATION_DOCUMENTATION": - return DisputeEvidenceTypeAuthorizationDocumentation, nil - case "CANCELLATION_OR_REFUND_DOCUMENTATION": - return DisputeEvidenceTypeCancellationOrRefundDocumentation, nil - case "CARDHOLDER_COMMUNICATION": - return DisputeEvidenceTypeCardholderCommunication, nil - case "CARDHOLDER_INFORMATION": - return DisputeEvidenceTypeCardholderInformation, nil - case "PURCHASE_ACKNOWLEDGEMENT": - return DisputeEvidenceTypePurchaseAcknowledgement, nil - case "DUPLICATE_CHARGE_DOCUMENTATION": - return DisputeEvidenceTypeDuplicateChargeDocumentation, nil - case "PRODUCT_OR_SERVICE_DESCRIPTION": - return DisputeEvidenceTypeProductOrServiceDescription, nil - case "RECEIPT": - return DisputeEvidenceTypeReceipt, nil - case "SERVICE_RECEIVED_DOCUMENTATION": - return DisputeEvidenceTypeServiceReceivedDocumentation, nil - case "PROOF_OF_DELIVERY_DOCUMENTATION": - return DisputeEvidenceTypeProofOfDeliveryDocumentation, nil - case "RELATED_TRANSACTION_DOCUMENTATION": - return DisputeEvidenceTypeRelatedTransactionDocumentation, nil - case "REBUTTAL_EXPLANATION": - return DisputeEvidenceTypeRebuttalExplanation, nil - case "TRACKING_NUMBER": - return DisputeEvidenceTypeTrackingNumber, nil - } - var t DisputeEvidenceType - return "", fmt.Errorf("%s is not a valid %T", s, t) + extraProperties map[string]interface{} + _rawJSON json.RawMessage } -func (d DisputeEvidenceType) Ptr() *DisputeEvidenceType { - return &d +func (i *InvoicePublishedEventObject) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -// The list of possible reasons why a cardholder might initiate a -// dispute with their bank. -type DisputeReason string - -const ( - DisputeReasonAmountDiffers DisputeReason = "AMOUNT_DIFFERS" - DisputeReasonCancelled DisputeReason = "CANCELLED" - DisputeReasonDuplicate DisputeReason = "DUPLICATE" - DisputeReasonNoKnowledge DisputeReason = "NO_KNOWLEDGE" - DisputeReasonNotAsDescribed DisputeReason = "NOT_AS_DESCRIBED" - DisputeReasonNotReceived DisputeReason = "NOT_RECEIVED" - DisputeReasonPaidByOtherMeans DisputeReason = "PAID_BY_OTHER_MEANS" - DisputeReasonCustomerRequestsCredit DisputeReason = "CUSTOMER_REQUESTS_CREDIT" - DisputeReasonEmvLiabilityShift DisputeReason = "EMV_LIABILITY_SHIFT" -) +func (i *InvoicePublishedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler InvoicePublishedEventObject + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *i = InvoicePublishedEventObject(value) -func NewDisputeReasonFromString(s string) (DisputeReason, error) { - switch s { - case "AMOUNT_DIFFERS": - return DisputeReasonAmountDiffers, nil - case "CANCELLED": - return DisputeReasonCancelled, nil - case "DUPLICATE": - return DisputeReasonDuplicate, nil - case "NO_KNOWLEDGE": - return DisputeReasonNoKnowledge, nil - case "NOT_AS_DESCRIBED": - return DisputeReasonNotAsDescribed, nil - case "NOT_RECEIVED": - return DisputeReasonNotReceived, nil - case "PAID_BY_OTHER_MEANS": - return DisputeReasonPaidByOtherMeans, nil - case "CUSTOMER_REQUESTS_CREDIT": - return DisputeReasonCustomerRequestsCredit, nil - case "EMV_LIABILITY_SHIFT": - return DisputeReasonEmvLiabilityShift, nil + extraProperties, err := core.ExtractExtraProperties(data, *i) + if err != nil { + return err } - var t DisputeReason - return "", fmt.Errorf("%s is not a valid %T", s, t) -} + i.extraProperties = extraProperties -func (d DisputeReason) Ptr() *DisputeReason { - return &d + i._rawJSON = json.RawMessage(data) + return nil } -// The list of possible dispute states. -type DisputeState string - -const ( - DisputeStateInquiryEvidenceRequired DisputeState = "INQUIRY_EVIDENCE_REQUIRED" - DisputeStateInquiryProcessing DisputeState = "INQUIRY_PROCESSING" - DisputeStateInquiryClosed DisputeState = "INQUIRY_CLOSED" - DisputeStateEvidenceRequired DisputeState = "EVIDENCE_REQUIRED" - DisputeStateProcessing DisputeState = "PROCESSING" - DisputeStateWon DisputeState = "WON" - DisputeStateLost DisputeState = "LOST" - DisputeStateAccepted DisputeState = "ACCEPTED" -) - -func NewDisputeStateFromString(s string) (DisputeState, error) { - switch s { - case "INQUIRY_EVIDENCE_REQUIRED": - return DisputeStateInquiryEvidenceRequired, nil - case "INQUIRY_PROCESSING": - return DisputeStateInquiryProcessing, nil - case "INQUIRY_CLOSED": - return DisputeStateInquiryClosed, nil - case "EVIDENCE_REQUIRED": - return DisputeStateEvidenceRequired, nil - case "PROCESSING": - return DisputeStateProcessing, nil - case "WON": - return DisputeStateWon, nil - case "LOST": - return DisputeStateLost, nil - case "ACCEPTED": - return DisputeStateAccepted, nil +func (i *InvoicePublishedEventObject) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { + return value + } } - var t DisputeState - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (d DisputeState) Ptr() *DisputeState { - return &d + if value, err := core.StringifyJSON(i); err == nil { + return value + } + return fmt.Sprintf("%#v", i) } -// The payment the cardholder disputed. -type DisputedPayment struct { - // Square-generated unique ID of the payment being disputed. - PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` +// Describes query criteria for searching invoices. +type InvoiceQuery struct { + // Query filters to apply in searching invoices. + // For more information, see [Search for invoices](https://developer.squareup.com/docs/invoices-api/retrieve-list-search-invoices#search-invoices). + Filter *InvoiceFilter `json:"filter,omitempty" url:"filter,omitempty"` + // Describes the sort order for the search result. + Sort *InvoiceSort `json:"sort,omitempty" url:"sort,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (d *DisputedPayment) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (i *InvoiceQuery) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (d *DisputedPayment) UnmarshalJSON(data []byte) error { - type unmarshaler DisputedPayment +func (i *InvoiceQuery) UnmarshalJSON(data []byte) error { + type unmarshaler InvoiceQuery var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DisputedPayment(value) + *i = InvoiceQuery(value) - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - d.extraProperties = extraProperties + i.extraProperties = extraProperties - d._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (d *DisputedPayment) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (i *InvoiceQuery) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", d) -} - -// Determines item visibility in Ecom (Online Store) and Online Checkout. -type EcomVisibility string - -const ( - EcomVisibilityUnindexed EcomVisibility = "UNINDEXED" - EcomVisibilityUnavailable EcomVisibility = "UNAVAILABLE" - EcomVisibilityHidden EcomVisibility = "HIDDEN" - EcomVisibilityVisible EcomVisibility = "VISIBLE" -) - -func NewEcomVisibilityFromString(s string) (EcomVisibility, error) { - switch s { - case "UNINDEXED": - return EcomVisibilityUnindexed, nil - case "UNAVAILABLE": - return EcomVisibilityUnavailable, nil - case "HIDDEN": - return EcomVisibilityHidden, nil - case "VISIBLE": - return EcomVisibilityVisible, nil - } - var t EcomVisibility - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (e EcomVisibility) Ptr() *EcomVisibility { - return &e + return fmt.Sprintf("%#v", i) } -// An employee object that is used by the external API. +// Represents a snapshot of customer data. This object stores customer data that is displayed on the invoice +// and that Square uses to deliver the invoice. // -// DEPRECATED at version 2020-08-26. Replaced by [TeamMember](entity:TeamMember). -type Employee struct { - // UUID for this object. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The employee's first name. - FirstName *string `json:"first_name,omitempty" url:"first_name,omitempty"` - // The employee's last name. - LastName *string `json:"last_name,omitempty" url:"last_name,omitempty"` - // The employee's email address - Email *string `json:"email,omitempty" url:"email,omitempty"` - // The employee's phone number in E.164 format, i.e. "+12125554250" +// When you provide a customer ID for a draft invoice, Square retrieves the associated customer profile and populates +// the remaining `InvoiceRecipient` fields. You cannot update these fields after the invoice is published. +// Square updates the customer ID in response to a merge operation, but does not update other fields. +type InvoiceRecipient struct { + // The ID of the customer. This is the customer profile ID that + // you provide when creating a draft invoice. + CustomerID *string `json:"customer_id,omitempty" url:"customer_id,omitempty"` + // The recipient's given (that is, first) name. + GivenName *string `json:"given_name,omitempty" url:"given_name,omitempty"` + // The recipient's family (that is, last) name. + FamilyName *string `json:"family_name,omitempty" url:"family_name,omitempty"` + // The recipient's email address. + EmailAddress *string `json:"email_address,omitempty" url:"email_address,omitempty"` + // The recipient's physical address. + Address *Address `json:"address,omitempty" url:"address,omitempty"` + // The recipient's phone number. PhoneNumber *string `json:"phone_number,omitempty" url:"phone_number,omitempty"` - // A list of location IDs where this employee has access to. - LocationIDs []string `json:"location_ids,omitempty" url:"location_ids,omitempty"` - // Specifies the status of the employees being fetched. - // See [EmployeeStatus](#type-employeestatus) for possible values - Status *EmployeeStatus `json:"status,omitempty" url:"status,omitempty"` - // Whether this employee is the owner of the merchant. Each merchant - // has one owner employee, and that employee has full authority over - // the account. - IsOwner *bool `json:"is_owner,omitempty" url:"is_owner,omitempty"` - // A read-only timestamp in RFC 3339 format. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // A read-only timestamp in RFC 3339 format. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // The name of the recipient's company. + CompanyName *string `json:"company_name,omitempty" url:"company_name,omitempty"` + // The recipient's tax IDs. The country of the seller account determines whether this field + // is available for the customer. For more information, see [Invoice recipient tax IDs](https://developer.squareup.com/docs/invoices-api/overview#recipient-tax-ids). + TaxIDs *InvoiceRecipientTaxIDs `json:"tax_ids,omitempty" url:"tax_ids,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (e *Employee) GetExtraProperties() map[string]interface{} { - return e.extraProperties +func (i *InvoiceRecipient) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (e *Employee) UnmarshalJSON(data []byte) error { - type unmarshaler Employee +func (i *InvoiceRecipient) UnmarshalJSON(data []byte) error { + type unmarshaler InvoiceRecipient var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *e = Employee(value) + *i = InvoiceRecipient(value) - extraProperties, err := core.ExtractExtraProperties(data, *e) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - e.extraProperties = extraProperties + i.extraProperties = extraProperties - e._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (e *Employee) String() string { - if len(e._rawJSON) > 0 { - if value, err := core.StringifyJSON(e._rawJSON); err == nil { +func (i *InvoiceRecipient) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(e); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", e) -} - -// The status of the Employee being retrieved. -// -// DEPRECATED at version 2020-08-26. Replaced by [TeamMemberStatus](entity:TeamMemberStatus). -type EmployeeStatus string - -const ( - EmployeeStatusActive EmployeeStatus = "ACTIVE" - EmployeeStatusInactive EmployeeStatus = "INACTIVE" -) - -func NewEmployeeStatusFromString(s string) (EmployeeStatus, error) { - switch s { - case "ACTIVE": - return EmployeeStatusActive, nil - case "INACTIVE": - return EmployeeStatusInactive, nil - } - var t EmployeeStatus - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (e EmployeeStatus) Ptr() *EmployeeStatus { - return &e + return fmt.Sprintf("%#v", i) } -// The hourly wage rate that an employee earns on a `Shift` for doing the job specified by the `title` property of this object. Deprecated at version 2020-08-26. Use [TeamMemberWage](entity:TeamMemberWage). -type EmployeeWage struct { - // The UUID for this object. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The `Employee` that this wage is assigned to. - EmployeeID *string `json:"employee_id,omitempty" url:"employee_id,omitempty"` - // The job title that this wage relates to. - Title *string `json:"title,omitempty" url:"title,omitempty"` - // Can be a custom-set hourly wage or the calculated effective hourly - // wage based on the annual wage and hours worked per week. - HourlyRate *Money `json:"hourly_rate,omitempty" url:"hourly_rate,omitempty"` +// Represents the tax IDs for an invoice recipient. The country of the seller account determines +// whether the corresponding `tax_ids` field is available for the customer. For more information, +// see [Invoice recipient tax IDs](https://developer.squareup.com/docs/invoices-api/overview#recipient-tax-ids). +type InvoiceRecipientTaxIDs struct { + // The EU VAT identification number for the invoice recipient. For example, `IE3426675K`. + EuVat *string `json:"eu_vat,omitempty" url:"eu_vat,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (e *EmployeeWage) GetExtraProperties() map[string]interface{} { - return e.extraProperties +func (i *InvoiceRecipientTaxIDs) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (e *EmployeeWage) UnmarshalJSON(data []byte) error { - type unmarshaler EmployeeWage +func (i *InvoiceRecipientTaxIDs) UnmarshalJSON(data []byte) error { + type unmarshaler InvoiceRecipientTaxIDs var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *e = EmployeeWage(value) + *i = InvoiceRecipientTaxIDs(value) - extraProperties, err := core.ExtractExtraProperties(data, *e) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - e.extraProperties = extraProperties + i.extraProperties = extraProperties - e._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (e *EmployeeWage) String() string { - if len(e._rawJSON) > 0 { - if value, err := core.StringifyJSON(e._rawJSON); err == nil { +func (i *InvoiceRecipientTaxIDs) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(e); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", e) + return fmt.Sprintf("%#v", i) } -// Enables [Event]($m/Event)s for your application. -type EnableEventsRequest struct { +// Published when a refund is applied toward a payment of an [invoice](entity:Invoice). +// For more information about invoice refunds, see [Refund an invoice](https://developer.squareup.com/docs/invoices-api/pay-refund-invoices#refund-invoice). +type InvoiceRefundedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents, `"invoice.refunded"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *InvoiceRefundedEventData `json:"data,omitempty" url:"data,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (e *EnableEventsRequest) GetExtraProperties() map[string]interface{} { - return e.extraProperties +func (i *InvoiceRefundedEvent) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (e *EnableEventsRequest) UnmarshalJSON(data []byte) error { - type unmarshaler EnableEventsRequest +func (i *InvoiceRefundedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler InvoiceRefundedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *e = EnableEventsRequest(value) + *i = InvoiceRefundedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *e) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - e.extraProperties = extraProperties + i.extraProperties = extraProperties - e._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (e *EnableEventsRequest) String() string { - if len(e._rawJSON) > 0 { - if value, err := core.StringifyJSON(e._rawJSON); err == nil { +func (i *InvoiceRefundedEvent) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(e); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", e) + return fmt.Sprintf("%#v", i) } -// Defines the fields that are included in the response body of -// a request to the [EnableEvents]($e/Events/EnableEvents) endpoint. -// -// Note: if there are errors processing the request, the events field will not be -// present. -type EnableEventsResponse struct { - // Information on errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +type InvoiceRefundedEventData struct { + // Name of the affected object’s type, `"invoice"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the affected invoice. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the refunded invoice. + Object *InvoiceRefundedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (e *EnableEventsResponse) GetExtraProperties() map[string]interface{} { - return e.extraProperties +func (i *InvoiceRefundedEventData) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (e *EnableEventsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler EnableEventsResponse +func (i *InvoiceRefundedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler InvoiceRefundedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *e = EnableEventsResponse(value) + *i = InvoiceRefundedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *e) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - e.extraProperties = extraProperties + i.extraProperties = extraProperties - e._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (e *EnableEventsResponse) String() string { - if len(e._rawJSON) > 0 { - if value, err := core.StringifyJSON(e._rawJSON); err == nil { +func (i *InvoiceRefundedEventData) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(e); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", e) + return fmt.Sprintf("%#v", i) } -// Represents an error encountered during a request to the Connect API. -// -// See [Handling errors](https://developer.squareup.com/docs/build-basics/handling-errors) for more information. -type Error struct { - // The high-level category for the error. - // See [ErrorCategory](#type-errorcategory) for possible values - Category ErrorCategory `json:"category" url:"category"` - // The specific code of the error. - // See [ErrorCode](#type-errorcode) for possible values - Code ErrorCode `json:"code" url:"code"` - // A human-readable description of the error for debugging purposes. - Detail *string `json:"detail,omitempty" url:"detail,omitempty"` - // The name of the field provided in the original request (if any) that - // the error pertains to. - Field *string `json:"field,omitempty" url:"field,omitempty"` +type InvoiceRefundedEventObject struct { + // The related invoice. + Invoice *Invoice `json:"invoice,omitempty" url:"invoice,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (e *Error) GetExtraProperties() map[string]interface{} { - return e.extraProperties +func (i *InvoiceRefundedEventObject) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (e *Error) UnmarshalJSON(data []byte) error { - type unmarshaler Error +func (i *InvoiceRefundedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler InvoiceRefundedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *e = Error(value) + *i = InvoiceRefundedEventObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *e) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - e.extraProperties = extraProperties + i.extraProperties = extraProperties - e._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (e *Error) String() string { - if len(e._rawJSON) > 0 { - if value, err := core.StringifyJSON(e._rawJSON); err == nil { +func (i *InvoiceRefundedEventObject) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(e); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", e) + return fmt.Sprintf("%#v", i) } -// Indicates which high-level category of error has occurred during a -// request to the Connect API. -type ErrorCategory string +// Specifies the action for Square to take for processing the invoice. For example, +// email the invoice, charge a customer's card on file, or do nothing. DEPRECATED at +// version 2021-01-21. The corresponding `request_method` field is replaced by the +// `Invoice.delivery_method` and `InvoicePaymentRequest.automatic_payment_source` fields. +type InvoiceRequestMethod string const ( - ErrorCategoryAPIError ErrorCategory = "API_ERROR" - ErrorCategoryAuthenticationError ErrorCategory = "AUTHENTICATION_ERROR" - ErrorCategoryInvalidRequestError ErrorCategory = "INVALID_REQUEST_ERROR" - ErrorCategoryRateLimitError ErrorCategory = "RATE_LIMIT_ERROR" - ErrorCategoryPaymentMethodError ErrorCategory = "PAYMENT_METHOD_ERROR" - ErrorCategoryRefundError ErrorCategory = "REFUND_ERROR" - ErrorCategoryMerchantSubscriptionError ErrorCategory = "MERCHANT_SUBSCRIPTION_ERROR" - ErrorCategoryExternalVendorError ErrorCategory = "EXTERNAL_VENDOR_ERROR" + InvoiceRequestMethodInvoiceRequestMethodDoNotUse InvoiceRequestMethod = "INVOICE_REQUEST_METHOD_DO_NOT_USE" + InvoiceRequestMethodEmail InvoiceRequestMethod = "EMAIL" + InvoiceRequestMethodChargeCardOnFile InvoiceRequestMethod = "CHARGE_CARD_ON_FILE" + InvoiceRequestMethodShareManually InvoiceRequestMethod = "SHARE_MANUALLY" + InvoiceRequestMethodChargeBankOnFile InvoiceRequestMethod = "CHARGE_BANK_ON_FILE" + InvoiceRequestMethodSms InvoiceRequestMethod = "SMS" + InvoiceRequestMethodSmsChargeCardOnFile InvoiceRequestMethod = "SMS_CHARGE_CARD_ON_FILE" + InvoiceRequestMethodSmsChargeBankOnFile InvoiceRequestMethod = "SMS_CHARGE_BANK_ON_FILE" ) -func NewErrorCategoryFromString(s string) (ErrorCategory, error) { +func NewInvoiceRequestMethodFromString(s string) (InvoiceRequestMethod, error) { switch s { - case "API_ERROR": - return ErrorCategoryAPIError, nil - case "AUTHENTICATION_ERROR": - return ErrorCategoryAuthenticationError, nil - case "INVALID_REQUEST_ERROR": - return ErrorCategoryInvalidRequestError, nil - case "RATE_LIMIT_ERROR": - return ErrorCategoryRateLimitError, nil - case "PAYMENT_METHOD_ERROR": - return ErrorCategoryPaymentMethodError, nil - case "REFUND_ERROR": - return ErrorCategoryRefundError, nil - case "MERCHANT_SUBSCRIPTION_ERROR": - return ErrorCategoryMerchantSubscriptionError, nil - case "EXTERNAL_VENDOR_ERROR": - return ErrorCategoryExternalVendorError, nil + case "INVOICE_REQUEST_METHOD_DO_NOT_USE": + return InvoiceRequestMethodInvoiceRequestMethodDoNotUse, nil + case "EMAIL": + return InvoiceRequestMethodEmail, nil + case "CHARGE_CARD_ON_FILE": + return InvoiceRequestMethodChargeCardOnFile, nil + case "SHARE_MANUALLY": + return InvoiceRequestMethodShareManually, nil + case "CHARGE_BANK_ON_FILE": + return InvoiceRequestMethodChargeBankOnFile, nil + case "SMS": + return InvoiceRequestMethodSms, nil + case "SMS_CHARGE_CARD_ON_FILE": + return InvoiceRequestMethodSmsChargeCardOnFile, nil + case "SMS_CHARGE_BANK_ON_FILE": + return InvoiceRequestMethodSmsChargeBankOnFile, nil } - var t ErrorCategory + var t InvoiceRequestMethod return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (e ErrorCategory) Ptr() *ErrorCategory { - return &e +func (i InvoiceRequestMethod) Ptr() *InvoiceRequestMethod { + return &i } -// Indicates the specific error that occurred during a request to a -// Square API. -type ErrorCode string +// Indicates the type of the payment request. For more information, see +// [Configuring payment requests](https://developer.squareup.com/docs/invoices-api/create-publish-invoices#payment-requests). +type InvoiceRequestType string const ( - ErrorCodeInternalServerError ErrorCode = "INTERNAL_SERVER_ERROR" - ErrorCodeUnauthorized ErrorCode = "UNAUTHORIZED" - ErrorCodeAccessTokenExpired ErrorCode = "ACCESS_TOKEN_EXPIRED" - ErrorCodeAccessTokenRevoked ErrorCode = "ACCESS_TOKEN_REVOKED" - ErrorCodeClientDisabled ErrorCode = "CLIENT_DISABLED" - ErrorCodeForbidden ErrorCode = "FORBIDDEN" - ErrorCodeInsufficientScopes ErrorCode = "INSUFFICIENT_SCOPES" - ErrorCodeApplicationDisabled ErrorCode = "APPLICATION_DISABLED" - ErrorCodeV1Application ErrorCode = "V1_APPLICATION" - ErrorCodeV1AccessToken ErrorCode = "V1_ACCESS_TOKEN" - ErrorCodeCardProcessingNotEnabled ErrorCode = "CARD_PROCESSING_NOT_ENABLED" - ErrorCodeMerchantSubscriptionNotFound ErrorCode = "MERCHANT_SUBSCRIPTION_NOT_FOUND" - ErrorCodeBadRequest ErrorCode = "BAD_REQUEST" - ErrorCodeMissingRequiredParameter ErrorCode = "MISSING_REQUIRED_PARAMETER" - ErrorCodeIncorrectType ErrorCode = "INCORRECT_TYPE" - ErrorCodeInvalidTime ErrorCode = "INVALID_TIME" - ErrorCodeInvalidTimeRange ErrorCode = "INVALID_TIME_RANGE" - ErrorCodeInvalidValue ErrorCode = "INVALID_VALUE" - ErrorCodeInvalidCursor ErrorCode = "INVALID_CURSOR" - ErrorCodeUnknownQueryParameter ErrorCode = "UNKNOWN_QUERY_PARAMETER" - ErrorCodeConflictingParameters ErrorCode = "CONFLICTING_PARAMETERS" - ErrorCodeExpectedJSONBody ErrorCode = "EXPECTED_JSON_BODY" - ErrorCodeInvalidSortOrder ErrorCode = "INVALID_SORT_ORDER" - ErrorCodeValueRegexMismatch ErrorCode = "VALUE_REGEX_MISMATCH" - ErrorCodeValueTooShort ErrorCode = "VALUE_TOO_SHORT" - ErrorCodeValueTooLong ErrorCode = "VALUE_TOO_LONG" - ErrorCodeValueTooLow ErrorCode = "VALUE_TOO_LOW" - ErrorCodeValueTooHigh ErrorCode = "VALUE_TOO_HIGH" - ErrorCodeValueEmpty ErrorCode = "VALUE_EMPTY" - ErrorCodeArrayLengthTooLong ErrorCode = "ARRAY_LENGTH_TOO_LONG" - ErrorCodeArrayLengthTooShort ErrorCode = "ARRAY_LENGTH_TOO_SHORT" - ErrorCodeArrayEmpty ErrorCode = "ARRAY_EMPTY" - ErrorCodeExpectedBoolean ErrorCode = "EXPECTED_BOOLEAN" - ErrorCodeExpectedInteger ErrorCode = "EXPECTED_INTEGER" - ErrorCodeExpectedFloat ErrorCode = "EXPECTED_FLOAT" - ErrorCodeExpectedString ErrorCode = "EXPECTED_STRING" - ErrorCodeExpectedObject ErrorCode = "EXPECTED_OBJECT" - ErrorCodeExpectedArray ErrorCode = "EXPECTED_ARRAY" - ErrorCodeExpectedMap ErrorCode = "EXPECTED_MAP" - ErrorCodeExpectedBase64EncodedByteArray ErrorCode = "EXPECTED_BASE64_ENCODED_BYTE_ARRAY" - ErrorCodeInvalidArrayValue ErrorCode = "INVALID_ARRAY_VALUE" - ErrorCodeInvalidEnumValue ErrorCode = "INVALID_ENUM_VALUE" - ErrorCodeInvalidContentType ErrorCode = "INVALID_CONTENT_TYPE" - ErrorCodeInvalidFormValue ErrorCode = "INVALID_FORM_VALUE" - ErrorCodeCustomerNotFound ErrorCode = "CUSTOMER_NOT_FOUND" - ErrorCodeOneInstrumentExpected ErrorCode = "ONE_INSTRUMENT_EXPECTED" - ErrorCodeNoFieldsSet ErrorCode = "NO_FIELDS_SET" - ErrorCodeTooManyMapEntries ErrorCode = "TOO_MANY_MAP_ENTRIES" - ErrorCodeMapKeyLengthTooShort ErrorCode = "MAP_KEY_LENGTH_TOO_SHORT" - ErrorCodeMapKeyLengthTooLong ErrorCode = "MAP_KEY_LENGTH_TOO_LONG" - ErrorCodeCustomerMissingName ErrorCode = "CUSTOMER_MISSING_NAME" - ErrorCodeCustomerMissingEmail ErrorCode = "CUSTOMER_MISSING_EMAIL" - ErrorCodeInvalidPauseLength ErrorCode = "INVALID_PAUSE_LENGTH" - ErrorCodeInvalidDate ErrorCode = "INVALID_DATE" - ErrorCodeUnsupportedCountry ErrorCode = "UNSUPPORTED_COUNTRY" - ErrorCodeUnsupportedCurrency ErrorCode = "UNSUPPORTED_CURRENCY" - ErrorCodeAppleTtpPinToken ErrorCode = "APPLE_TTP_PIN_TOKEN" - ErrorCodeCardExpired ErrorCode = "CARD_EXPIRED" - ErrorCodeInvalidExpiration ErrorCode = "INVALID_EXPIRATION" - ErrorCodeInvalidExpirationYear ErrorCode = "INVALID_EXPIRATION_YEAR" - ErrorCodeInvalidExpirationDate ErrorCode = "INVALID_EXPIRATION_DATE" - ErrorCodeUnsupportedCardBrand ErrorCode = "UNSUPPORTED_CARD_BRAND" - ErrorCodeUnsupportedEntryMethod ErrorCode = "UNSUPPORTED_ENTRY_METHOD" - ErrorCodeInvalidEncryptedCard ErrorCode = "INVALID_ENCRYPTED_CARD" - ErrorCodeInvalidCard ErrorCode = "INVALID_CARD" - ErrorCodePaymentAmountMismatch ErrorCode = "PAYMENT_AMOUNT_MISMATCH" - ErrorCodeGenericDecline ErrorCode = "GENERIC_DECLINE" - ErrorCodeCvvFailure ErrorCode = "CVV_FAILURE" - ErrorCodeAddressVerificationFailure ErrorCode = "ADDRESS_VERIFICATION_FAILURE" - ErrorCodeInvalidAccount ErrorCode = "INVALID_ACCOUNT" - ErrorCodeCurrencyMismatch ErrorCode = "CURRENCY_MISMATCH" - ErrorCodeInsufficientFunds ErrorCode = "INSUFFICIENT_FUNDS" - ErrorCodeInsufficientPermissions ErrorCode = "INSUFFICIENT_PERMISSIONS" - ErrorCodeCardholderInsufficientPermissions ErrorCode = "CARDHOLDER_INSUFFICIENT_PERMISSIONS" - ErrorCodeInvalidLocation ErrorCode = "INVALID_LOCATION" - ErrorCodeTransactionLimit ErrorCode = "TRANSACTION_LIMIT" - ErrorCodeVoiceFailure ErrorCode = "VOICE_FAILURE" - ErrorCodePanFailure ErrorCode = "PAN_FAILURE" - ErrorCodeExpirationFailure ErrorCode = "EXPIRATION_FAILURE" - ErrorCodeCardNotSupported ErrorCode = "CARD_NOT_SUPPORTED" - ErrorCodeInvalidPin ErrorCode = "INVALID_PIN" - ErrorCodeMissingPin ErrorCode = "MISSING_PIN" - ErrorCodeMissingAccountType ErrorCode = "MISSING_ACCOUNT_TYPE" - ErrorCodeInvalidPostalCode ErrorCode = "INVALID_POSTAL_CODE" - ErrorCodeInvalidFees ErrorCode = "INVALID_FEES" - ErrorCodeManuallyEnteredPaymentNotSupported ErrorCode = "MANUALLY_ENTERED_PAYMENT_NOT_SUPPORTED" - ErrorCodePaymentLimitExceeded ErrorCode = "PAYMENT_LIMIT_EXCEEDED" - ErrorCodeGiftCardAvailableAmount ErrorCode = "GIFT_CARD_AVAILABLE_AMOUNT" - ErrorCodeAccountUnusable ErrorCode = "ACCOUNT_UNUSABLE" - ErrorCodeBuyerRefusedPayment ErrorCode = "BUYER_REFUSED_PAYMENT" - ErrorCodeDelayedTransactionExpired ErrorCode = "DELAYED_TRANSACTION_EXPIRED" - ErrorCodeDelayedTransactionCanceled ErrorCode = "DELAYED_TRANSACTION_CANCELED" - ErrorCodeDelayedTransactionCaptured ErrorCode = "DELAYED_TRANSACTION_CAPTURED" - ErrorCodeDelayedTransactionFailed ErrorCode = "DELAYED_TRANSACTION_FAILED" - ErrorCodeCardTokenExpired ErrorCode = "CARD_TOKEN_EXPIRED" - ErrorCodeCardTokenUsed ErrorCode = "CARD_TOKEN_USED" - ErrorCodeAmountTooHigh ErrorCode = "AMOUNT_TOO_HIGH" - ErrorCodeUnsupportedInstrumentType ErrorCode = "UNSUPPORTED_INSTRUMENT_TYPE" - ErrorCodeRefundAmountInvalid ErrorCode = "REFUND_AMOUNT_INVALID" - ErrorCodeRefundAlreadyPending ErrorCode = "REFUND_ALREADY_PENDING" - ErrorCodePaymentNotRefundable ErrorCode = "PAYMENT_NOT_REFUNDABLE" - ErrorCodeRefundDeclined ErrorCode = "REFUND_DECLINED" - ErrorCodeInsufficientPermissionsForRefund ErrorCode = "INSUFFICIENT_PERMISSIONS_FOR_REFUND" - ErrorCodeInvalidCardData ErrorCode = "INVALID_CARD_DATA" - ErrorCodeSourceUsed ErrorCode = "SOURCE_USED" - ErrorCodeSourceExpired ErrorCode = "SOURCE_EXPIRED" - ErrorCodeUnsupportedLoyaltyRewardTier ErrorCode = "UNSUPPORTED_LOYALTY_REWARD_TIER" - ErrorCodeLocationMismatch ErrorCode = "LOCATION_MISMATCH" - ErrorCodeIdempotencyKeyReused ErrorCode = "IDEMPOTENCY_KEY_REUSED" - ErrorCodeUnexpectedValue ErrorCode = "UNEXPECTED_VALUE" - ErrorCodeSandboxNotSupported ErrorCode = "SANDBOX_NOT_SUPPORTED" - ErrorCodeInvalidEmailAddress ErrorCode = "INVALID_EMAIL_ADDRESS" - ErrorCodeInvalidPhoneNumber ErrorCode = "INVALID_PHONE_NUMBER" - ErrorCodeCheckoutExpired ErrorCode = "CHECKOUT_EXPIRED" - ErrorCodeBadCertificate ErrorCode = "BAD_CERTIFICATE" - ErrorCodeInvalidSquareVersionFormat ErrorCode = "INVALID_SQUARE_VERSION_FORMAT" - ErrorCodeAPIVersionIncompatible ErrorCode = "API_VERSION_INCOMPATIBLE" - ErrorCodeCardPresenceRequired ErrorCode = "CARD_PRESENCE_REQUIRED" - ErrorCodeUnsupportedSourceType ErrorCode = "UNSUPPORTED_SOURCE_TYPE" - ErrorCodeCardMismatch ErrorCode = "CARD_MISMATCH" - ErrorCodePlaidError ErrorCode = "PLAID_ERROR" - ErrorCodePlaidErrorItemLoginRequired ErrorCode = "PLAID_ERROR_ITEM_LOGIN_REQUIRED" - ErrorCodePlaidErrorRateLimit ErrorCode = "PLAID_ERROR_RATE_LIMIT" - ErrorCodeCardDeclined ErrorCode = "CARD_DECLINED" - ErrorCodeVerifyCvvFailure ErrorCode = "VERIFY_CVV_FAILURE" - ErrorCodeVerifyAvsFailure ErrorCode = "VERIFY_AVS_FAILURE" - ErrorCodeCardDeclinedCallIssuer ErrorCode = "CARD_DECLINED_CALL_ISSUER" - ErrorCodeCardDeclinedVerificationRequired ErrorCode = "CARD_DECLINED_VERIFICATION_REQUIRED" - ErrorCodeBadExpiration ErrorCode = "BAD_EXPIRATION" - ErrorCodeChipInsertionRequired ErrorCode = "CHIP_INSERTION_REQUIRED" - ErrorCodeAllowablePinTriesExceeded ErrorCode = "ALLOWABLE_PIN_TRIES_EXCEEDED" - ErrorCodeReservationDeclined ErrorCode = "RESERVATION_DECLINED" - ErrorCodeUnknownBodyParameter ErrorCode = "UNKNOWN_BODY_PARAMETER" - ErrorCodeNotFound ErrorCode = "NOT_FOUND" - ErrorCodeApplePaymentProcessingCertificateHashNotFound ErrorCode = "APPLE_PAYMENT_PROCESSING_CERTIFICATE_HASH_NOT_FOUND" - ErrorCodeMethodNotAllowed ErrorCode = "METHOD_NOT_ALLOWED" - ErrorCodeNotAcceptable ErrorCode = "NOT_ACCEPTABLE" - ErrorCodeRequestTimeout ErrorCode = "REQUEST_TIMEOUT" - ErrorCodeConflict ErrorCode = "CONFLICT" - ErrorCodeGone ErrorCode = "GONE" - ErrorCodeRequestEntityTooLarge ErrorCode = "REQUEST_ENTITY_TOO_LARGE" - ErrorCodeUnsupportedMediaType ErrorCode = "UNSUPPORTED_MEDIA_TYPE" - ErrorCodeUnprocessableEntity ErrorCode = "UNPROCESSABLE_ENTITY" - ErrorCodeRateLimited ErrorCode = "RATE_LIMITED" - ErrorCodeNotImplemented ErrorCode = "NOT_IMPLEMENTED" - ErrorCodeBadGateway ErrorCode = "BAD_GATEWAY" - ErrorCodeServiceUnavailable ErrorCode = "SERVICE_UNAVAILABLE" - ErrorCodeTemporaryError ErrorCode = "TEMPORARY_ERROR" - ErrorCodeGatewayTimeout ErrorCode = "GATEWAY_TIMEOUT" + InvoiceRequestTypeInvoiceRequestTypeDoNotUse InvoiceRequestType = "INVOICE_REQUEST_TYPE_DO_NOT_USE" + InvoiceRequestTypeBalance InvoiceRequestType = "BALANCE" + InvoiceRequestTypeDeposit InvoiceRequestType = "DEPOSIT" + InvoiceRequestTypeInstallment InvoiceRequestType = "INSTALLMENT" ) -func NewErrorCodeFromString(s string) (ErrorCode, error) { +func NewInvoiceRequestTypeFromString(s string) (InvoiceRequestType, error) { switch s { - case "INTERNAL_SERVER_ERROR": - return ErrorCodeInternalServerError, nil - case "UNAUTHORIZED": - return ErrorCodeUnauthorized, nil - case "ACCESS_TOKEN_EXPIRED": - return ErrorCodeAccessTokenExpired, nil - case "ACCESS_TOKEN_REVOKED": - return ErrorCodeAccessTokenRevoked, nil - case "CLIENT_DISABLED": - return ErrorCodeClientDisabled, nil - case "FORBIDDEN": - return ErrorCodeForbidden, nil - case "INSUFFICIENT_SCOPES": - return ErrorCodeInsufficientScopes, nil - case "APPLICATION_DISABLED": - return ErrorCodeApplicationDisabled, nil - case "V1_APPLICATION": - return ErrorCodeV1Application, nil - case "V1_ACCESS_TOKEN": - return ErrorCodeV1AccessToken, nil - case "CARD_PROCESSING_NOT_ENABLED": - return ErrorCodeCardProcessingNotEnabled, nil - case "MERCHANT_SUBSCRIPTION_NOT_FOUND": - return ErrorCodeMerchantSubscriptionNotFound, nil - case "BAD_REQUEST": - return ErrorCodeBadRequest, nil - case "MISSING_REQUIRED_PARAMETER": - return ErrorCodeMissingRequiredParameter, nil - case "INCORRECT_TYPE": - return ErrorCodeIncorrectType, nil - case "INVALID_TIME": - return ErrorCodeInvalidTime, nil - case "INVALID_TIME_RANGE": - return ErrorCodeInvalidTimeRange, nil - case "INVALID_VALUE": - return ErrorCodeInvalidValue, nil - case "INVALID_CURSOR": - return ErrorCodeInvalidCursor, nil - case "UNKNOWN_QUERY_PARAMETER": - return ErrorCodeUnknownQueryParameter, nil - case "CONFLICTING_PARAMETERS": - return ErrorCodeConflictingParameters, nil - case "EXPECTED_JSON_BODY": - return ErrorCodeExpectedJSONBody, nil - case "INVALID_SORT_ORDER": - return ErrorCodeInvalidSortOrder, nil - case "VALUE_REGEX_MISMATCH": - return ErrorCodeValueRegexMismatch, nil - case "VALUE_TOO_SHORT": - return ErrorCodeValueTooShort, nil - case "VALUE_TOO_LONG": - return ErrorCodeValueTooLong, nil - case "VALUE_TOO_LOW": - return ErrorCodeValueTooLow, nil - case "VALUE_TOO_HIGH": - return ErrorCodeValueTooHigh, nil - case "VALUE_EMPTY": - return ErrorCodeValueEmpty, nil - case "ARRAY_LENGTH_TOO_LONG": - return ErrorCodeArrayLengthTooLong, nil - case "ARRAY_LENGTH_TOO_SHORT": - return ErrorCodeArrayLengthTooShort, nil - case "ARRAY_EMPTY": - return ErrorCodeArrayEmpty, nil - case "EXPECTED_BOOLEAN": - return ErrorCodeExpectedBoolean, nil - case "EXPECTED_INTEGER": - return ErrorCodeExpectedInteger, nil - case "EXPECTED_FLOAT": - return ErrorCodeExpectedFloat, nil - case "EXPECTED_STRING": - return ErrorCodeExpectedString, nil - case "EXPECTED_OBJECT": - return ErrorCodeExpectedObject, nil - case "EXPECTED_ARRAY": - return ErrorCodeExpectedArray, nil - case "EXPECTED_MAP": - return ErrorCodeExpectedMap, nil - case "EXPECTED_BASE64_ENCODED_BYTE_ARRAY": - return ErrorCodeExpectedBase64EncodedByteArray, nil - case "INVALID_ARRAY_VALUE": - return ErrorCodeInvalidArrayValue, nil - case "INVALID_ENUM_VALUE": - return ErrorCodeInvalidEnumValue, nil - case "INVALID_CONTENT_TYPE": - return ErrorCodeInvalidContentType, nil - case "INVALID_FORM_VALUE": - return ErrorCodeInvalidFormValue, nil - case "CUSTOMER_NOT_FOUND": - return ErrorCodeCustomerNotFound, nil - case "ONE_INSTRUMENT_EXPECTED": - return ErrorCodeOneInstrumentExpected, nil - case "NO_FIELDS_SET": - return ErrorCodeNoFieldsSet, nil - case "TOO_MANY_MAP_ENTRIES": - return ErrorCodeTooManyMapEntries, nil - case "MAP_KEY_LENGTH_TOO_SHORT": - return ErrorCodeMapKeyLengthTooShort, nil - case "MAP_KEY_LENGTH_TOO_LONG": - return ErrorCodeMapKeyLengthTooLong, nil - case "CUSTOMER_MISSING_NAME": - return ErrorCodeCustomerMissingName, nil - case "CUSTOMER_MISSING_EMAIL": - return ErrorCodeCustomerMissingEmail, nil - case "INVALID_PAUSE_LENGTH": - return ErrorCodeInvalidPauseLength, nil - case "INVALID_DATE": - return ErrorCodeInvalidDate, nil - case "UNSUPPORTED_COUNTRY": - return ErrorCodeUnsupportedCountry, nil - case "UNSUPPORTED_CURRENCY": - return ErrorCodeUnsupportedCurrency, nil - case "APPLE_TTP_PIN_TOKEN": - return ErrorCodeAppleTtpPinToken, nil - case "CARD_EXPIRED": - return ErrorCodeCardExpired, nil - case "INVALID_EXPIRATION": - return ErrorCodeInvalidExpiration, nil - case "INVALID_EXPIRATION_YEAR": - return ErrorCodeInvalidExpirationYear, nil - case "INVALID_EXPIRATION_DATE": - return ErrorCodeInvalidExpirationDate, nil - case "UNSUPPORTED_CARD_BRAND": - return ErrorCodeUnsupportedCardBrand, nil - case "UNSUPPORTED_ENTRY_METHOD": - return ErrorCodeUnsupportedEntryMethod, nil - case "INVALID_ENCRYPTED_CARD": - return ErrorCodeInvalidEncryptedCard, nil - case "INVALID_CARD": - return ErrorCodeInvalidCard, nil - case "PAYMENT_AMOUNT_MISMATCH": - return ErrorCodePaymentAmountMismatch, nil - case "GENERIC_DECLINE": - return ErrorCodeGenericDecline, nil - case "CVV_FAILURE": - return ErrorCodeCvvFailure, nil - case "ADDRESS_VERIFICATION_FAILURE": - return ErrorCodeAddressVerificationFailure, nil - case "INVALID_ACCOUNT": - return ErrorCodeInvalidAccount, nil - case "CURRENCY_MISMATCH": - return ErrorCodeCurrencyMismatch, nil - case "INSUFFICIENT_FUNDS": - return ErrorCodeInsufficientFunds, nil - case "INSUFFICIENT_PERMISSIONS": - return ErrorCodeInsufficientPermissions, nil - case "CARDHOLDER_INSUFFICIENT_PERMISSIONS": - return ErrorCodeCardholderInsufficientPermissions, nil - case "INVALID_LOCATION": - return ErrorCodeInvalidLocation, nil - case "TRANSACTION_LIMIT": - return ErrorCodeTransactionLimit, nil - case "VOICE_FAILURE": - return ErrorCodeVoiceFailure, nil - case "PAN_FAILURE": - return ErrorCodePanFailure, nil - case "EXPIRATION_FAILURE": - return ErrorCodeExpirationFailure, nil - case "CARD_NOT_SUPPORTED": - return ErrorCodeCardNotSupported, nil - case "INVALID_PIN": - return ErrorCodeInvalidPin, nil - case "MISSING_PIN": - return ErrorCodeMissingPin, nil - case "MISSING_ACCOUNT_TYPE": - return ErrorCodeMissingAccountType, nil - case "INVALID_POSTAL_CODE": - return ErrorCodeInvalidPostalCode, nil - case "INVALID_FEES": - return ErrorCodeInvalidFees, nil - case "MANUALLY_ENTERED_PAYMENT_NOT_SUPPORTED": - return ErrorCodeManuallyEnteredPaymentNotSupported, nil - case "PAYMENT_LIMIT_EXCEEDED": - return ErrorCodePaymentLimitExceeded, nil - case "GIFT_CARD_AVAILABLE_AMOUNT": - return ErrorCodeGiftCardAvailableAmount, nil - case "ACCOUNT_UNUSABLE": - return ErrorCodeAccountUnusable, nil - case "BUYER_REFUSED_PAYMENT": - return ErrorCodeBuyerRefusedPayment, nil - case "DELAYED_TRANSACTION_EXPIRED": - return ErrorCodeDelayedTransactionExpired, nil - case "DELAYED_TRANSACTION_CANCELED": - return ErrorCodeDelayedTransactionCanceled, nil - case "DELAYED_TRANSACTION_CAPTURED": - return ErrorCodeDelayedTransactionCaptured, nil - case "DELAYED_TRANSACTION_FAILED": - return ErrorCodeDelayedTransactionFailed, nil - case "CARD_TOKEN_EXPIRED": - return ErrorCodeCardTokenExpired, nil - case "CARD_TOKEN_USED": - return ErrorCodeCardTokenUsed, nil - case "AMOUNT_TOO_HIGH": - return ErrorCodeAmountTooHigh, nil - case "UNSUPPORTED_INSTRUMENT_TYPE": - return ErrorCodeUnsupportedInstrumentType, nil - case "REFUND_AMOUNT_INVALID": - return ErrorCodeRefundAmountInvalid, nil - case "REFUND_ALREADY_PENDING": - return ErrorCodeRefundAlreadyPending, nil - case "PAYMENT_NOT_REFUNDABLE": - return ErrorCodePaymentNotRefundable, nil - case "REFUND_DECLINED": - return ErrorCodeRefundDeclined, nil - case "INSUFFICIENT_PERMISSIONS_FOR_REFUND": - return ErrorCodeInsufficientPermissionsForRefund, nil - case "INVALID_CARD_DATA": - return ErrorCodeInvalidCardData, nil - case "SOURCE_USED": - return ErrorCodeSourceUsed, nil - case "SOURCE_EXPIRED": - return ErrorCodeSourceExpired, nil - case "UNSUPPORTED_LOYALTY_REWARD_TIER": - return ErrorCodeUnsupportedLoyaltyRewardTier, nil - case "LOCATION_MISMATCH": - return ErrorCodeLocationMismatch, nil - case "IDEMPOTENCY_KEY_REUSED": - return ErrorCodeIdempotencyKeyReused, nil - case "UNEXPECTED_VALUE": - return ErrorCodeUnexpectedValue, nil - case "SANDBOX_NOT_SUPPORTED": - return ErrorCodeSandboxNotSupported, nil - case "INVALID_EMAIL_ADDRESS": - return ErrorCodeInvalidEmailAddress, nil - case "INVALID_PHONE_NUMBER": - return ErrorCodeInvalidPhoneNumber, nil - case "CHECKOUT_EXPIRED": - return ErrorCodeCheckoutExpired, nil - case "BAD_CERTIFICATE": - return ErrorCodeBadCertificate, nil - case "INVALID_SQUARE_VERSION_FORMAT": - return ErrorCodeInvalidSquareVersionFormat, nil - case "API_VERSION_INCOMPATIBLE": - return ErrorCodeAPIVersionIncompatible, nil - case "CARD_PRESENCE_REQUIRED": - return ErrorCodeCardPresenceRequired, nil - case "UNSUPPORTED_SOURCE_TYPE": - return ErrorCodeUnsupportedSourceType, nil - case "CARD_MISMATCH": - return ErrorCodeCardMismatch, nil - case "PLAID_ERROR": - return ErrorCodePlaidError, nil - case "PLAID_ERROR_ITEM_LOGIN_REQUIRED": - return ErrorCodePlaidErrorItemLoginRequired, nil - case "PLAID_ERROR_RATE_LIMIT": - return ErrorCodePlaidErrorRateLimit, nil - case "CARD_DECLINED": - return ErrorCodeCardDeclined, nil - case "VERIFY_CVV_FAILURE": - return ErrorCodeVerifyCvvFailure, nil - case "VERIFY_AVS_FAILURE": - return ErrorCodeVerifyAvsFailure, nil - case "CARD_DECLINED_CALL_ISSUER": - return ErrorCodeCardDeclinedCallIssuer, nil - case "CARD_DECLINED_VERIFICATION_REQUIRED": - return ErrorCodeCardDeclinedVerificationRequired, nil - case "BAD_EXPIRATION": - return ErrorCodeBadExpiration, nil - case "CHIP_INSERTION_REQUIRED": - return ErrorCodeChipInsertionRequired, nil - case "ALLOWABLE_PIN_TRIES_EXCEEDED": - return ErrorCodeAllowablePinTriesExceeded, nil - case "RESERVATION_DECLINED": - return ErrorCodeReservationDeclined, nil - case "UNKNOWN_BODY_PARAMETER": - return ErrorCodeUnknownBodyParameter, nil - case "NOT_FOUND": - return ErrorCodeNotFound, nil - case "APPLE_PAYMENT_PROCESSING_CERTIFICATE_HASH_NOT_FOUND": - return ErrorCodeApplePaymentProcessingCertificateHashNotFound, nil - case "METHOD_NOT_ALLOWED": - return ErrorCodeMethodNotAllowed, nil - case "NOT_ACCEPTABLE": - return ErrorCodeNotAcceptable, nil - case "REQUEST_TIMEOUT": - return ErrorCodeRequestTimeout, nil - case "CONFLICT": - return ErrorCodeConflict, nil - case "GONE": - return ErrorCodeGone, nil - case "REQUEST_ENTITY_TOO_LARGE": - return ErrorCodeRequestEntityTooLarge, nil - case "UNSUPPORTED_MEDIA_TYPE": - return ErrorCodeUnsupportedMediaType, nil - case "UNPROCESSABLE_ENTITY": - return ErrorCodeUnprocessableEntity, nil - case "RATE_LIMITED": - return ErrorCodeRateLimited, nil - case "NOT_IMPLEMENTED": - return ErrorCodeNotImplemented, nil - case "BAD_GATEWAY": - return ErrorCodeBadGateway, nil - case "SERVICE_UNAVAILABLE": - return ErrorCodeServiceUnavailable, nil - case "TEMPORARY_ERROR": - return ErrorCodeTemporaryError, nil - case "GATEWAY_TIMEOUT": - return ErrorCodeGatewayTimeout, nil + case "INVOICE_REQUEST_TYPE_DO_NOT_USE": + return InvoiceRequestTypeInvoiceRequestTypeDoNotUse, nil + case "BALANCE": + return InvoiceRequestTypeBalance, nil + case "DEPOSIT": + return InvoiceRequestTypeDeposit, nil + case "INSTALLMENT": + return InvoiceRequestTypeInstallment, nil } - var t ErrorCode + var t InvoiceRequestType return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (e ErrorCode) Ptr() *ErrorCode { - return &e +func (i InvoiceRequestType) Ptr() *InvoiceRequestType { + return &i } -type Event struct { +// Published when an automatic scheduled payment for an [Invoice](entity:Invoice) has failed. +type InvoiceScheduledChargeFailedEvent struct { // The ID of the target merchant associated with the event. MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` - // The ID of the target location associated with the event. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` - // The type of event this represents. + // The type of event this represents, `"invoice.scheduled_charge_failed"`. Type *string `json:"type,omitempty" url:"type,omitempty"` // A unique ID for the event. EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` // Timestamp of when the event was created, in RFC 3339 format. CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The data associated with the event. - Data *EventData `json:"data,omitempty" url:"data,omitempty"` + // Data associated with the event. + Data *InvoiceScheduledChargeFailedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (e *Event) GetExtraProperties() map[string]interface{} { - return e.extraProperties +func (i *InvoiceScheduledChargeFailedEvent) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (e *Event) UnmarshalJSON(data []byte) error { - type unmarshaler Event +func (i *InvoiceScheduledChargeFailedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler InvoiceScheduledChargeFailedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *e = Event(value) + *i = InvoiceScheduledChargeFailedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *e) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - e.extraProperties = extraProperties + i.extraProperties = extraProperties - e._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (e *Event) String() string { - if len(e._rawJSON) > 0 { - if value, err := core.StringifyJSON(e._rawJSON); err == nil { +func (i *InvoiceScheduledChargeFailedEvent) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(e); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", e) + return fmt.Sprintf("%#v", i) } -type EventData struct { - // The name of the affected object’s type. +type InvoiceScheduledChargeFailedEventData struct { + // Name of the affected object’s type, `"invoice"`. Type *string `json:"type,omitempty" url:"type,omitempty"` - // The ID of the affected object. + // ID of the affected invoice. ID *string `json:"id,omitempty" url:"id,omitempty"` - // This is true if the affected object has been deleted; otherwise, it's absent. - Deleted *bool `json:"deleted,omitempty" url:"deleted,omitempty"` - // An object containing fields and values relevant to the event. It is absent if the affected object has been deleted. - Object map[string]interface{} `json:"object,omitempty" url:"object,omitempty"` + // An object containing the invoice that experienced the failed scheduled charge. + Object *InvoiceScheduledChargeFailedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (e *EventData) GetExtraProperties() map[string]interface{} { - return e.extraProperties +func (i *InvoiceScheduledChargeFailedEventData) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (e *EventData) UnmarshalJSON(data []byte) error { - type unmarshaler EventData +func (i *InvoiceScheduledChargeFailedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler InvoiceScheduledChargeFailedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *e = EventData(value) + *i = InvoiceScheduledChargeFailedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *e) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - e.extraProperties = extraProperties + i.extraProperties = extraProperties - e._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (e *EventData) String() string { - if len(e._rawJSON) > 0 { - if value, err := core.StringifyJSON(e._rawJSON); err == nil { +func (i *InvoiceScheduledChargeFailedEventData) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(e); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", e) + return fmt.Sprintf("%#v", i) } -// Contains metadata about a particular [Event]($m/Event). -type EventMetadata struct { - // A unique ID for the event. - EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` - // The API version of the event. This corresponds to the default API version of the developer application at the time when the event was created. - APIVersion *string `json:"api_version,omitempty" url:"api_version,omitempty"` +type InvoiceScheduledChargeFailedEventObject struct { + // The related invoice. + Invoice *Invoice `json:"invoice,omitempty" url:"invoice,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (e *EventMetadata) GetExtraProperties() map[string]interface{} { - return e.extraProperties +func (i *InvoiceScheduledChargeFailedEventObject) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (e *EventMetadata) UnmarshalJSON(data []byte) error { - type unmarshaler EventMetadata +func (i *InvoiceScheduledChargeFailedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler InvoiceScheduledChargeFailedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *e = EventMetadata(value) + *i = InvoiceScheduledChargeFailedEventObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *e) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - e.extraProperties = extraProperties + i.extraProperties = extraProperties - e._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (e *EventMetadata) String() string { - if len(e._rawJSON) > 0 { - if value, err := core.StringifyJSON(e._rawJSON); err == nil { +func (i *InvoiceScheduledChargeFailedEventObject) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(e); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", e) + return fmt.Sprintf("%#v", i) } -// Contains the metadata of a webhook event type. -type EventTypeMetadata struct { - // The event type. - EventType *string `json:"event_type,omitempty" url:"event_type,omitempty"` - // The API version at which the event type was introduced. - APIVersionIntroduced *string `json:"api_version_introduced,omitempty" url:"api_version_introduced,omitempty"` - // The release status of the event type. - ReleaseStatus *string `json:"release_status,omitempty" url:"release_status,omitempty"` - +// Identifies the sort field and sort order. +type InvoiceSort struct { + // The field to use for sorting. + // See [InvoiceSortField](#type-invoicesortfield) for possible values + Field InvoiceSortField `json:"field" url:"field"` + // The order to use for sorting the results. + // See [SortOrder](#type-sortorder) for possible values + Order *SortOrder `json:"order,omitempty" url:"order,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (e *EventTypeMetadata) GetExtraProperties() map[string]interface{} { - return e.extraProperties +func (i *InvoiceSort) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (e *EventTypeMetadata) UnmarshalJSON(data []byte) error { - type unmarshaler EventTypeMetadata +func (i *InvoiceSort) UnmarshalJSON(data []byte) error { + type unmarshaler InvoiceSort var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *e = EventTypeMetadata(value) + *i = InvoiceSort(value) - extraProperties, err := core.ExtractExtraProperties(data, *e) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - e.extraProperties = extraProperties + i.extraProperties = extraProperties - e._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (e *EventTypeMetadata) String() string { - if len(e._rawJSON) > 0 { - if value, err := core.StringifyJSON(e._rawJSON); err == nil { +func (i *InvoiceSort) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(e); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", e) + return fmt.Sprintf("%#v", i) } -// Indicates which products matched by a CatalogPricingRule -// will be excluded if the pricing rule uses an exclude set. -type ExcludeStrategy string +// The field to use for sorting. +type InvoiceSortField string const ( - ExcludeStrategyLeastExpensive ExcludeStrategy = "LEAST_EXPENSIVE" - ExcludeStrategyMostExpensive ExcludeStrategy = "MOST_EXPENSIVE" + InvoiceSortFieldInvoiceSortFieldDoNotUse InvoiceSortField = "INVOICE_SORT_FIELD_DO_NOT_USE" + InvoiceSortFieldInvoiceSortDate InvoiceSortField = "INVOICE_SORT_DATE" ) -func NewExcludeStrategyFromString(s string) (ExcludeStrategy, error) { +func NewInvoiceSortFieldFromString(s string) (InvoiceSortField, error) { switch s { - case "LEAST_EXPENSIVE": - return ExcludeStrategyLeastExpensive, nil - case "MOST_EXPENSIVE": - return ExcludeStrategyMostExpensive, nil + case "INVOICE_SORT_FIELD_DO_NOT_USE": + return InvoiceSortFieldInvoiceSortFieldDoNotUse, nil + case "INVOICE_SORT_DATE": + return InvoiceSortFieldInvoiceSortDate, nil } - var t ExcludeStrategy + var t InvoiceSortField return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (e ExcludeStrategy) Ptr() *ExcludeStrategy { - return &e -} - -// Stores details about an external payment. Contains only non-confidential information. -// For more information, see -// [Take External Payments](https://developer.squareup.com/docs/payments-api/take-payments/external-payments). -type ExternalPaymentDetails struct { - // The type of external payment the seller received. It can be one of the following: - // - // - CHECK - Paid using a physical check. - // - BANK_TRANSFER - Paid using external bank transfer. - // - OTHER_GIFT_CARD - Paid using a non-Square gift card. - // - CRYPTO - Paid using a crypto currency. - // - SQUARE_CASH - Paid using Square Cash App. - // - SOCIAL - Paid using peer-to-peer payment applications. - // - EXTERNAL - A third-party application gathered this payment outside of Square. - // - EMONEY - Paid using an E-money provider. - // - CARD - A credit or debit card that Square does not support. - // - STORED_BALANCE - Use for house accounts, store credit, and so forth. - // - FOOD_VOUCHER - Restaurant voucher provided by employers to employees to pay for meals - // - OTHER - A type not listed here. - Type string `json:"type" url:"type"` - // A description of the external payment source. For example, - // "Food Delivery Service". - Source string `json:"source" url:"source"` - // An ID to associate the payment to its originating source. - SourceID *string `json:"source_id,omitempty" url:"source_id,omitempty"` - // The fees paid to the source. The `amount_money` minus this field is - // the net amount seller receives. - SourceFeeMoney *Money `json:"source_fee_money,omitempty" url:"source_fee_money,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (i InvoiceSortField) Ptr() *InvoiceSortField { + return &i } -func (e *ExternalPaymentDetails) GetExtraProperties() map[string]interface{} { - return e.extraProperties -} +// Indicates the status of an invoice. +type InvoiceStatus string -func (e *ExternalPaymentDetails) UnmarshalJSON(data []byte) error { - type unmarshaler ExternalPaymentDetails - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *e = ExternalPaymentDetails(value) +const ( + InvoiceStatusInvoiceStatusDoNotUse InvoiceStatus = "INVOICE_STATUS_DO_NOT_USE" + InvoiceStatusDraft InvoiceStatus = "DRAFT" + InvoiceStatusUnpaid InvoiceStatus = "UNPAID" + InvoiceStatusScheduled InvoiceStatus = "SCHEDULED" + InvoiceStatusPartiallyPaid InvoiceStatus = "PARTIALLY_PAID" + InvoiceStatusPaid InvoiceStatus = "PAID" + InvoiceStatusPartiallyRefunded InvoiceStatus = "PARTIALLY_REFUNDED" + InvoiceStatusRefunded InvoiceStatus = "REFUNDED" + InvoiceStatusCanceled InvoiceStatus = "CANCELED" + InvoiceStatusFailed InvoiceStatus = "FAILED" + InvoiceStatusPaymentPending InvoiceStatus = "PAYMENT_PENDING" +) - extraProperties, err := core.ExtractExtraProperties(data, *e) - if err != nil { - return err +func NewInvoiceStatusFromString(s string) (InvoiceStatus, error) { + switch s { + case "INVOICE_STATUS_DO_NOT_USE": + return InvoiceStatusInvoiceStatusDoNotUse, nil + case "DRAFT": + return InvoiceStatusDraft, nil + case "UNPAID": + return InvoiceStatusUnpaid, nil + case "SCHEDULED": + return InvoiceStatusScheduled, nil + case "PARTIALLY_PAID": + return InvoiceStatusPartiallyPaid, nil + case "PAID": + return InvoiceStatusPaid, nil + case "PARTIALLY_REFUNDED": + return InvoiceStatusPartiallyRefunded, nil + case "REFUNDED": + return InvoiceStatusRefunded, nil + case "CANCELED": + return InvoiceStatusCanceled, nil + case "FAILED": + return InvoiceStatusFailed, nil + case "PAYMENT_PENDING": + return InvoiceStatusPaymentPending, nil } - e.extraProperties = extraProperties - - e._rawJSON = json.RawMessage(data) - return nil + var t InvoiceStatus + return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (e *ExternalPaymentDetails) String() string { - if len(e._rawJSON) > 0 { - if value, err := core.StringifyJSON(e._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(e); err == nil { - return value - } - return fmt.Sprintf("%#v", e) +func (i InvoiceStatus) Ptr() *InvoiceStatus { + return &i } -// A filter to select resources based on an exact field value. For any given -// value, the value can only be in one property. Depending on the field, either -// all properties can be set or only a subset will be available. -// -// Refer to the documentation of the field. -type FilterValue struct { - // A list of terms that must be present on the field of the resource. - All []string `json:"all,omitempty" url:"all,omitempty"` - // A list of terms where at least one of them must be present on the - // field of the resource. - Any []string `json:"any,omitempty" url:"any,omitempty"` - // A list of terms that must not be present on the field the resource - None []string `json:"none,omitempty" url:"none,omitempty"` +// Published when an [Invoice](entity:Invoice) is updated. +type InvoiceUpdatedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents, `"invoice.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *InvoiceUpdatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (f *FilterValue) GetExtraProperties() map[string]interface{} { - return f.extraProperties +func (i *InvoiceUpdatedEvent) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (f *FilterValue) UnmarshalJSON(data []byte) error { - type unmarshaler FilterValue +func (i *InvoiceUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler InvoiceUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *f = FilterValue(value) + *i = InvoiceUpdatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *f) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - f.extraProperties = extraProperties + i.extraProperties = extraProperties - f._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (f *FilterValue) String() string { - if len(f._rawJSON) > 0 { - if value, err := core.StringifyJSON(f._rawJSON); err == nil { +func (i *InvoiceUpdatedEvent) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(f); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", f) + return fmt.Sprintf("%#v", i) } -// Specifies a decimal number range. -type FloatNumberRange struct { - // A decimal value indicating where the range starts. - StartAt *string `json:"start_at,omitempty" url:"start_at,omitempty"` - // A decimal value indicating where the range ends. - EndAt *string `json:"end_at,omitempty" url:"end_at,omitempty"` +type InvoiceUpdatedEventData struct { + // Name of the affected object’s type, `"invoice"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the affected invoice. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the updated invoice. + Object *InvoiceUpdatedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (f *FloatNumberRange) GetExtraProperties() map[string]interface{} { - return f.extraProperties +func (i *InvoiceUpdatedEventData) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (f *FloatNumberRange) UnmarshalJSON(data []byte) error { - type unmarshaler FloatNumberRange +func (i *InvoiceUpdatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler InvoiceUpdatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *f = FloatNumberRange(value) + *i = InvoiceUpdatedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *f) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - f.extraProperties = extraProperties + i.extraProperties = extraProperties - f._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (f *FloatNumberRange) String() string { - if len(f._rawJSON) > 0 { - if value, err := core.StringifyJSON(f._rawJSON); err == nil { +func (i *InvoiceUpdatedEventData) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(f); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", f) + return fmt.Sprintf("%#v", i) } -// Contains details about how to fulfill this order. -// Orders can only be created with at most one fulfillment using the API. -// However, orders returned by the Orders API might contain multiple fulfillments because sellers can create multiple fulfillments using Square products such as Square Online. -type Fulfillment struct { - // A unique ID that identifies the fulfillment only within this order. - UID *string `json:"uid,omitempty" url:"uid,omitempty"` - // The type of the fulfillment. - // See [FulfillmentType](#type-fulfillmenttype) for possible values - Type *FulfillmentType `json:"type,omitempty" url:"type,omitempty"` - // The state of the fulfillment. - // See [FulfillmentState](#type-fulfillmentstate) for possible values - State *FulfillmentState `json:"state,omitempty" url:"state,omitempty"` - // Describes what order line items this fulfillment applies to. - // It can be `ALL` or `ENTRY_LIST` with a supplied list of fulfillment entries. - // See [FulfillmentFulfillmentLineItemApplication](#type-fulfillmentfulfillmentlineitemapplication) for possible values - LineItemApplication *FulfillmentFulfillmentLineItemApplication `json:"line_item_application,omitempty" url:"line_item_application,omitempty"` - // A list of entries pertaining to the fulfillment of an order. Each entry must reference - // a valid `uid` for an order line item in the `line_item_uid` field, as well as a `quantity` to - // fulfill. - // - // Multiple entries can reference the same line item `uid`, as long as the total quantity among - // all fulfillment entries referencing a single line item does not exceed the quantity of the - // order's line item itself. - // - // An order cannot be marked as `COMPLETED` before all fulfillments are `COMPLETED`, - // `CANCELED`, or `FAILED`. Fulfillments can be created and completed independently - // before order completion. - Entries []*FulfillmentFulfillmentEntry `json:"entries,omitempty" url:"entries,omitempty"` - // Application-defined data attached to this fulfillment. Metadata fields are intended - // to store descriptive references or associations with an entity in another system or store brief - // information about the object. Square does not process this field; it only stores and returns it - // in relevant API calls. Do not use metadata to store any sensitive information (such as personally - // identifiable information or card details). - // - // Keys written by applications must be 60 characters or less and must be in the character set - // `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed - // with a namespace, separated from the key with a ':' character. - // - // Values have a maximum length of 255 characters. - // - // An application can have up to 10 entries per metadata field. - // - // Entries written by applications are private and can only be read or modified by the same - // application. - // - // For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). - Metadata map[string]*string `json:"metadata,omitempty" url:"metadata,omitempty"` - // Contains details for a pickup fulfillment. These details are required when the fulfillment - // type is `PICKUP`. - PickupDetails *FulfillmentPickupDetails `json:"pickup_details,omitempty" url:"pickup_details,omitempty"` - // Contains details for a shipment fulfillment. These details are required when the fulfillment type - // is `SHIPMENT`. - // - // A shipment fulfillment's relationship to fulfillment `state`: - // `PROPOSED`: A shipment is requested. - // `RESERVED`: Fulfillment in progress. Shipment processing. - // `PREPARED`: Shipment packaged. Shipping label created. - // `COMPLETED`: Package has been shipped. - // `CANCELED`: Shipment has been canceled. - // `FAILED`: Shipment has failed. - ShipmentDetails *FulfillmentShipmentDetails `json:"shipment_details,omitempty" url:"shipment_details,omitempty"` - // Describes delivery details of an order fulfillment. - DeliveryDetails *FulfillmentDeliveryDetails `json:"delivery_details,omitempty" url:"delivery_details,omitempty"` +type InvoiceUpdatedEventObject struct { + // The related invoice. + Invoice *Invoice `json:"invoice,omitempty" url:"invoice,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (f *Fulfillment) GetExtraProperties() map[string]interface{} { - return f.extraProperties +func (i *InvoiceUpdatedEventObject) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (f *Fulfillment) UnmarshalJSON(data []byte) error { - type unmarshaler Fulfillment +func (i *InvoiceUpdatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler InvoiceUpdatedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *f = Fulfillment(value) + *i = InvoiceUpdatedEventObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *f) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - f.extraProperties = extraProperties + i.extraProperties = extraProperties - f._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (f *Fulfillment) String() string { - if len(f._rawJSON) > 0 { - if value, err := core.StringifyJSON(f._rawJSON); err == nil { +func (i *InvoiceUpdatedEventObject) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(f); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", f) + return fmt.Sprintf("%#v", i) } -// Describes delivery details of an order fulfillment. -type FulfillmentDeliveryDetails struct { - // The contact information for the person to receive the fulfillment. - Recipient *FulfillmentRecipient `json:"recipient,omitempty" url:"recipient,omitempty"` - // Indicates the fulfillment delivery schedule type. If `SCHEDULED`, then - // `deliver_at` is required. If `ASAP`, then `prep_time_duration` is required. The default is `SCHEDULED`. - // See [OrderFulfillmentDeliveryDetailsScheduleType](#type-orderfulfillmentdeliverydetailsscheduletype) for possible values - ScheduleType *FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType `json:"schedule_type,omitempty" url:"schedule_type,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when the fulfillment was placed. - // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - // - // Must be in RFC 3339 timestamp format, e.g., "2016-09-04T23:59:33.123Z". - PlacedAt *string `json:"placed_at,omitempty" url:"placed_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // that represents the start of the delivery period. - // When the fulfillment `schedule_type` is `ASAP`, the field is automatically - // set to the current time plus the `prep_time_duration`. - // Otherwise, the application can set this field while the fulfillment `state` is - // `PROPOSED`, `RESERVED`, or `PREPARED` (any time before the - // terminal state such as `COMPLETED`, `CANCELED`, and `FAILED`). - // - // The timestamp must be in RFC 3339 format - // (for example, "2016-09-04T23:59:33.123Z"). - DeliverAt *string `json:"deliver_at,omitempty" url:"deliver_at,omitempty"` - // The duration of time it takes to prepare and deliver this fulfillment. - // The duration must be in RFC 3339 format (for example, "P1W3D"). - PrepTimeDuration *string `json:"prep_time_duration,omitempty" url:"prep_time_duration,omitempty"` - // The time period after `deliver_at` in which to deliver the order. - // Applications can set this field when the fulfillment `state` is - // `PROPOSED`, `RESERVED`, or `PREPARED` (any time before the terminal state - // such as `COMPLETED`, `CANCELED`, and `FAILED`). +// Price and inventory alerting overrides for a `CatalogItemVariation` at a specific `Location`. +type ItemVariationLocationOverrides struct { + // The ID of the `Location`. This can include locations that are deactivated. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The price of the `CatalogItemVariation` at the given `Location`, or blank for variable pricing. + PriceMoney *Money `json:"price_money,omitempty" url:"price_money,omitempty"` + // The pricing type (fixed or variable) for the `CatalogItemVariation` at the given `Location`. + // See [CatalogPricingType](#type-catalogpricingtype) for possible values + PricingType *CatalogPricingType `json:"pricing_type,omitempty" url:"pricing_type,omitempty"` + // If `true`, inventory tracking is active for the `CatalogItemVariation` at this `Location`. + TrackInventory *bool `json:"track_inventory,omitempty" url:"track_inventory,omitempty"` + // Indicates whether the `CatalogItemVariation` displays an alert when its inventory + // quantity is less than or equal to its `inventory_alert_threshold`. + // See [InventoryAlertType](#type-inventoryalerttype) for possible values + InventoryAlertType *InventoryAlertType `json:"inventory_alert_type,omitempty" url:"inventory_alert_type,omitempty"` + // If the inventory quantity for the variation is less than or equal to this value and `inventory_alert_type` + // is `LOW_QUANTITY`, the variation displays an alert in the merchant dashboard. // - // The duration must be in RFC 3339 format (for example, "P1W3D"). - DeliveryWindowDuration *string `json:"delivery_window_duration,omitempty" url:"delivery_window_duration,omitempty"` - // Provides additional instructions about the delivery fulfillment. - // It is displayed in the Square Point of Sale application and set by the API. - Note *string `json:"note,omitempty" url:"note,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicates when the seller completed the fulfillment. - // This field is automatically set when fulfillment `state` changes to `COMPLETED`. - // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - CompletedAt *string `json:"completed_at,omitempty" url:"completed_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicates when the seller started processing the fulfillment. - // This field is automatically set when the fulfillment `state` changes to `RESERVED`. - // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - InProgressAt *string `json:"in_progress_at,omitempty" url:"in_progress_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when the fulfillment was rejected. This field is - // automatically set when the fulfillment `state` changes to `FAILED`. - // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - RejectedAt *string `json:"rejected_at,omitempty" url:"rejected_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when the seller marked the fulfillment as ready for - // courier pickup. This field is automatically set when the fulfillment `state` changes - // to PREPARED. - // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - ReadyAt *string `json:"ready_at,omitempty" url:"ready_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when the fulfillment was delivered to the recipient. - // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - DeliveredAt *string `json:"delivered_at,omitempty" url:"delivered_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when the fulfillment was canceled. This field is automatically - // set when the fulfillment `state` changes to `CANCELED`. + // This value is always an integer. + InventoryAlertThreshold *int64 `json:"inventory_alert_threshold,omitempty" url:"inventory_alert_threshold,omitempty"` + // Indicates whether the overridden item variation is sold out at the specified location. // - // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - CanceledAt *string `json:"canceled_at,omitempty" url:"canceled_at,omitempty"` - // The delivery cancellation reason. Max length: 100 characters. - CancelReason *string `json:"cancel_reason,omitempty" url:"cancel_reason,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when an order can be picked up by the courier for delivery. - // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - CourierPickupAt *string `json:"courier_pickup_at,omitempty" url:"courier_pickup_at,omitempty"` - // The time period after `courier_pickup_at` in which the courier should pick up the order. - // The duration must be in RFC 3339 format (for example, "P1W3D"). - CourierPickupWindowDuration *string `json:"courier_pickup_window_duration,omitempty" url:"courier_pickup_window_duration,omitempty"` - // Whether the delivery is preferred to be no contact. - IsNoContactDelivery *bool `json:"is_no_contact_delivery,omitempty" url:"is_no_contact_delivery,omitempty"` - // A note to provide additional instructions about how to deliver the order. - DropoffNotes *string `json:"dropoff_notes,omitempty" url:"dropoff_notes,omitempty"` - // The name of the courier provider. - CourierProviderName *string `json:"courier_provider_name,omitempty" url:"courier_provider_name,omitempty"` - // The support phone number of the courier. - CourierSupportPhoneNumber *string `json:"courier_support_phone_number,omitempty" url:"courier_support_phone_number,omitempty"` - // The identifier for the delivery created by Square. - SquareDeliveryID *string `json:"square_delivery_id,omitempty" url:"square_delivery_id,omitempty"` - // The identifier for the delivery created by the third-party courier service. - ExternalDeliveryID *string `json:"external_delivery_id,omitempty" url:"external_delivery_id,omitempty"` - // The flag to indicate the delivery is managed by a third party (ie DoorDash), which means - // we may not receive all recipient information for PII purposes. - ManagedDelivery *bool `json:"managed_delivery,omitempty" url:"managed_delivery,omitempty"` + // When inventory tracking is enabled on the item variation either globally or at the specified location, + // the item variation is automatically marked as sold out when its inventory count reaches zero. The seller + // can manually set the item variation as sold out even when the inventory count is greater than zero. + // Attempts by an application to set this attribute are ignored. Regardless how the sold-out status is set, + // applications should treat its inventory count as zero when this attribute value is `true`. + SoldOut *bool `json:"sold_out,omitempty" url:"sold_out,omitempty"` + // The seller-assigned timestamp, of the RFC 3339 format, to indicate when this sold-out variation + // becomes available again at the specified location. Attempts by an application to set this attribute are ignored. + // When the current time is later than this attribute value, the affected item variation is no longer sold out. + SoldOutValidUntil *string `json:"sold_out_valid_until,omitempty" url:"sold_out_valid_until,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (f *FulfillmentDeliveryDetails) GetExtraProperties() map[string]interface{} { - return f.extraProperties +func (i *ItemVariationLocationOverrides) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (f *FulfillmentDeliveryDetails) UnmarshalJSON(data []byte) error { - type unmarshaler FulfillmentDeliveryDetails +func (i *ItemVariationLocationOverrides) UnmarshalJSON(data []byte) error { + type unmarshaler ItemVariationLocationOverrides var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *f = FulfillmentDeliveryDetails(value) + *i = ItemVariationLocationOverrides(value) - extraProperties, err := core.ExtractExtraProperties(data, *f) + extraProperties, err := core.ExtractExtraProperties(data, *i) if err != nil { return err } - f.extraProperties = extraProperties + i.extraProperties = extraProperties - f._rawJSON = json.RawMessage(data) + i._rawJSON = json.RawMessage(data) return nil } -func (f *FulfillmentDeliveryDetails) String() string { - if len(f._rawJSON) > 0 { - if value, err := core.StringifyJSON(f._rawJSON); err == nil { +func (i *ItemVariationLocationOverrides) String() string { + if len(i._rawJSON) > 0 { + if value, err := core.StringifyJSON(i._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(f); err == nil { + if value, err := core.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", f) -} - -// The schedule type of the delivery fulfillment. -type FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType string - -const ( - FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleTypeScheduled FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType = "SCHEDULED" - FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleTypeAsap FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType = "ASAP" -) - -func NewFulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleTypeFromString(s string) (FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType, error) { - switch s { - case "SCHEDULED": - return FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleTypeScheduled, nil - case "ASAP": - return FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleTypeAsap, nil - } - var t FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (f FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType) Ptr() *FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType { - return &f + return fmt.Sprintf("%#v", i) } -// Links an order line item to a fulfillment. Each entry must reference -// a valid `uid` for an order line item in the `line_item_uid` field, as well as a `quantity` to -// fulfill. -type FulfillmentFulfillmentEntry struct { - // A unique ID that identifies the fulfillment entry only within this order. - UID *string `json:"uid,omitempty" url:"uid,omitempty"` - // The `uid` from the order line item. - LineItemUID string `json:"line_item_uid" url:"line_item_uid"` - // The quantity of the line item being fulfilled, formatted as a decimal number. - // For example, `"3"`. - // - // Fulfillments for line items with a `quantity_unit` can have non-integer quantities. - // For example, `"1.70000"`. - Quantity string `json:"quantity" url:"quantity"` - // Application-defined data attached to this fulfillment entry. Metadata fields are intended - // to store descriptive references or associations with an entity in another system or store brief - // information about the object. Square does not process this field; it only stores and returns it - // in relevant API calls. Do not use metadata to store any sensitive information (such as personally - // identifiable information or card details). - // - // Keys written by applications must be 60 characters or less and must be in the character set - // `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed - // with a namespace, separated from the key with a ':' character. - // - // Values have a maximum length of 255 characters. - // - // An application can have up to 10 entries per metadata field. - // - // Entries written by applications are private and can only be read or modified by the same - // application. - // - // For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). - Metadata map[string]*string `json:"metadata,omitempty" url:"metadata,omitempty"` +// An object describing a job that a team member is assigned to. +type JobAssignment struct { + // The title of the job. + JobTitle string `json:"job_title" url:"job_title"` + // The current pay type for the job assignment used to + // calculate the pay amount in a pay period. + // See [JobAssignmentPayType](#type-jobassignmentpaytype) for possible values + PayType JobAssignmentPayType `json:"pay_type" url:"pay_type"` + // The hourly pay rate of the job. + HourlyRate *Money `json:"hourly_rate,omitempty" url:"hourly_rate,omitempty"` + // The total pay amount for a 12-month period on the job. Set if the job `PayType` is `SALARY`. + AnnualRate *Money `json:"annual_rate,omitempty" url:"annual_rate,omitempty"` + // The planned hours per week for the job. Set if the job `PayType` is `SALARY`. + WeeklyHours *int `json:"weekly_hours,omitempty" url:"weekly_hours,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (f *FulfillmentFulfillmentEntry) GetExtraProperties() map[string]interface{} { - return f.extraProperties +func (j *JobAssignment) GetExtraProperties() map[string]interface{} { + return j.extraProperties } -func (f *FulfillmentFulfillmentEntry) UnmarshalJSON(data []byte) error { - type unmarshaler FulfillmentFulfillmentEntry +func (j *JobAssignment) UnmarshalJSON(data []byte) error { + type unmarshaler JobAssignment var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *f = FulfillmentFulfillmentEntry(value) + *j = JobAssignment(value) - extraProperties, err := core.ExtractExtraProperties(data, *f) + extraProperties, err := core.ExtractExtraProperties(data, *j) if err != nil { return err } - f.extraProperties = extraProperties + j.extraProperties = extraProperties - f._rawJSON = json.RawMessage(data) + j._rawJSON = json.RawMessage(data) return nil } -func (f *FulfillmentFulfillmentEntry) String() string { - if len(f._rawJSON) > 0 { - if value, err := core.StringifyJSON(f._rawJSON); err == nil { +func (j *JobAssignment) String() string { + if len(j._rawJSON) > 0 { + if value, err := core.StringifyJSON(j._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(f); err == nil { + if value, err := core.StringifyJSON(j); err == nil { return value } - return fmt.Sprintf("%#v", f) + return fmt.Sprintf("%#v", j) } -// The `line_item_application` describes what order line items this fulfillment applies -// to. It can be `ALL` or `ENTRY_LIST` with a supplied list of fulfillment entries. -type FulfillmentFulfillmentLineItemApplication string +// Enumerates the possible pay types that a job can be assigned. +type JobAssignmentPayType string const ( - FulfillmentFulfillmentLineItemApplicationAll FulfillmentFulfillmentLineItemApplication = "ALL" - FulfillmentFulfillmentLineItemApplicationEntryList FulfillmentFulfillmentLineItemApplication = "ENTRY_LIST" + JobAssignmentPayTypeStatusDoNotUse JobAssignmentPayType = "STATUS_DO_NOT_USE" + JobAssignmentPayTypeNone JobAssignmentPayType = "NONE" + JobAssignmentPayTypeHourly JobAssignmentPayType = "HOURLY" + JobAssignmentPayTypeSalary JobAssignmentPayType = "SALARY" ) -func NewFulfillmentFulfillmentLineItemApplicationFromString(s string) (FulfillmentFulfillmentLineItemApplication, error) { +func NewJobAssignmentPayTypeFromString(s string) (JobAssignmentPayType, error) { switch s { - case "ALL": - return FulfillmentFulfillmentLineItemApplicationAll, nil - case "ENTRY_LIST": - return FulfillmentFulfillmentLineItemApplicationEntryList, nil + case "STATUS_DO_NOT_USE": + return JobAssignmentPayTypeStatusDoNotUse, nil + case "NONE": + return JobAssignmentPayTypeNone, nil + case "HOURLY": + return JobAssignmentPayTypeHourly, nil + case "SALARY": + return JobAssignmentPayTypeSalary, nil } - var t FulfillmentFulfillmentLineItemApplication + var t JobAssignmentPayType return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (f FulfillmentFulfillmentLineItemApplication) Ptr() *FulfillmentFulfillmentLineItemApplication { - return &f +func (j JobAssignmentPayType) Ptr() *JobAssignmentPayType { + return &j } -// Contains details necessary to fulfill a pickup order. -type FulfillmentPickupDetails struct { - // Information about the person to pick up this fulfillment from a physical - // location. - Recipient *FulfillmentRecipient `json:"recipient,omitempty" url:"recipient,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when this fulfillment expires if it is not marked in progress. The timestamp must be - // in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). The expiration time can only be set - // up to 7 days in the future. If `expires_at` is not set, any new payments attached to the order - // are automatically completed. - ExpiresAt *string `json:"expires_at,omitempty" url:"expires_at,omitempty"` - // The duration of time after which an in progress pickup fulfillment is automatically moved - // to the `COMPLETED` state. The duration must be in RFC 3339 format (for example, "P1W3D"). - // - // If not set, this pickup fulfillment remains in progress until it is canceled or completed. - AutoCompleteDuration *string `json:"auto_complete_duration,omitempty" url:"auto_complete_duration,omitempty"` - // The schedule type of the pickup fulfillment. Defaults to `SCHEDULED`. - // See [FulfillmentPickupDetailsScheduleType](#type-fulfillmentpickupdetailsscheduletype) for possible values - ScheduleType *FulfillmentPickupDetailsScheduleType `json:"schedule_type,omitempty" url:"schedule_type,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // that represents the start of the pickup window. Must be in RFC 3339 timestamp format, e.g., - // "2016-09-04T23:59:33.123Z". - // - // For fulfillments with the schedule type `ASAP`, this is automatically set - // to the current time plus the expected duration to prepare the fulfillment. - PickupAt *string `json:"pickup_at,omitempty" url:"pickup_at,omitempty"` - // The window of time in which the order should be picked up after the `pickup_at` timestamp. - // Must be in RFC 3339 duration format, e.g., "P1W3D". Can be used as an - // informational guideline for merchants. - PickupWindowDuration *string `json:"pickup_window_duration,omitempty" url:"pickup_window_duration,omitempty"` - // The duration of time it takes to prepare this fulfillment. - // The duration must be in RFC 3339 format (for example, "P1W3D"). - PrepTimeDuration *string `json:"prep_time_duration,omitempty" url:"prep_time_duration,omitempty"` - // A note to provide additional instructions about the pickup - // fulfillment displayed in the Square Point of Sale application and set by the API. - Note *string `json:"note,omitempty" url:"note,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when the fulfillment was placed. The timestamp must be in RFC 3339 format - // (for example, "2016-09-04T23:59:33.123Z"). - PlacedAt *string `json:"placed_at,omitempty" url:"placed_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when the fulfillment was marked in progress. The timestamp must be in RFC 3339 format - // (for example, "2016-09-04T23:59:33.123Z"). - AcceptedAt *string `json:"accepted_at,omitempty" url:"accepted_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when the fulfillment was rejected. The timestamp must be in RFC 3339 format - // (for example, "2016-09-04T23:59:33.123Z"). - RejectedAt *string `json:"rejected_at,omitempty" url:"rejected_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when the fulfillment is marked as ready for pickup. The timestamp must be in RFC 3339 format - // (for example, "2016-09-04T23:59:33.123Z"). - ReadyAt *string `json:"ready_at,omitempty" url:"ready_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when the fulfillment expired. The timestamp must be in RFC 3339 format - // (for example, "2016-09-04T23:59:33.123Z"). - ExpiredAt *string `json:"expired_at,omitempty" url:"expired_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when the fulfillment was picked up by the recipient. The timestamp must be in RFC 3339 format - // (for example, "2016-09-04T23:59:33.123Z"). - PickedUpAt *string `json:"picked_up_at,omitempty" url:"picked_up_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when the fulfillment was canceled. The timestamp must be in RFC 3339 format - // (for example, "2016-09-04T23:59:33.123Z"). - CanceledAt *string `json:"canceled_at,omitempty" url:"canceled_at,omitempty"` - // A description of why the pickup was canceled. The maximum length: 100 characters. - CancelReason *string `json:"cancel_reason,omitempty" url:"cancel_reason,omitempty"` - // If set to `true`, indicates that this pickup order is for curbside pickup, not in-store pickup. - IsCurbsidePickup *bool `json:"is_curbside_pickup,omitempty" url:"is_curbside_pickup,omitempty"` - // Specific details for curbside pickup. These details can only be populated if `is_curbside_pickup` is set to `true`. - CurbsidePickupDetails *FulfillmentPickupDetailsCurbsidePickupDetails `json:"curbside_pickup_details,omitempty" url:"curbside_pickup_details,omitempty"` +// Published when a worker starts a [Shift](entity:Shift). +type LaborShiftCreatedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents. For this event, the value is `shift`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *LaborShiftCreatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (f *FulfillmentPickupDetails) GetExtraProperties() map[string]interface{} { - return f.extraProperties +func (l *LaborShiftCreatedEvent) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (f *FulfillmentPickupDetails) UnmarshalJSON(data []byte) error { - type unmarshaler FulfillmentPickupDetails +func (l *LaborShiftCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler LaborShiftCreatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *f = FulfillmentPickupDetails(value) + *l = LaborShiftCreatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *f) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - f.extraProperties = extraProperties + l.extraProperties = extraProperties - f._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (f *FulfillmentPickupDetails) String() string { - if len(f._rawJSON) > 0 { - if value, err := core.StringifyJSON(f._rawJSON); err == nil { +func (l *LaborShiftCreatedEvent) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(f); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", f) + return fmt.Sprintf("%#v", l) } -// Specific details for curbside pickup. -type FulfillmentPickupDetailsCurbsidePickupDetails struct { - // Specific details for curbside pickup, such as parking number and vehicle model. - CurbsideDetails *string `json:"curbside_details,omitempty" url:"curbside_details,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when the buyer arrived and is waiting for pickup. The timestamp must be in RFC 3339 format - // (for example, "2016-09-04T23:59:33.123Z"). - BuyerArrivedAt *string `json:"buyer_arrived_at,omitempty" url:"buyer_arrived_at,omitempty"` +type LaborShiftCreatedEventData struct { + // Name of the affected object’s type. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the affected object. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing fields and values relevant to the event. Is absent if affected object was deleted. + Object *LaborShiftCreatedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (f *FulfillmentPickupDetailsCurbsidePickupDetails) GetExtraProperties() map[string]interface{} { - return f.extraProperties +func (l *LaborShiftCreatedEventData) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (f *FulfillmentPickupDetailsCurbsidePickupDetails) UnmarshalJSON(data []byte) error { - type unmarshaler FulfillmentPickupDetailsCurbsidePickupDetails +func (l *LaborShiftCreatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler LaborShiftCreatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *f = FulfillmentPickupDetailsCurbsidePickupDetails(value) + *l = LaborShiftCreatedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *f) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - f.extraProperties = extraProperties + l.extraProperties = extraProperties - f._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (f *FulfillmentPickupDetailsCurbsidePickupDetails) String() string { - if len(f._rawJSON) > 0 { - if value, err := core.StringifyJSON(f._rawJSON); err == nil { +func (l *LaborShiftCreatedEventData) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(f); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", f) + return fmt.Sprintf("%#v", l) } -// The schedule type of the pickup fulfillment. -type FulfillmentPickupDetailsScheduleType string +type LaborShiftCreatedEventObject struct { + // The work shift. + Shift *Shift `json:"shift,omitempty" url:"shift,omitempty"` -const ( - FulfillmentPickupDetailsScheduleTypeScheduled FulfillmentPickupDetailsScheduleType = "SCHEDULED" - FulfillmentPickupDetailsScheduleTypeAsap FulfillmentPickupDetailsScheduleType = "ASAP" -) + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} -func NewFulfillmentPickupDetailsScheduleTypeFromString(s string) (FulfillmentPickupDetailsScheduleType, error) { - switch s { - case "SCHEDULED": - return FulfillmentPickupDetailsScheduleTypeScheduled, nil - case "ASAP": - return FulfillmentPickupDetailsScheduleTypeAsap, nil +func (l *LaborShiftCreatedEventObject) GetExtraProperties() map[string]interface{} { + return l.extraProperties +} + +func (l *LaborShiftCreatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler LaborShiftCreatedEventObject + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - var t FulfillmentPickupDetailsScheduleType - return "", fmt.Errorf("%s is not a valid %T", s, t) + *l = LaborShiftCreatedEventObject(value) + + extraProperties, err := core.ExtractExtraProperties(data, *l) + if err != nil { + return err + } + l.extraProperties = extraProperties + + l._rawJSON = json.RawMessage(data) + return nil } -func (f FulfillmentPickupDetailsScheduleType) Ptr() *FulfillmentPickupDetailsScheduleType { - return &f +func (l *LaborShiftCreatedEventObject) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(l); err == nil { + return value + } + return fmt.Sprintf("%#v", l) } -// Information about the fulfillment recipient. -type FulfillmentRecipient struct { - // The ID of the customer associated with the fulfillment. - // - // If `customer_id` is provided, the fulfillment recipient's `display_name`, - // `email_address`, and `phone_number` are automatically populated from the - // targeted customer profile. If these fields are set in the request, the request - // values override the information from the customer profile. If the - // targeted customer profile does not contain the necessary information and - // these fields are left unset, the request results in an error. - CustomerID *string `json:"customer_id,omitempty" url:"customer_id,omitempty"` - // The display name of the fulfillment recipient. This field is required. - // - // If provided, the display name overrides the corresponding customer profile value - // indicated by `customer_id`. - DisplayName *string `json:"display_name,omitempty" url:"display_name,omitempty"` - // The email address of the fulfillment recipient. - // - // If provided, the email address overrides the corresponding customer profile value - // indicated by `customer_id`. - EmailAddress *string `json:"email_address,omitempty" url:"email_address,omitempty"` - // The phone number of the fulfillment recipient. This field is required. - // - // If provided, the phone number overrides the corresponding customer profile value - // indicated by `customer_id`. - PhoneNumber *string `json:"phone_number,omitempty" url:"phone_number,omitempty"` - // The address of the fulfillment recipient. This field is required. - // - // If provided, the address overrides the corresponding customer profile value - // indicated by `customer_id`. - Address *Address `json:"address,omitempty" url:"address,omitempty"` +// Published when a [Shift](entity:Shift) is deleted. +type LaborShiftDeletedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *LaborShiftDeletedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (f *FulfillmentRecipient) GetExtraProperties() map[string]interface{} { - return f.extraProperties +func (l *LaborShiftDeletedEvent) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (f *FulfillmentRecipient) UnmarshalJSON(data []byte) error { - type unmarshaler FulfillmentRecipient +func (l *LaborShiftDeletedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler LaborShiftDeletedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *f = FulfillmentRecipient(value) + *l = LaborShiftDeletedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *f) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - f.extraProperties = extraProperties + l.extraProperties = extraProperties - f._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (f *FulfillmentRecipient) String() string { - if len(f._rawJSON) > 0 { - if value, err := core.StringifyJSON(f._rawJSON); err == nil { +func (l *LaborShiftDeletedEvent) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(f); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", f) + return fmt.Sprintf("%#v", l) } -// Contains the details necessary to fulfill a shipment order. -type FulfillmentShipmentDetails struct { - // Information about the person to receive this shipment fulfillment. - Recipient *FulfillmentRecipient `json:"recipient,omitempty" url:"recipient,omitempty"` - // The shipping carrier being used to ship this fulfillment (such as UPS, FedEx, or USPS). - Carrier *string `json:"carrier,omitempty" url:"carrier,omitempty"` - // A note with additional information for the shipping carrier. - ShippingNote *string `json:"shipping_note,omitempty" url:"shipping_note,omitempty"` - // A description of the type of shipping product purchased from the carrier - // (such as First Class, Priority, or Express). - ShippingType *string `json:"shipping_type,omitempty" url:"shipping_type,omitempty"` - // The reference number provided by the carrier to track the shipment's progress. - TrackingNumber *string `json:"tracking_number,omitempty" url:"tracking_number,omitempty"` - // A link to the tracking webpage on the carrier's website. - TrackingURL *string `json:"tracking_url,omitempty" url:"tracking_url,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when the shipment was requested. The timestamp must be in RFC 3339 format - // (for example, "2016-09-04T23:59:33.123Z"). - PlacedAt *string `json:"placed_at,omitempty" url:"placed_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when this fulfillment was moved to the `RESERVED` state, which indicates that preparation - // of this shipment has begun. The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - InProgressAt *string `json:"in_progress_at,omitempty" url:"in_progress_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when this fulfillment was moved to the `PREPARED` state, which indicates that the - // fulfillment is packaged. The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - PackagedAt *string `json:"packaged_at,omitempty" url:"packaged_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when the shipment is expected to be delivered to the shipping carrier. - // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - ExpectedShippedAt *string `json:"expected_shipped_at,omitempty" url:"expected_shipped_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when this fulfillment was moved to the `COMPLETED` state, which indicates that - // the fulfillment has been given to the shipping carrier. The timestamp must be in RFC 3339 format - // (for example, "2016-09-04T23:59:33.123Z"). - ShippedAt *string `json:"shipped_at,omitempty" url:"shipped_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating the shipment was canceled. - // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - CanceledAt *string `json:"canceled_at,omitempty" url:"canceled_at,omitempty"` - // A description of why the shipment was canceled. - CancelReason *string `json:"cancel_reason,omitempty" url:"cancel_reason,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when the shipment failed to be completed. The timestamp must be in RFC 3339 format - // (for example, "2016-09-04T23:59:33.123Z"). - FailedAt *string `json:"failed_at,omitempty" url:"failed_at,omitempty"` - // A description of why the shipment failed to be completed. - FailureReason *string `json:"failure_reason,omitempty" url:"failure_reason,omitempty"` +type LaborShiftDeletedEventData struct { + // Name of the affected object’s type. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the affected object. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // Is true if the affected object was deleted. Otherwise absent. + Deleted *bool `json:"deleted,omitempty" url:"deleted,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (f *FulfillmentShipmentDetails) GetExtraProperties() map[string]interface{} { - return f.extraProperties +func (l *LaborShiftDeletedEventData) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (f *FulfillmentShipmentDetails) UnmarshalJSON(data []byte) error { - type unmarshaler FulfillmentShipmentDetails +func (l *LaborShiftDeletedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler LaborShiftDeletedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *f = FulfillmentShipmentDetails(value) + *l = LaborShiftDeletedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *f) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - f.extraProperties = extraProperties + l.extraProperties = extraProperties - f._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (f *FulfillmentShipmentDetails) String() string { - if len(f._rawJSON) > 0 { - if value, err := core.StringifyJSON(f._rawJSON); err == nil { +func (l *LaborShiftDeletedEventData) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(f); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", f) + return fmt.Sprintf("%#v", l) } -// The current state of this fulfillment. -type FulfillmentState string +// Published when a [Shift](entity:Shift) is updated. +type LaborShiftUpdatedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents. For this event, the value is `shift`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *LaborShiftUpdatedEventData `json:"data,omitempty" url:"data,omitempty"` -const ( - FulfillmentStateProposed FulfillmentState = "PROPOSED" - FulfillmentStateReserved FulfillmentState = "RESERVED" - FulfillmentStatePrepared FulfillmentState = "PREPARED" - FulfillmentStateCompleted FulfillmentState = "COMPLETED" - FulfillmentStateCanceled FulfillmentState = "CANCELED" - FulfillmentStateFailed FulfillmentState = "FAILED" -) + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} -func NewFulfillmentStateFromString(s string) (FulfillmentState, error) { - switch s { - case "PROPOSED": - return FulfillmentStateProposed, nil - case "RESERVED": - return FulfillmentStateReserved, nil - case "PREPARED": - return FulfillmentStatePrepared, nil - case "COMPLETED": - return FulfillmentStateCompleted, nil - case "CANCELED": - return FulfillmentStateCanceled, nil - case "FAILED": - return FulfillmentStateFailed, nil +func (l *LaborShiftUpdatedEvent) GetExtraProperties() map[string]interface{} { + return l.extraProperties +} + +func (l *LaborShiftUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler LaborShiftUpdatedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - var t FulfillmentState - return "", fmt.Errorf("%s is not a valid %T", s, t) + *l = LaborShiftUpdatedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *l) + if err != nil { + return err + } + l.extraProperties = extraProperties + + l._rawJSON = json.RawMessage(data) + return nil } -func (f FulfillmentState) Ptr() *FulfillmentState { - return &f +func (l *LaborShiftUpdatedEvent) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(l); err == nil { + return value + } + return fmt.Sprintf("%#v", l) } -// The type of fulfillment. -type FulfillmentType string +type LaborShiftUpdatedEventData struct { + // Name of the affected object’s type. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the affected object. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing fields and values relevant to the event. Is absent if affected object was deleted. + Object *LaborShiftUpdatedEventObject `json:"object,omitempty" url:"object,omitempty"` -const ( - FulfillmentTypePickup FulfillmentType = "PICKUP" - FulfillmentTypeShipment FulfillmentType = "SHIPMENT" - FulfillmentTypeDelivery FulfillmentType = "DELIVERY" -) + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} -func NewFulfillmentTypeFromString(s string) (FulfillmentType, error) { - switch s { - case "PICKUP": - return FulfillmentTypePickup, nil - case "SHIPMENT": - return FulfillmentTypeShipment, nil - case "DELIVERY": - return FulfillmentTypeDelivery, nil +func (l *LaborShiftUpdatedEventData) GetExtraProperties() map[string]interface{} { + return l.extraProperties +} + +func (l *LaborShiftUpdatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler LaborShiftUpdatedEventData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - var t FulfillmentType - return "", fmt.Errorf("%s is not a valid %T", s, t) + *l = LaborShiftUpdatedEventData(value) + + extraProperties, err := core.ExtractExtraProperties(data, *l) + if err != nil { + return err + } + l.extraProperties = extraProperties + + l._rawJSON = json.RawMessage(data) + return nil } -func (f FulfillmentType) Ptr() *FulfillmentType { - return &f +func (l *LaborShiftUpdatedEventData) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(l); err == nil { + return value + } + return fmt.Sprintf("%#v", l) } -// Request object for fetching a specific `BankAccount` -// by the object ID. -type GetBankAccountByV1IDRequest struct { +type LaborShiftUpdatedEventObject struct { + // The work shift. + Shift *Shift `json:"shift,omitempty" url:"shift,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetBankAccountByV1IDRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *LaborShiftUpdatedEventObject) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetBankAccountByV1IDRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetBankAccountByV1IDRequest +func (l *LaborShiftUpdatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler LaborShiftUpdatedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetBankAccountByV1IDRequest(value) + *l = LaborShiftUpdatedEventObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetBankAccountByV1IDRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *LaborShiftUpdatedEventObject) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Response object returned by GetBankAccountByV1Id. -type GetBankAccountByV1IDResponse struct { - // Information on errors encountered during the request. +// A response that contains the linked `GiftCard` object. If the request resulted in errors, +// the response contains a set of `Error` objects. +type LinkCustomerToGiftCardResponse struct { + // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The requested `BankAccount` object. - BankAccount *BankAccount `json:"bank_account,omitempty" url:"bank_account,omitempty"` + // The gift card with the ID of the linked customer listed in the `customer_ids` field. + GiftCard *GiftCard `json:"gift_card,omitempty" url:"gift_card,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetBankAccountByV1IDResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *LinkCustomerToGiftCardResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetBankAccountByV1IDResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetBankAccountByV1IDResponse +func (l *LinkCustomerToGiftCardResponse) UnmarshalJSON(data []byte) error { + type unmarshaler LinkCustomerToGiftCardResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetBankAccountByV1IDResponse(value) + *l = LinkCustomerToGiftCardResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetBankAccountByV1IDResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *LinkCustomerToGiftCardResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Request object to fetch a specific `BankAccount` -// by the object ID. -type GetBankAccountRequest struct { +// Request object for fetching all `BankAccount` +// objects linked to a account. +type ListBankAccountsRequest struct { + // The pagination cursor returned by a previous call to this endpoint. + // Use it in the next `ListBankAccounts` request to retrieve the next set + // of results. + // + // See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // Upper limit on the number of bank accounts to return in the response. + // Currently, 1000 is the largest supported limit. You can specify a limit + // of up to 1000 bank accounts. This is also the default limit. + Limit *int `json:"limit,omitempty" url:"limit,omitempty"` + // Location ID. You can specify this optional filter + // to retrieve only the linked bank accounts belonging to a specific location. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetBankAccountRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListBankAccountsRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetBankAccountRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetBankAccountRequest +func (l *ListBankAccountsRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListBankAccountsRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetBankAccountRequest(value) + *l = ListBankAccountsRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetBankAccountRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListBankAccountsRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Response object returned by `GetBankAccount`. -type GetBankAccountResponse struct { +// Response object returned by ListBankAccounts. +type ListBankAccountsResponse struct { // Information on errors encountered during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The requested `BankAccount` object. - BankAccount *BankAccount `json:"bank_account,omitempty" url:"bank_account,omitempty"` + // List of BankAccounts associated with this account. + BankAccounts []*BankAccount `json:"bank_accounts,omitempty" url:"bank_accounts,omitempty"` + // When a response is truncated, it includes a cursor that you can + // use in a subsequent request to fetch next set of bank accounts. + // If empty, this is the final response. + // + // For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetBankAccountResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListBankAccountsResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetBankAccountResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetBankAccountResponse +func (l *ListBankAccountsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListBankAccountsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetBankAccountResponse(value) + *l = ListBankAccountsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetBankAccountResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListBankAccountsResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -type GetBookingRequest struct { +// Represents a [ListBookingCustomAttributeDefinitions](api-endpoint:BookingCustomAttributes-ListBookingCustomAttributeDefinitions) response. +// Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response. +// If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`. +type ListBookingCustomAttributeDefinitionsResponse struct { + // The retrieved custom attribute definitions. If no custom attribute definitions are found, + // Square returns an empty object (`{}`). + CustomAttributeDefinitions []*CustomAttributeDefinition `json:"custom_attribute_definitions,omitempty" url:"custom_attribute_definitions,omitempty"` + // The cursor to provide in your next call to this endpoint to retrieve the next page of + // results for your original request. This field is present only if the request succeeded and + // additional results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetBookingRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListBookingCustomAttributeDefinitionsResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetBookingRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetBookingRequest +func (l *ListBookingCustomAttributeDefinitionsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListBookingCustomAttributeDefinitionsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetBookingRequest(value) + *l = ListBookingCustomAttributeDefinitionsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetBookingRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListBookingCustomAttributeDefinitionsResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -type GetBookingResponse struct { - // The booking that was requested. - Booking *Booking `json:"booking,omitempty" url:"booking,omitempty"` - // Errors that occurred during the request. +// Represents a [ListBookingCustomAttributes](api-endpoint:BookingCustomAttributes-ListBookingCustomAttributes) response. +// Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional +// results are available, the `cursor` field is also present along with `custom_attributes`. +type ListBookingCustomAttributesResponse struct { + // The retrieved custom attributes. If `with_definitions` was set to `true` in the request, + // the custom attribute definition is returned in the `definition` field of each custom attribute. + // + // If no custom attributes are found, Square returns an empty object (`{}`). + CustomAttributes []*CustomAttribute `json:"custom_attributes,omitempty" url:"custom_attributes,omitempty"` + // The cursor to use in your next call to this endpoint to retrieve the next page of results + // for your original request. This field is present only if the request succeeded and additional + // results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetBookingResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListBookingCustomAttributesResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetBookingResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetBookingResponse +func (l *ListBookingCustomAttributesResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListBookingCustomAttributesResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetBookingResponse(value) + *l = ListBookingCustomAttributesResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetBookingResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListBookingCustomAttributesResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// A request to get a `BreakType` by ID. -type GetBreakTypeRequest struct { +type ListBookingsRequest struct { + // The maximum number of results per page to return in a paged response. + Limit *int `json:"limit,omitempty" 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:"cursor,omitempty" 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:"customer_id,omitempty" 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:"team_member_id,omitempty" 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:"location_id,omitempty" 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:"start_at_min,omitempty" 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:"start_at_max,omitempty" url:"start_at_max,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetBreakTypeRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListBookingsRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetBreakTypeRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetBreakTypeRequest +func (l *ListBookingsRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListBookingsRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetBreakTypeRequest(value) + *l = ListBookingsRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetBreakTypeRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListBookingsRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// The response to a request to get a `BreakType`. The response contains -// the requested `BreakType` objects and might contain a set of `Error` objects if -// the request resulted in errors. -type GetBreakTypeResponse struct { - // The response object. - BreakType *BreakType `json:"break_type,omitempty" url:"break_type,omitempty"` - // Any errors that occurred during the request. +type ListBookingsResponse struct { + // The list of targeted bookings. + Bookings []*Booking `json:"bookings,omitempty" url:"bookings,omitempty"` + // The pagination cursor to be used in the subsequent request to get the next page of the results. Stop retrieving the next page of the results when the cursor is not set. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // Errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetBreakTypeResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListBookingsResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetBreakTypeResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetBreakTypeResponse +func (l *ListBookingsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListBookingsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetBreakTypeResponse(value) + *l = ListBookingsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetBreakTypeResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListBookingsResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -type GetBusinessBookingProfileRequest struct { +// A request for a filtered set of `BreakType` objects. +type ListBreakTypesRequest struct { + // Filter the returned `BreakType` results to only those that are associated with the + // specified location. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The maximum number of `BreakType` results to return per page. The number can range between 1 + // and 200. The default is 200. + Limit *int `json:"limit,omitempty" url:"limit,omitempty"` + // A pointer to the next page of `BreakType` results to fetch. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetBusinessBookingProfileRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListBreakTypesRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetBusinessBookingProfileRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetBusinessBookingProfileRequest +func (l *ListBreakTypesRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListBreakTypesRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetBusinessBookingProfileRequest(value) + *l = ListBreakTypesRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetBusinessBookingProfileRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListBreakTypesRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -type GetBusinessBookingProfileResponse struct { - // The seller's booking profile. - BusinessBookingProfile *BusinessBookingProfile `json:"business_booking_profile,omitempty" url:"business_booking_profile,omitempty"` - // Errors that occurred during the request. +// The response to a request for a set of `BreakType` objects. The response contains +// the requested `BreakType` objects and might contain a set of `Error` objects if +// the request resulted in errors. +type ListBreakTypesResponse struct { + // A page of `BreakType` results. + BreakTypes []*BreakType `json:"break_types,omitempty" url:"break_types,omitempty"` + // The value supplied in the subsequent request to fetch the next page + // of `BreakType` results. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetBusinessBookingProfileResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListBreakTypesResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetBusinessBookingProfileResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetBusinessBookingProfileResponse +func (l *ListBreakTypesResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListBreakTypesResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetBusinessBookingProfileResponse(value) + *l = ListBreakTypesResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetBusinessBookingProfileResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListBreakTypesResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } // Retrieves details for a specific Card. Accessible via -// HTTP requests at GET https://connect.squareup.com/v2/cards/{card_id} -type GetCardRequest struct { +// HTTP requests at GET https://connect.squareup.com/v2/cards +type ListCardsRequest struct { + // A pagination cursor returned by a previous call to this endpoint. + // Provide this to retrieve the next set of results for your original query. + // + // See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // Limit results to cards associated with the customer supplied. + // By default, all cards owned by the merchant are returned. + CustomerID *string `json:"customer_id,omitempty" url:"customer_id,omitempty"` + // Includes disabled cards. + // By default, all enabled cards owned by the merchant are returned. + IncludeDisabled *bool `json:"include_disabled,omitempty" url:"include_disabled,omitempty"` + // Limit results to cards associated with the reference_id supplied. + ReferenceID *string `json:"reference_id,omitempty" url:"reference_id,omitempty"` + // Sorts the returned list by when the card was created with the specified order. + // This field defaults to ASC. + // See [SortOrder](#type-sortorder) for possible values + SortOrder *SortOrder `json:"sort_order,omitempty" url:"sort_order,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetCardRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListCardsRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetCardRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetCardRequest +func (l *ListCardsRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListCardsRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetCardRequest(value) + *l = ListCardsRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetCardRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListCardsRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } // Defines the fields that are included in the response body of -// a request to the [RetrieveCard]($e/Cards/RetrieveCard) endpoint. +// a request to the [ListCards](api-endpoint:Cards-ListCards) endpoint. // // Note: if there are errors processing the request, the card field will not be // present. -type GetCardResponse struct { +type ListCardsResponse struct { // Information on errors encountered during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The retrieved card. - Card *Card `json:"card,omitempty" url:"card,omitempty"` + // The requested list of `Card`s. + Cards []*Card `json:"cards,omitempty" url:"cards,omitempty"` + // The pagination cursor to be used in a subsequent request. If empty, + // this is the final response. + // + // See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetCardResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListCardsResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetCardResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetCardResponse +func (l *ListCardsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListCardsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetCardResponse(value) + *l = ListCardsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetCardResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListCardsResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -type GetCashDrawerShiftResponse struct { - // The cash drawer shift queried for. - CashDrawerShift *CashDrawerShift `json:"cash_drawer_shift,omitempty" url:"cash_drawer_shift,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +type ListCashDrawerShiftEventsRequest struct { + // The ID of the location to list cash drawer shifts for. + LocationID string `json:"location_id" url:"location_id"` + // Number of resources to be returned in a page of results (200 by + // default, 1000 max). + Limit *int `json:"limit,omitempty" url:"limit,omitempty"` + // Opaque cursor for fetching the next page of results. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetCashDrawerShiftResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListCashDrawerShiftEventsRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetCashDrawerShiftResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetCashDrawerShiftResponse +func (l *ListCashDrawerShiftEventsRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListCashDrawerShiftEventsRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetCashDrawerShiftResponse(value) + *l = ListCashDrawerShiftEventsRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetCashDrawerShiftResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListCashDrawerShiftEventsRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -type GetCatalogObjectResponse struct { +type ListCashDrawerShiftEventsResponse struct { + // All of the events (payments, refunds, etc.) for a cash drawer during + // the shift. + Events []*CashDrawerShiftEvent `json:"events,omitempty" url:"events,omitempty"` + // Opaque cursor for fetching the next page. Cursor is not present in + // the last page of results. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The `CatalogObject`s returned. - Object *CatalogObject `json:"object,omitempty" url:"object,omitempty"` - // A list of `CatalogObject`s referenced by the object in the `object` field. - RelatedObjects []*CatalogObject `json:"related_objects,omitempty" url:"related_objects,omitempty"` + // All of the events (payments, refunds, etc.) for a cash drawer during + // the shift. + CashDrawerShiftEvents []*CashDrawerShiftEvent `json:"cash_drawer_shift_events,omitempty" url:"cash_drawer_shift_events,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetCatalogObjectResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListCashDrawerShiftEventsResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetCatalogObjectResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetCatalogObjectResponse +func (l *ListCashDrawerShiftEventsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListCashDrawerShiftEventsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetCatalogObjectResponse(value) + *l = ListCashDrawerShiftEventsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetCatalogObjectResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListCashDrawerShiftEventsResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Represents a [RetrieveCustomerCustomAttributeDefinition]($e/CustomerCustomAttributes/RetrieveCustomerCustomAttributeDefinition) response. -// Either `custom_attribute_definition` or `errors` is present in the response. -type GetCustomerCustomAttributeDefinitionResponse struct { - // The retrieved custom attribute definition. - CustomAttributeDefinition *CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"custom_attribute_definition,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +type ListCashDrawerShiftsRequest struct { + // The ID of the location to query for a list of cash drawer shifts. + LocationID string `json:"location_id" url:"location_id"` + // The order in which cash drawer shifts are listed in the response, + // based on their opened_at field. Default value: ASC + // See [SortOrder](#type-sortorder) for possible values + SortOrder *SortOrder `json:"sort_order,omitempty" url:"sort_order,omitempty"` + // The inclusive start time of the query on opened_at, in ISO 8601 format. + BeginTime *string `json:"begin_time,omitempty" url:"begin_time,omitempty"` + // The exclusive end date of the query on opened_at, in ISO 8601 format. + EndTime *string `json:"end_time,omitempty" url:"end_time,omitempty"` + // Number of cash drawer shift events in a page of results (200 by + // default, 1000 max). + Limit *int `json:"limit,omitempty" url:"limit,omitempty"` + // Opaque cursor for fetching the next page of results. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetCustomerCustomAttributeDefinitionResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListCashDrawerShiftsRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetCustomerCustomAttributeDefinitionResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetCustomerCustomAttributeDefinitionResponse +func (l *ListCashDrawerShiftsRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListCashDrawerShiftsRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetCustomerCustomAttributeDefinitionResponse(value) + *l = ListCashDrawerShiftsRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetCustomerCustomAttributeDefinitionResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListCashDrawerShiftsRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Represents a [RetrieveCustomerCustomAttribute]($e/CustomerCustomAttributes/RetrieveCustomerCustomAttribute) response. -// Either `custom_attribute_definition` or `errors` is present in the response. -type GetCustomerCustomAttributeResponse struct { - // The retrieved custom attribute. If `with_definition` was set to `true` in the request, - // the custom attribute definition is returned in the `definition` field. - CustomAttribute *CustomAttribute `json:"custom_attribute,omitempty" url:"custom_attribute,omitempty"` +type ListCashDrawerShiftsResponse struct { + // A collection of CashDrawerShiftSummary objects for shifts that match + // the query. + Items []*CashDrawerShiftSummary `json:"items,omitempty" url:"items,omitempty"` + // Opaque cursor for fetching the next page of results. Cursor is not + // present in the last page of results. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // A collection of CashDrawerShiftSummary objects for shifts that match + // the query. + CashDrawerShifts []*CashDrawerShiftSummary `json:"cash_drawer_shifts,omitempty" url:"cash_drawer_shifts,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetCustomerCustomAttributeResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListCashDrawerShiftsResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetCustomerCustomAttributeResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetCustomerCustomAttributeResponse +func (l *ListCashDrawerShiftsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListCashDrawerShiftsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetCustomerCustomAttributeResponse(value) + *l = ListCashDrawerShiftsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetCustomerCustomAttributeResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListCashDrawerShiftsResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Defines the fields that can be included in a request to the -// [RetrieveCustomerGroup]($e/CustomerGroups/RetrieveCustomerGroup) endpoint. -type GetCustomerGroupRequest struct { +type ListCatalogRequest struct { + // The pagination cursor returned in the previous response. Leave unset for an initial request. + // The page size is currently set to be 100. + // See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // An optional case-insensitive, comma-separated list of object types to retrieve. + // + // The valid values are defined in the [CatalogObjectType](entity:CatalogObjectType) enum, for example, + // `ITEM`, `ITEM_VARIATION`, `CATEGORY`, `DISCOUNT`, `TAX`, + // `MODIFIER`, `MODIFIER_LIST`, `IMAGE`, etc. + // + // If this is unspecified, the operation returns objects of all the top level types at the version + // of the Square API used to make the request. Object types that are nested onto other object types + // are not included in the defaults. + // + // At the current API version the default object types are: + // ITEM, CATEGORY, TAX, DISCOUNT, MODIFIER_LIST, + // PRICING_RULE, PRODUCT_SET, TIME_PERIOD, MEASUREMENT_UNIT, + // SUBSCRIPTION_PLAN, ITEM_OPTION, CUSTOM_ATTRIBUTE_DEFINITION, QUICK_AMOUNT_SETTINGS. + Types *string `json:"types,omitempty" url:"types,omitempty"` + // The specific version of the catalog objects to be included in the response. + // This allows you to retrieve historical versions of objects. The specified version value is matched against + // the [CatalogObject](entity:CatalogObject)s' `version` attribute. If not included, results will be from the + // current version of the catalog. + CatalogVersion *int64 `json:"catalog_version,omitempty" url:"catalog_version,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetCustomerGroupRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListCatalogRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetCustomerGroupRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetCustomerGroupRequest +func (l *ListCatalogRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListCatalogRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetCustomerGroupRequest(value) + *l = ListCatalogRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetCustomerGroupRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListCatalogRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Defines the fields that are included in the response body of -// a request to the [RetrieveCustomerGroup]($e/CustomerGroups/RetrieveCustomerGroup) endpoint. -// -// Either `errors` or `group` is present in a given response (never both). -type GetCustomerGroupResponse struct { +type ListCatalogResponse struct { // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The retrieved customer group. - Group *CustomerGroup `json:"group,omitempty" url:"group,omitempty"` + // The pagination cursor to be used in a subsequent request. If unset, this is the final response. + // See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // The CatalogObjects returned. + Objects []*CatalogObject `json:"objects,omitempty" url:"objects,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetCustomerGroupResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListCatalogResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetCustomerGroupResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetCustomerGroupResponse +func (l *ListCatalogResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListCatalogResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetCustomerGroupResponse(value) + *l = ListCatalogResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetCustomerGroupResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListCatalogResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Defines the fields that are included in requests to the `RetrieveCustomer` -// endpoint. -type GetCustomerRequest struct { +// Represents a [ListCustomerCustomAttributeDefinitions](api-endpoint:CustomerCustomAttributes-ListCustomerCustomAttributeDefinitions) request. +type ListCustomerCustomAttributeDefinitionsRequest struct { + // The maximum number of results to return in a single paged response. This limit is advisory. + // The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. + // The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Limit *int `json:"limit,omitempty" url:"limit,omitempty"` + // The cursor returned in the paged response from the previous call to this endpoint. + // Provide this cursor to retrieve the next page of results for your original request. + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetCustomerRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListCustomerCustomAttributeDefinitionsRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetCustomerRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetCustomerRequest +func (l *ListCustomerCustomAttributeDefinitionsRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListCustomerCustomAttributeDefinitionsRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetCustomerRequest(value) + *l = ListCustomerCustomAttributeDefinitionsRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetCustomerRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListCustomerCustomAttributeDefinitionsRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Defines the fields that are included in the response body of -// a request to the `RetrieveCustomer` endpoint. -// -// Either `errors` or `customer` is present in a given response (never both). -type GetCustomerResponse struct { +// Represents a [ListCustomerCustomAttributeDefinitions](api-endpoint:CustomerCustomAttributes-ListCustomerCustomAttributeDefinitions) response. +// Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response. +// If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`. +type ListCustomerCustomAttributeDefinitionsResponse struct { + // The retrieved custom attribute definitions. If no custom attribute definitions are found, + // Square returns an empty object (`{}`). + CustomAttributeDefinitions []*CustomAttributeDefinition `json:"custom_attribute_definitions,omitempty" url:"custom_attribute_definitions,omitempty"` + // The cursor to provide in your next call to this endpoint to retrieve the next page of + // results for your original request. This field is present only if the request succeeded and + // additional results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The requested customer. - Customer *Customer `json:"customer,omitempty" url:"customer,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetCustomerResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListCustomerCustomAttributeDefinitionsResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetCustomerResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetCustomerResponse +func (l *ListCustomerCustomAttributeDefinitionsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListCustomerCustomAttributeDefinitionsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetCustomerResponse(value) + *l = ListCustomerCustomAttributeDefinitionsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetCustomerResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListCustomerCustomAttributeDefinitionsResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Defines the valid parameters for requests to the `RetrieveCustomerSegmentRequest` endpoint. -type GetCustomerSegmentRequest struct { +// Represents a [ListCustomerCustomAttributes](api-endpoint:CustomerCustomAttributes-ListCustomerCustomAttributes) request. +type ListCustomerCustomAttributesRequest struct { + // The maximum number of results to return in a single paged response. This limit is advisory. + // The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. + // The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Limit *int `json:"limit,omitempty" url:"limit,omitempty"` + // The cursor returned in the paged response from the previous call to this endpoint. + // Provide this cursor to retrieve the next page of results for your original request. For more + // information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each + // custom attribute. Set this parameter to `true` to get the name and description of each custom + // attribute, information about the data type, or other definition details. The default value is `false`. + WithDefinitions *bool `json:"with_definitions,omitempty" url:"with_definitions,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetCustomerSegmentRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListCustomerCustomAttributesRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetCustomerSegmentRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetCustomerSegmentRequest +func (l *ListCustomerCustomAttributesRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListCustomerCustomAttributesRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetCustomerSegmentRequest(value) + *l = ListCustomerCustomAttributesRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetCustomerSegmentRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListCustomerCustomAttributesRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Defines the fields that are included in the response body for requests to the `RetrieveCustomerSegment` endpoint. -// -// Either `errors` or `segment` is present in a given response (never both). -type GetCustomerSegmentResponse struct { +// Represents a [ListCustomerCustomAttributes](api-endpoint:CustomerCustomAttributes-ListCustomerCustomAttributes) response. +// Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional +// results are available, the `cursor` field is also present along with `custom_attributes`. +type ListCustomerCustomAttributesResponse struct { + // The retrieved custom attributes. If `with_definitions` was set to `true` in the request, + // the custom attribute definition is returned in the `definition` field of each custom attribute. + // + // If no custom attributes are found, Square returns an empty object (`{}`). + CustomAttributes []*CustomAttribute `json:"custom_attributes,omitempty" url:"custom_attributes,omitempty"` + // The cursor to use in your next call to this endpoint to retrieve the next page of results + // for your original request. This field is present only if the request succeeded and additional + // results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The retrieved customer segment. - Segment *CustomerSegment `json:"segment,omitempty" url:"segment,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetCustomerSegmentResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListCustomerCustomAttributesResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetCustomerSegmentResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetCustomerSegmentResponse +func (l *ListCustomerCustomAttributesResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListCustomerCustomAttributesResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetCustomerSegmentResponse(value) + *l = ListCustomerCustomAttributesResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetCustomerSegmentResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListCustomerCustomAttributesResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -type GetDeviceCodeRequest struct { +// Defines the query parameters that can be included in a request to the +// [ListCustomerGroups](api-endpoint:CustomerGroups-ListCustomerGroups) endpoint. +type ListCustomerGroupsRequest struct { + // A pagination cursor returned by a previous call to this endpoint. + // Provide this cursor to retrieve the next set of results for your original query. + // + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results. + // If the limit is less than 1 or greater than 50, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 50. + // + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Limit *int `json:"limit,omitempty" url:"limit,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetDeviceCodeRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListCustomerGroupsRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetDeviceCodeRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetDeviceCodeRequest +func (l *ListCustomerGroupsRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListCustomerGroupsRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetDeviceCodeRequest(value) + *l = ListCustomerGroupsRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetDeviceCodeRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListCustomerGroupsRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -type GetDeviceCodeResponse struct { +// Defines the fields that are included in the response body of +// a request to the [ListCustomerGroups](api-endpoint:CustomerGroups-ListCustomerGroups) endpoint. +// +// Either `errors` or `groups` is present in a given response (never both). +type ListCustomerGroupsResponse struct { // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The queried DeviceCode. - DeviceCode *DeviceCode `json:"device_code,omitempty" url:"device_code,omitempty"` + // A list of customer groups belonging to the current seller. + Groups []*CustomerGroup `json:"groups,omitempty" url:"groups,omitempty"` + // A pagination cursor to retrieve the next set of results for your + // original query to the endpoint. This value is present only if the request + // succeeded and additional results are available. + // + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetDeviceCodeResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListCustomerGroupsResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetDeviceCodeResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetDeviceCodeResponse +func (l *ListCustomerGroupsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListCustomerGroupsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetDeviceCodeResponse(value) + *l = ListCustomerGroupsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetDeviceCodeResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListCustomerGroupsResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -type GetDeviceRequest struct { +// Defines the valid parameters for requests to the `ListCustomerSegments` endpoint. +type ListCustomerSegmentsRequest struct { + // A pagination cursor returned by previous calls to `ListCustomerSegments`. + // This cursor is used to retrieve the next set of query results. + // + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results. + // If the specified limit is less than 1 or greater than 50, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 50. + // + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Limit *int `json:"limit,omitempty" url:"limit,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetDeviceRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListCustomerSegmentsRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetDeviceRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetDeviceRequest +func (l *ListCustomerSegmentsRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListCustomerSegmentsRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetDeviceRequest(value) + *l = ListCustomerSegmentsRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetDeviceRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListCustomerSegmentsRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -type GetDeviceResponse struct { - // Information about errors encountered during the request. +// Defines the fields that are included in the response body for requests to the `ListCustomerSegments` endpoint. +// +// Either `errors` or `segments` is present in a given response (never both). +type ListCustomerSegmentsResponse struct { + // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The requested `Device`. - Device *Device `json:"device,omitempty" url:"device,omitempty"` + // The list of customer segments belonging to the associated Square account. + Segments []*CustomerSegment `json:"segments,omitempty" url:"segments,omitempty"` + // A pagination cursor to be used in subsequent calls to `ListCustomerSegments` + // to retrieve the next set of query results. The cursor is only present if the request succeeded and + // additional results are available. + // + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetDeviceResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListCustomerSegmentsResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetDeviceResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetDeviceResponse +func (l *ListCustomerSegmentsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListCustomerSegmentsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetDeviceResponse(value) + *l = ListCustomerSegmentsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetDeviceResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListCustomerSegmentsResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Defines the parameters for a `RetrieveDisputeEvidence` request. -type GetDisputeEvidenceRequest struct { +// Defines the query parameters that can be included in a request to the +// `ListCustomers` endpoint. +type ListCustomersRequest struct { + // A pagination cursor returned by a previous call to this endpoint. + // Provide this cursor to retrieve the next set of results for your original query. + // + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results. + // If the specified limit is less than 1 or greater than 100, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 100. + // + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Limit *int `json:"limit,omitempty" url:"limit,omitempty"` + // Indicates how customers should be sorted. + // + // The default value is `DEFAULT`. + // See [CustomerSortField](#type-customersortfield) for possible values + SortField *CustomerSortField `json:"sort_field,omitempty" url:"sort_field,omitempty"` + // Indicates whether customers should be sorted in ascending (`ASC`) or + // descending (`DESC`) order. + // + // The default value is `ASC`. + // See [SortOrder](#type-sortorder) for possible values + SortOrder *SortOrder `json:"sort_order,omitempty" url:"sort_order,omitempty"` + // Indicates whether to return the total count of customers in the `count` field of the response. + // + // The default value is `false`. + Count *bool `json:"count,omitempty" url:"count,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetDisputeEvidenceRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListCustomersRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetDisputeEvidenceRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetDisputeEvidenceRequest +func (l *ListCustomersRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListCustomersRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetDisputeEvidenceRequest(value) + *l = ListCustomersRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetDisputeEvidenceRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListCustomersRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Defines the fields in a `RetrieveDisputeEvidence` response. -type GetDisputeEvidenceResponse struct { +// Defines the fields that are included in the response body of +// a request to the `ListCustomers` endpoint. +// +// Either `errors` or `customers` is present in a given response (never both). +type ListCustomersResponse struct { // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // Metadata about the dispute evidence file. - Evidence *DisputeEvidence `json:"evidence,omitempty" url:"evidence,omitempty"` + // The customer profiles associated with the Square account or an empty object (`{}`) if none are found. + // Only customer profiles with public information (`given_name`, `family_name`, `company_name`, `email_address`, or + // `phone_number`) are included in the response. + Customers []*Customer `json:"customers,omitempty" url:"customers,omitempty"` + // A pagination cursor to retrieve the next set of results for the + // original query. A cursor is only present if the request succeeded and additional results + // are available. + // + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // The total count of customers associated with the Square account. Only customer profiles with public information + // (`given_name`, `family_name`, `company_name`, `email_address`, or `phone_number`) are counted. This field is present + // only if `count` is set to `true` in the request. + Count *int64 `json:"count,omitempty" url:"count,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetDisputeEvidenceResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListCustomersResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetDisputeEvidenceResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetDisputeEvidenceResponse +func (l *ListCustomersResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListCustomersResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetDisputeEvidenceResponse(value) + *l = ListCustomersResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetDisputeEvidenceResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListCustomersResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Defines the request parameters for the `RetrieveDispute` endpoint. -type GetDisputeRequest struct { +type ListDeviceCodesRequest struct { + // A pagination cursor returned by a previous call to this endpoint. + // Provide this to retrieve the next set of results for your original query. + // + // See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // If specified, only returns DeviceCodes of the specified location. + // Returns DeviceCodes of all locations if empty. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // If specified, only returns DeviceCodes targeting the specified product type. + // Returns DeviceCodes of all product types if empty. + ProductType *ProductType `json:"product_type,omitempty" url:"product_type,omitempty"` + // If specified, returns DeviceCodes with the specified statuses. + // Returns DeviceCodes of status `PAIRED` and `UNPAIRED` if empty. + // See [DeviceCodeStatus](#type-devicecodestatus) for possible values + Status []DeviceCodeStatus `json:"status,omitempty" url:"status,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetDisputeRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListDeviceCodesRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetDisputeRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetDisputeRequest +func (l *ListDeviceCodesRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListDeviceCodesRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetDisputeRequest(value) + *l = ListDeviceCodesRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetDisputeRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListDeviceCodesRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Defines fields in a `RetrieveDispute` response. -type GetDisputeResponse struct { - // Information about errors encountered during the request. +type ListDeviceCodesResponse struct { + // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // Details about the requested `Dispute`. - Dispute *Dispute `json:"dispute,omitempty" url:"dispute,omitempty"` + // The queried DeviceCode. + DeviceCodes []*DeviceCode `json:"device_codes,omitempty" url:"device_codes,omitempty"` + // A pagination cursor to retrieve the next set of results for your + // original query to the endpoint. This value is present only if the request + // succeeded and additional results are available. + // + // See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetDisputeResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListDeviceCodesResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetDisputeResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetDisputeResponse +func (l *ListDeviceCodesResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListDeviceCodesResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetDisputeResponse(value) + *l = ListDeviceCodesResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetDisputeResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListDeviceCodesResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -type GetEmployeeRequest struct { +type ListDevicesRequest struct { + // A pagination cursor returned by a previous call to this endpoint. + // Provide this cursor to retrieve the next set of results for the original query. + // See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // The order in which results are listed. + // + // - `ASC` - Oldest to newest. + // - `DESC` - Newest to oldest (default). + // See [SortOrder](#type-sortorder) for possible values + SortOrder *SortOrder `json:"sort_order,omitempty" url:"sort_order,omitempty"` + // The number of results to return in a single page. + Limit *int `json:"limit,omitempty" url:"limit,omitempty"` + // If present, only returns devices at the target location. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetEmployeeRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListDevicesRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetEmployeeRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetEmployeeRequest +func (l *ListDevicesRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListDevicesRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetEmployeeRequest(value) + *l = ListDevicesRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetEmployeeRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListDevicesRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -type GetEmployeeResponse struct { - Employee *Employee `json:"employee,omitempty" url:"employee,omitempty"` - // Any errors that occurred during the request. +type ListDevicesResponse struct { + // Information about errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The requested list of `Device` objects. + Devices []*Device `json:"devices,omitempty" url:"devices,omitempty"` + // The pagination cursor to be used in a subsequent request. If empty, + // this is the final response. + // See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetEmployeeResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListDevicesResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetEmployeeResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetEmployeeResponse +func (l *ListDevicesResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListDevicesResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetEmployeeResponse(value) + *l = ListDevicesResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetEmployeeResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListDevicesResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// A request to get an `EmployeeWage`. -type GetEmployeeWageRequest struct { +// Defines the parameters for a `ListDisputeEvidence` request. +type ListDisputeEvidenceRequest struct { + // A pagination cursor returned by a previous call to this endpoint. + // Provide this cursor to retrieve the next set of results for the original query. + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetEmployeeWageRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListDisputeEvidenceRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetEmployeeWageRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetEmployeeWageRequest +func (l *ListDisputeEvidenceRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListDisputeEvidenceRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetEmployeeWageRequest(value) + *l = ListDisputeEvidenceRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetEmployeeWageRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListDisputeEvidenceRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// A response to a request to get an `EmployeeWage`. The response contains -// the requested `EmployeeWage` objects and might contain a set of `Error` objects if -// the request resulted in errors. -type GetEmployeeWageResponse struct { - // The requested `EmployeeWage` object. - EmployeeWage *EmployeeWage `json:"employee_wage,omitempty" url:"employee_wage,omitempty"` - // Any errors that occurred during the request. +// Defines the fields in a `ListDisputeEvidence` response. +type ListDisputeEvidenceResponse struct { + // The list of evidence previously uploaded to the specified dispute. + Evidence []*DisputeEvidence `json:"evidence,omitempty" url:"evidence,omitempty"` + // Information about errors encountered during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The pagination cursor to be used in a subsequent request. + // If unset, this is the final response. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetEmployeeWageResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListDisputeEvidenceResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetEmployeeWageResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetEmployeeWageResponse +func (l *ListDisputeEvidenceResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListDisputeEvidenceResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetEmployeeWageResponse(value) + *l = ListDisputeEvidenceResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetEmployeeWageResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListDisputeEvidenceResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// A response that contains a `GiftCard`. This response might contain a set of `Error` objects -// if the request resulted in errors. -type GetGiftCardFromGanResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // A gift card that was fetched, if present. It returns empty if an error occurred. - GiftCard *GiftCard `json:"gift_card,omitempty" url:"gift_card,omitempty"` +// Defines the request parameters for the `ListDisputes` endpoint. +type ListDisputesRequest struct { + // A pagination cursor returned by a previous call to this endpoint. + // Provide this cursor to retrieve the next set of results for the original query. + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // The dispute states used to filter the result. If not specified, the endpoint returns all disputes. + // See [DisputeState](#type-disputestate) for possible values + States []DisputeState `json:"states,omitempty" url:"states,omitempty"` + // The ID of the location for which to return a list of disputes. + // If not specified, the endpoint returns disputes associated with all locations. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetGiftCardFromGanResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListDisputesRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetGiftCardFromGanResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetGiftCardFromGanResponse +func (l *ListDisputesRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListDisputesRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetGiftCardFromGanResponse(value) + *l = ListDisputesRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetGiftCardFromGanResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListDisputesRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// A response that contains a `GiftCard` object. If the request resulted in errors, -// the response contains a set of `Error` objects. -type GetGiftCardFromNonceResponse struct { - // Any errors that occurred during the request. +// Defines fields in a `ListDisputes` response. +type ListDisputesResponse struct { + // Information about errors encountered during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The retrieved gift card. - GiftCard *GiftCard `json:"gift_card,omitempty" url:"gift_card,omitempty"` + // The list of disputes. + Disputes []*Dispute `json:"disputes,omitempty" url:"disputes,omitempty"` + // The pagination cursor to be used in a subsequent request. + // If unset, this is the final response. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetGiftCardFromNonceResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListDisputesResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetGiftCardFromNonceResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetGiftCardFromNonceResponse +func (l *ListDisputesResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListDisputesResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetGiftCardFromNonceResponse(value) + *l = ListDisputesResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetGiftCardFromNonceResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListDisputesResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// A request to retrieve digital gift cards. -type GetGiftCardRequest struct { +// A request for a set of `EmployeeWage` objects. +type ListEmployeeWagesRequest struct { + // Filter the returned wages to only those that are associated with the specified employee. + EmployeeID *string `json:"employee_id,omitempty" url:"employee_id,omitempty"` + // The maximum number of `EmployeeWage` results to return per page. The number can range between + // 1 and 200. The default is 200. + Limit *int `json:"limit,omitempty" url:"limit,omitempty"` + // A pointer to the next page of `EmployeeWage` results to fetch. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetGiftCardRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListEmployeeWagesRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetGiftCardRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetGiftCardRequest +func (l *ListEmployeeWagesRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListEmployeeWagesRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetGiftCardRequest(value) + *l = ListEmployeeWagesRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetGiftCardRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListEmployeeWagesRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// A response that contains a `GiftCard`. The response might contain a set of `Error` objects -// if the request resulted in errors. -type GetGiftCardResponse struct { +// The response to a request for a set of `EmployeeWage` objects. The response contains +// a set of `EmployeeWage` objects. +type ListEmployeeWagesResponse struct { + // A page of `EmployeeWage` results. + EmployeeWages []*EmployeeWage `json:"employee_wages,omitempty" url:"employee_wages,omitempty"` + // The value supplied in the subsequent request to fetch the next page + // of `EmployeeWage` results. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The gift card retrieved. - GiftCard *GiftCard `json:"gift_card,omitempty" url:"gift_card,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetGiftCardResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListEmployeeWagesResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetGiftCardResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetGiftCardResponse +func (l *ListEmployeeWagesResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListEmployeeWagesResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetGiftCardResponse(value) + *l = ListEmployeeWagesResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetGiftCardResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListEmployeeWagesResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -type GetInventoryAdjustmentRequest struct { +type ListEmployeesRequest struct { + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // Specifies the EmployeeStatus to filter the employee by. + // See [EmployeeStatus](#type-employeestatus) for possible values + Status *EmployeeStatus `json:"status,omitempty" url:"status,omitempty"` + // The number of employees to be returned on each page. + Limit *int `json:"limit,omitempty" url:"limit,omitempty"` + // The token required to retrieve the specified page of results. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetInventoryAdjustmentRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListEmployeesRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetInventoryAdjustmentRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetInventoryAdjustmentRequest +func (l *ListEmployeesRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListEmployeesRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetInventoryAdjustmentRequest(value) + *l = ListEmployeesRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetInventoryAdjustmentRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListEmployeesRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -type GetInventoryAdjustmentResponse struct { +type ListEmployeesResponse struct { + Employees []*Employee `json:"employees,omitempty" url:"employees,omitempty"` + // The token to be used to retrieve the next page of results. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` // 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) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListEmployeesResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetInventoryAdjustmentResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetInventoryAdjustmentResponse +func (l *ListEmployeesResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListEmployeesResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetInventoryAdjustmentResponse(value) + *l = ListEmployeesResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetInventoryAdjustmentResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListEmployeesResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -type GetInventoryChangesResponse struct { - // Any errors that occurred during the request. +// Defines the fields that are included in the response body of +// a request to the [ListEventTypes](api-endpoint:Events-ListEventTypes) endpoint. +// +// Note: if there are errors processing the request, the event types field will not be +// present. +type ListEventTypesResponse struct { + // Information on errors encountered 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"` + // The list of event types. + EventTypes []string `json:"event_types,omitempty" url:"event_types,omitempty"` + // Contains the metadata of an event type. For more information, see [EventTypeMetadata](entity:EventTypeMetadata). + Metadata []*EventTypeMetadata `json:"metadata,omitempty" url:"metadata,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetInventoryChangesResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListEventTypesResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetInventoryChangesResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetInventoryChangesResponse +func (l *ListEventTypesResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListEventTypesResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetInventoryChangesResponse(value) + *l = ListEventTypesResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetInventoryChangesResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListEventTypesResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -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. +// Returns a list of gift card activities. You can optionally specify a filter to retrieve a +// subset of activites. +type ListGiftCardActivitiesRequest struct { + // If a gift card ID is provided, the endpoint returns activities related + // to the specified gift card. Otherwise, the endpoint returns all gift card activities for + // the seller. + GiftCardID *string `json:"gift_card_id,omitempty" url:"gift_card_id,omitempty"` + // If a [type](entity:GiftCardActivityType) is provided, the endpoint returns gift card activities of the specified type. + // Otherwise, the endpoint returns all types of gift card activities. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // If a location ID is provided, the endpoint returns gift card activities for the specified location. + // Otherwise, the endpoint returns gift card activities for all locations. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The timestamp for the beginning of the reporting period, in RFC 3339 format. + // This start time is inclusive. The default value is the current time minus one year. + BeginTime *string `json:"begin_time,omitempty" url:"begin_time,omitempty"` + // The timestamp for the end of the reporting period, in RFC 3339 format. + // This end time is inclusive. The default value is the current time. + EndTime *string `json:"end_time,omitempty" url:"end_time,omitempty"` + // If a limit is provided, the endpoint returns the specified number + // of results (or fewer) per page. The maximum value is 100. The default value is 50. + // For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). + Limit *int `json:"limit,omitempty" url:"limit,omitempty"` + // A pagination cursor returned by a previous call to this endpoint. + // Provide this cursor to retrieve the next set of results for the original query. + // If a cursor is not provided, the endpoint returns the first page of the results. + // For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // The order in which the endpoint returns the activities, based on `created_at`. + // + // - `ASC` - Oldest to newest. + // - `DESC` - Newest to oldest (default). + SortOrder *string `json:"sort_order,omitempty" url:"sort_order,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetInventoryCountResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListGiftCardActivitiesRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetInventoryCountResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetInventoryCountResponse +func (l *ListGiftCardActivitiesRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListGiftCardActivitiesRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetInventoryCountResponse(value) + *l = ListGiftCardActivitiesRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetInventoryCountResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListGiftCardActivitiesRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -type GetInventoryPhysicalCountRequest struct { +// A response that contains a list of `GiftCardActivity` objects. If the request resulted in errors, +// the response contains a set of `Error` objects. +type ListGiftCardActivitiesResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The requested gift card activities or an empty object if none are found. + GiftCardActivities []*GiftCardActivity `json:"gift_card_activities,omitempty" url:"gift_card_activities,omitempty"` + // When a response is truncated, it includes a cursor that you can use in a + // subsequent request to retrieve the next set of activities. If a cursor is not present, this is + // the final response. + // For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetInventoryPhysicalCountRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListGiftCardActivitiesResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetInventoryPhysicalCountRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetInventoryPhysicalCountRequest +func (l *ListGiftCardActivitiesResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListGiftCardActivitiesResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetInventoryPhysicalCountRequest(value) + *l = ListGiftCardActivitiesResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetInventoryPhysicalCountRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListGiftCardActivitiesResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -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"` +// A request to list gift cards. You can optionally specify a filter to retrieve a subset of +// gift cards. +type ListGiftCardsRequest struct { + // If a [type](entity:GiftCardType) is provided, the endpoint returns gift cards of the specified type. + // Otherwise, the endpoint returns gift cards of all types. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // If a [state](entity:GiftCardStatus) is provided, the endpoint returns the gift cards in the specified state. + // Otherwise, the endpoint returns the gift cards of all states. + State *string `json:"state,omitempty" url:"state,omitempty"` + // If a limit is provided, the endpoint returns only the specified number of results per page. + // The maximum value is 200. The default value is 30. + // For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). + Limit *int `json:"limit,omitempty" url:"limit,omitempty"` + // A pagination cursor returned by a previous call to this endpoint. + // Provide this cursor to retrieve the next set of results for the original query. + // If a cursor is not provided, the endpoint returns the first page of the results. + // For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // If a customer ID is provided, the endpoint returns only the gift cards linked to the specified customer. + CustomerID *string `json:"customer_id,omitempty" url:"customer_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetInventoryPhysicalCountResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListGiftCardsRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetInventoryPhysicalCountResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetInventoryPhysicalCountResponse +func (l *ListGiftCardsRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListGiftCardsRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetInventoryPhysicalCountResponse(value) + *l = ListGiftCardsRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetInventoryPhysicalCountResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListGiftCardsRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -type GetInventoryTransferRequest struct { +// A response that contains a list of `GiftCard` objects. If the request resulted in errors, +// the response contains a set of `Error` objects. +type ListGiftCardsResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The requested gift cards or an empty object if none are found. + GiftCards []*GiftCard `json:"gift_cards,omitempty" url:"gift_cards,omitempty"` + // When a response is truncated, it includes a cursor that you can use in a + // subsequent request to retrieve the next set of gift cards. If a cursor is not present, this is + // the final response. + // For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetInventoryTransferRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListGiftCardsResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetInventoryTransferRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetInventoryTransferRequest +func (l *ListGiftCardsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListGiftCardsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetInventoryTransferRequest(value) + *l = ListGiftCardsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetInventoryTransferRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListGiftCardsResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -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"` +// Describes a `ListInvoice` request. +type ListInvoicesRequest struct { + // The ID of the location for which to list invoices. + LocationID string `json:"location_id" url:"location_id"` + // A pagination cursor returned by a previous call to this endpoint. + // Provide this cursor to retrieve the next set of results for your original query. + // + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // The maximum number of invoices to return (200 is the maximum `limit`). + // If not provided, the server uses a default limit of 100 invoices. + Limit *int `json:"limit,omitempty" url:"limit,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetInventoryTransferResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListInvoicesRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetInventoryTransferResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetInventoryTransferResponse +func (l *ListInvoicesRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListInvoicesRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetInventoryTransferResponse(value) + *l = ListInvoicesRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetInventoryTransferResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListInvoicesRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Describes a `GetInvoice` request. -type GetInvoiceRequest struct { +// Describes a `ListInvoice` response. +type ListInvoicesResponse struct { + // The invoices retrieved. + Invoices []*Invoice `json:"invoices,omitempty" url:"invoices,omitempty"` + // When a response is truncated, it includes a cursor that you can use in a + // subsequent request to retrieve the next set of invoices. If empty, this is the final + // response. + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // Information about errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetInvoiceRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListInvoicesResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetInvoiceRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetInvoiceRequest +func (l *ListInvoicesResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListInvoicesResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetInvoiceRequest(value) + *l = ListInvoicesResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetInvoiceRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListInvoicesResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Describes a `GetInvoice` response. -type GetInvoiceResponse struct { - // The invoice requested. - Invoice *Invoice `json:"invoice,omitempty" url:"invoice,omitempty"` - // Information about errors encountered during the request. +type ListLocationBookingProfilesResponse struct { + // The list of a seller's location booking profiles. + LocationBookingProfiles []*LocationBookingProfile `json:"location_booking_profiles,omitempty" url:"location_booking_profiles,omitempty"` + // The pagination cursor to be used in the subsequent request to get the next page of the results. Stop retrieving the next page of the results when the cursor is not set. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // Errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetInvoiceResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListLocationBookingProfilesResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetInvoiceResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetInvoiceResponse +func (l *ListLocationBookingProfilesResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListLocationBookingProfilesResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetInvoiceResponse(value) + *l = ListLocationBookingProfilesResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetInvoiceResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListLocationBookingProfilesResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Defines the fields that are included in the request body for the -// [RetrieveLocation]($e/Locations/RetrieveLocation) endpoint. -type GetLocationRequest struct { +// Represents a [ListLocationCustomAttributeDefinitions](api-endpoint:LocationCustomAttributes-ListLocationCustomAttributeDefinitions) response. +// Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response. +// If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`. +type ListLocationCustomAttributeDefinitionsResponse struct { + // The retrieved custom attribute definitions. If no custom attribute definitions are found, + // Square returns an empty object (`{}`). + CustomAttributeDefinitions []*CustomAttributeDefinition `json:"custom_attribute_definitions,omitempty" url:"custom_attribute_definitions,omitempty"` + // The cursor to provide in your next call to this endpoint to retrieve the next page of + // results for your original request. This field is present only if the request succeeded and + // additional results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetLocationRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListLocationCustomAttributeDefinitionsResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetLocationRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetLocationRequest +func (l *ListLocationCustomAttributeDefinitionsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListLocationCustomAttributeDefinitionsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetLocationRequest(value) + *l = ListLocationCustomAttributeDefinitionsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetLocationRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListLocationCustomAttributeDefinitionsResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Defines the fields that the [RetrieveLocation]($e/Locations/RetrieveLocation) -// endpoint returns in a response. -type GetLocationResponse struct { - // Information about errors encountered during the request. +// Represents a [ListLocationCustomAttributes](api-endpoint:LocationCustomAttributes-ListLocationCustomAttributes) response. +// Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional +// results are available, the `cursor` field is also present along with `custom_attributes`. +type ListLocationCustomAttributesResponse struct { + // The retrieved custom attributes. If `with_definitions` was set to `true` in the request, + // the custom attribute definition is returned in the `definition` field of each custom attribute. + // If no custom attributes are found, Square returns an empty object (`{}`). + CustomAttributes []*CustomAttribute `json:"custom_attributes,omitempty" url:"custom_attributes,omitempty"` + // The cursor to use in your next call to this endpoint to retrieve the next page of results + // for your original request. This field is present only if the request succeeded and additional + // results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The requested location. - Location *Location `json:"location,omitempty" url:"location,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetLocationResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListLocationCustomAttributesResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetLocationResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetLocationResponse +func (l *ListLocationCustomAttributesResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListLocationCustomAttributesResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetLocationResponse(value) + *l = ListLocationCustomAttributesResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetLocationResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListLocationCustomAttributesResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// A request to retrieve a loyalty account. -type GetLoyaltyAccountRequest struct { +// Defines the fields that are included in requests to the +// [ListLocations](api-endpoint:Locations-ListLocations) endpoint. +type ListLocationsRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetLoyaltyAccountRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListLocationsRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetLoyaltyAccountRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetLoyaltyAccountRequest +func (l *ListLocationsRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListLocationsRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetLoyaltyAccountRequest(value) + *l = ListLocationsRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetLoyaltyAccountRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListLocationsRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// A response that includes the loyalty account. -type GetLoyaltyAccountResponse struct { +// Defines the fields that are included in the response body of a request +// to the [ListLocations](api-endpoint:Locations-ListLocations) endpoint. +// +// Either `errors` or `locations` is present in a given response (never both). +type ListLocationsResponse struct { // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The loyalty account. - LoyaltyAccount *LoyaltyAccount `json:"loyalty_account,omitempty" url:"loyalty_account,omitempty"` + // The business locations. + Locations []*Location `json:"locations,omitempty" url:"locations,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetLoyaltyAccountResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListLocationsResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetLoyaltyAccountResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetLoyaltyAccountResponse +func (l *ListLocationsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListLocationsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetLoyaltyAccountResponse(value) + *l = ListLocationsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetLoyaltyAccountResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListLocationsResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// A request to retrieve the [loyalty program]($m/LoyaltyProgram) that belongs to a seller. A seller can have only one loyalty program. -type GetLoyaltyProgramRequest struct { +// A request to list `LoyaltyProgram`. +type ListLoyaltyProgramsRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetLoyaltyProgramRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListLoyaltyProgramsRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetLoyaltyProgramRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetLoyaltyProgramRequest +func (l *ListLoyaltyProgramsRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListLoyaltyProgramsRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetLoyaltyProgramRequest(value) + *l = ListLoyaltyProgramsRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetLoyaltyProgramRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListLoyaltyProgramsRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// A response that contains the loyalty program. -type GetLoyaltyProgramResponse struct { +// A response that contains all loyalty programs. +type ListLoyaltyProgramsResponse struct { // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The loyalty program that was requested. - Program *LoyaltyProgram `json:"program,omitempty" url:"program,omitempty"` + // A list of `LoyaltyProgram` for the merchant. + Programs []*LoyaltyProgram `json:"programs,omitempty" url:"programs,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetLoyaltyProgramResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListLoyaltyProgramsResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetLoyaltyProgramResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetLoyaltyProgramResponse +func (l *ListLoyaltyProgramsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListLoyaltyProgramsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetLoyaltyProgramResponse(value) + *l = ListLoyaltyProgramsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetLoyaltyProgramResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListLoyaltyProgramsResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Represents a [RetrieveLoyaltyPromotionPromotions]($e/Loyalty/RetrieveLoyaltyPromotion) request. -type GetLoyaltyPromotionRequest struct { +// Represents a [ListLoyaltyPromotions](api-endpoint:Loyalty-ListLoyaltyPromotions) request. +type ListLoyaltyPromotionsRequest struct { + // The status to filter the results by. If a status is provided, only loyalty promotions + // with the specified status are returned. Otherwise, all loyalty promotions associated with + // the loyalty program are returned. + // See [LoyaltyPromotionStatus](#type-loyaltypromotionstatus) for possible values + Status *LoyaltyPromotionStatus `json:"status,omitempty" url:"status,omitempty"` + // The cursor returned in the paged response from the previous call to this endpoint. + // Provide this cursor to retrieve the next page of results for your original request. + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // The maximum number of results to return in a single paged response. + // The minimum value is 1 and the maximum value is 30. The default value is 30. + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Limit *int `json:"limit,omitempty" url:"limit,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetLoyaltyPromotionRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListLoyaltyPromotionsRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetLoyaltyPromotionRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetLoyaltyPromotionRequest +func (l *ListLoyaltyPromotionsRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListLoyaltyPromotionsRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetLoyaltyPromotionRequest(value) + *l = ListLoyaltyPromotionsRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetLoyaltyPromotionRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListLoyaltyPromotionsRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Represents a [RetrieveLoyaltyPromotionPromotions]($e/Loyalty/RetrieveLoyaltyPromotion) response. -type GetLoyaltyPromotionResponse struct { +// Represents a [ListLoyaltyPromotions](api-endpoint:Loyalty-ListLoyaltyPromotions) response. +// One of `loyalty_promotions`, an empty object, or `errors` is present in the response. +// If additional results are available, the `cursor` field is also present along with `loyalty_promotions`. +type ListLoyaltyPromotionsResponse struct { // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The retrieved loyalty promotion. - LoyaltyPromotion *LoyaltyPromotion `json:"loyalty_promotion,omitempty" url:"loyalty_promotion,omitempty"` + // The retrieved loyalty promotions. + LoyaltyPromotions []*LoyaltyPromotion `json:"loyalty_promotions,omitempty" url:"loyalty_promotions,omitempty"` + // The cursor to use in your next call to this endpoint to retrieve the next page of results + // for your original request. This field is present only if the request succeeded and additional + // results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetLoyaltyPromotionResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListLoyaltyPromotionsResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetLoyaltyPromotionResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetLoyaltyPromotionResponse +func (l *ListLoyaltyPromotionsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListLoyaltyPromotionsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetLoyaltyPromotionResponse(value) + *l = ListLoyaltyPromotionsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetLoyaltyPromotionResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListLoyaltyPromotionsResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// A request to retrieve a loyalty reward. -type GetLoyaltyRewardRequest struct { +// Represents a [ListMerchantCustomAttributeDefinitions](api-endpoint:MerchantCustomAttributes-ListMerchantCustomAttributeDefinitions) response. +// Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response. +// If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`. +type ListMerchantCustomAttributeDefinitionsResponse struct { + // The retrieved custom attribute definitions. If no custom attribute definitions are found, + // Square returns an empty object (`{}`). + CustomAttributeDefinitions []*CustomAttributeDefinition `json:"custom_attribute_definitions,omitempty" url:"custom_attribute_definitions,omitempty"` + // The cursor to provide in your next call to this endpoint to retrieve the next page of + // results for your original request. This field is present only if the request succeeded and + // additional results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetLoyaltyRewardRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListMerchantCustomAttributeDefinitionsResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetLoyaltyRewardRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetLoyaltyRewardRequest +func (l *ListMerchantCustomAttributeDefinitionsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListMerchantCustomAttributeDefinitionsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetLoyaltyRewardRequest(value) + *l = ListMerchantCustomAttributeDefinitionsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetLoyaltyRewardRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListMerchantCustomAttributeDefinitionsResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// A response that includes the loyalty reward. -type GetLoyaltyRewardResponse struct { +// Represents a [ListMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-ListMerchantCustomAttributes) response. +// Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional +// results are available, the `cursor` field is also present along with `custom_attributes`. +type ListMerchantCustomAttributesResponse struct { + // The retrieved custom attributes. If `with_definitions` was set to `true` in the request, + // the custom attribute definition is returned in the `definition` field of each custom attribute. + // If no custom attributes are found, Square returns an empty object (`{}`). + CustomAttributes []*CustomAttribute `json:"custom_attributes,omitempty" url:"custom_attributes,omitempty"` + // The cursor to use in your next call to this endpoint to retrieve the next page of results + // for your original request. This field is present only if the request succeeded and additional + // results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The loyalty reward retrieved. - Reward *LoyaltyReward `json:"reward,omitempty" url:"reward,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetLoyaltyRewardResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListMerchantCustomAttributesResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetLoyaltyRewardResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetLoyaltyRewardResponse +func (l *ListMerchantCustomAttributesResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListMerchantCustomAttributesResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetLoyaltyRewardResponse(value) + *l = ListMerchantCustomAttributesResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetLoyaltyRewardResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListMerchantCustomAttributesResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Request object for the [RetrieveMerchant]($e/Merchants/RetrieveMerchant) endpoint. -type GetMerchantRequest struct { +// Request object for the [ListMerchant](api-endpoint:Merchants-ListMerchants) endpoint. +type ListMerchantsRequest struct { + // The cursor generated by the previous response. + Cursor *int `json:"cursor,omitempty" url:"cursor,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetMerchantRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListMerchantsRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetMerchantRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetMerchantRequest +func (l *ListMerchantsRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListMerchantsRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetMerchantRequest(value) + *l = ListMerchantsRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetMerchantRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListMerchantsRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// The response object returned by the [RetrieveMerchant]($e/Merchants/RetrieveMerchant) endpoint. -type GetMerchantResponse struct { +// The response object returned by the [ListMerchant](api-endpoint:Merchants-ListMerchants) endpoint. +type ListMerchantsResponse struct { // Information on errors encountered during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The requested `Merchant` object. - Merchant *Merchant `json:"merchant,omitempty" url:"merchant,omitempty"` + // The requested `Merchant` entities. + Merchant []*Merchant `json:"merchant,omitempty" url:"merchant,omitempty"` + // If the response is truncated, the cursor to use in next request to fetch next set of objects. + Cursor *int `json:"cursor,omitempty" url:"cursor,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetMerchantResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListMerchantsResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetMerchantResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetMerchantResponse +func (l *ListMerchantsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListMerchantsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetMerchantResponse(value) + *l = ListMerchantsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetMerchantResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListMerchantsResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -type GetOrderRequest struct { +// Represents a response from listing order custom attribute definitions. +type ListOrderCustomAttributeDefinitionsResponse struct { + // The retrieved custom attribute definitions. If no custom attribute definitions are found, Square returns an empty object (`{}`). + CustomAttributeDefinitions []*CustomAttributeDefinition `json:"custom_attribute_definitions,omitempty" url:"custom_attribute_definitions,omitempty"` + // The cursor to provide in your next call to this endpoint to retrieve the next page of results for your original request. + // This field is present only if the request succeeded and additional results are available. + // For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetOrderRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListOrderCustomAttributeDefinitionsResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetOrderRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetOrderRequest +func (l *ListOrderCustomAttributeDefinitionsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListOrderCustomAttributeDefinitionsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetOrderRequest(value) + *l = ListOrderCustomAttributeDefinitionsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetOrderRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListOrderCustomAttributeDefinitionsResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -type GetOrderResponse struct { - // The requested order. - Order *Order `json:"order,omitempty" url:"order,omitempty"` +// Represents a response from listing order custom attributes. +type ListOrderCustomAttributesResponse struct { + // The retrieved custom attributes. If no custom attribute are found, Square returns an empty object (`{}`). + CustomAttributes []*CustomAttribute `json:"custom_attributes,omitempty" url:"custom_attributes,omitempty"` + // The cursor to provide in your next call to this endpoint to retrieve the next page of results for your original request. + // This field is present only if the request succeeded and additional results are available. + // For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` @@ -27540,340 +43553,485 @@ type GetOrderResponse struct { _rawJSON json.RawMessage } -func (g *GetOrderResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListOrderCustomAttributesResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetOrderResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetOrderResponse +func (l *ListOrderCustomAttributesResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListOrderCustomAttributesResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetOrderResponse(value) + *l = ListOrderCustomAttributesResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetOrderResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListOrderCustomAttributesResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -type GetPaymentLinkRequest struct { +type ListPaymentLinksRequest struct { + // A pagination cursor returned by a previous call to this endpoint. + // Provide this cursor to retrieve the next set of results for the original query. + // If a cursor is not provided, the endpoint returns the first page of the results. + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // A limit on the number of results to return per page. The limit is advisory and + // the implementation might return more or less results. If the supplied limit is negative, zero, or + // greater than the maximum limit of 1000, it is ignored. + // + // Default value: `100` + Limit *int `json:"limit,omitempty" url:"limit,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetPaymentLinkRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListPaymentLinksRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetPaymentLinkRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetPaymentLinkRequest +func (l *ListPaymentLinksRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListPaymentLinksRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetPaymentLinkRequest(value) + *l = ListPaymentLinksRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetPaymentLinkRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListPaymentLinksRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -type GetPaymentLinkResponse struct { - // Any errors that occurred during the request. +type ListPaymentLinksResponse struct { + // Errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The payment link that is retrieved. - PaymentLink *PaymentLink `json:"payment_link,omitempty" url:"payment_link,omitempty"` + // The list of payment links. + PaymentLinks []*PaymentLink `json:"payment_links,omitempty" url:"payment_links,omitempty"` + // When a response is truncated, it includes a cursor that you can use in a subsequent request + // to retrieve the next set of gift cards. If a cursor is not present, this is the final response. + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetPaymentLinkResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListPaymentLinksResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetPaymentLinkResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetPaymentLinkResponse +func (l *ListPaymentLinksResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListPaymentLinksResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetPaymentLinkResponse(value) + *l = ListPaymentLinksResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetPaymentLinkResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListPaymentLinksResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Describes a request to retrieve a refund using -// [GetPaymentRefund]($e/Refunds/GetPaymentRefund). -type GetPaymentRefundRequest struct { +// Describes a request to list refunds using +// [ListPaymentRefunds](api-endpoint:Refunds-ListPaymentRefunds). +// +// The maximum results per page is 100. +type ListPaymentRefundsRequest struct { + // Indicates the start of the time range to retrieve each `PaymentRefund` for, in RFC 3339 + // format. The range is determined using the `created_at` field for each `PaymentRefund`. + // + // Default: The current time minus one year. + BeginTime *string `json:"begin_time,omitempty" url:"begin_time,omitempty"` + // Indicates the end of the time range to retrieve each `PaymentRefund` for, in RFC 3339 + // format. The range is determined using the `created_at` field for each `PaymentRefund`. + // + // Default: The current time. + EndTime *string `json:"end_time,omitempty" url:"end_time,omitempty"` + // The order in which results are listed by `PaymentRefund.created_at`: + // + // - `ASC` - Oldest to newest. + // - `DESC` - Newest to oldest (default). + SortOrder *string `json:"sort_order,omitempty" url:"sort_order,omitempty"` + // A pagination cursor returned by a previous call to this endpoint. + // Provide this cursor to retrieve the next set of results for the original query. + // + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // Limit results to the location supplied. By default, results are returned + // for all locations associated with the seller. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // If provided, only refunds with the given status are returned. + // For a list of refund status values, see [PaymentRefund](entity:PaymentRefund). + // + // Default: If omitted, refunds are returned regardless of their status. + Status *string `json:"status,omitempty" url:"status,omitempty"` + // If provided, only returns refunds whose payments have the indicated source type. + // Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `CASH`, and `EXTERNAL`. + // For information about these payment source types, see + // [Take Payments](https://developer.squareup.com/docs/payments-api/take-payments). + // + // Default: If omitted, refunds are returned regardless of the source type. + SourceType *string `json:"source_type,omitempty" url:"source_type,omitempty"` + // The maximum number of results to be returned in a single page. + // + // It is possible to receive fewer results than the specified limit on a given page. + // + // If the supplied value is greater than 100, no more than 100 results are returned. + // + // Default: 100 + Limit *int `json:"limit,omitempty" url:"limit,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetPaymentRefundRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListPaymentRefundsRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetPaymentRefundRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetPaymentRefundRequest +func (l *ListPaymentRefundsRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListPaymentRefundsRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetPaymentRefundRequest(value) + *l = ListPaymentRefundsRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetPaymentRefundRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListPaymentRefundsRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Defines the response returned by [GetRefund]($e/Refunds/GetPaymentRefund). +// Defines the response returned by [ListPaymentRefunds](api-endpoint:Refunds-ListPaymentRefunds). // -// Note: If there are errors processing the request, the refund field might not be -// present or it might be present in a FAILED state. -type GetPaymentRefundResponse struct { +// Either `errors` or `refunds` is present in a given response (never both). +type ListPaymentRefundsResponse struct { // Information about errors encountered during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The requested `PaymentRefund`. - Refund *PaymentRefund `json:"refund,omitempty" url:"refund,omitempty"` + // The list of requested refunds. + Refunds []*PaymentRefund `json:"refunds,omitempty" url:"refunds,omitempty"` + // The pagination cursor to be used in a subsequent request. If empty, + // this is the final response. + // + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetPaymentRefundResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListPaymentRefundsResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetPaymentRefundResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetPaymentRefundResponse +func (l *ListPaymentRefundsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListPaymentRefundsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetPaymentRefundResponse(value) + *l = ListPaymentRefundsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetPaymentRefundResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListPaymentRefundsResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Describes a request to retrieve a payment using -// [GetPayment]($e/Payments/GetPayment). -type GetPaymentRequest struct { +// Describes a request to list payments using +// [ListPayments](api-endpoint:Payments-ListPayments). +// +// The maximum results per page is 100. +type ListPaymentsRequest struct { + // Indicates the start of the time range to retrieve payments for, in RFC 3339 format. + // The range is determined using the `created_at` field for each Payment. + // Inclusive. Default: The current time minus one year. + BeginTime *string `json:"begin_time,omitempty" url:"begin_time,omitempty"` + // Indicates the end of the time range to retrieve payments for, in RFC 3339 format. The + // range is determined using the `created_at` field for each Payment. + // + // Default: The current time. + EndTime *string `json:"end_time,omitempty" url:"end_time,omitempty"` + // The order in which results are listed by `Payment.created_at`: + // + // - `ASC` - Oldest to newest. + // - `DESC` - Newest to oldest (default). + SortOrder *string `json:"sort_order,omitempty" url:"sort_order,omitempty"` + // A pagination cursor returned by a previous call to this endpoint. + // Provide this cursor to retrieve the next set of results for the original query. + // + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // Limit results to the location supplied. By default, results are returned + // for the default (main) location associated with the seller. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The exact amount in the `total_money` for a payment. + Total *int64 `json:"total,omitempty" url:"total,omitempty"` + // The last four digits of a payment card. + Last4 *string `json:"last_4,omitempty" url:"last_4,omitempty"` + // The brand of the payment card (for example, VISA). + CardBrand *string `json:"card_brand,omitempty" url:"card_brand,omitempty"` + // The maximum number of results to be returned in a single page. + // It is possible to receive fewer results than the specified limit on a given page. + // + // The default value of 100 is also the maximum allowed value. If the provided value is + // greater than 100, it is ignored and the default value is used instead. + // + // Default: `100` + Limit *int `json:"limit,omitempty" url:"limit,omitempty"` + // Whether the payment was taken offline or not. + IsOfflinePayment *bool `json:"is_offline_payment,omitempty" url:"is_offline_payment,omitempty"` + // Indicates the start of the time range for which to retrieve offline payments, in RFC 3339 + // format for timestamps. The range is determined using the + // `offline_payment_details.client_created_at` field for each Payment. If set, payments without a + // value set in `offline_payment_details.client_created_at` will not be returned. + // + // Default: The current time. + OfflineBeginTime *string `json:"offline_begin_time,omitempty" url:"offline_begin_time,omitempty"` + // Indicates the end of the time range for which to retrieve offline payments, in RFC 3339 + // format for timestamps. The range is determined using the + // `offline_payment_details.client_created_at` field for each Payment. If set, payments without a + // value set in `offline_payment_details.client_created_at` will not be returned. + // + // Default: The current time. + OfflineEndTime *string `json:"offline_end_time,omitempty" url:"offline_end_time,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetPaymentRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListPaymentsRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetPaymentRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetPaymentRequest +func (l *ListPaymentsRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListPaymentsRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetPaymentRequest(value) + *l = ListPaymentsRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetPaymentRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListPaymentsRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Defines the response returned by [GetPayment]($e/Payments/GetPayment). -type GetPaymentResponse struct { +// Defines the response returned by [ListPayments](api-endpoint:Payments-ListPayments). +type ListPaymentsResponse struct { // Information about errors encountered during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The requested `Payment`. - Payment *Payment `json:"payment,omitempty" url:"payment,omitempty"` + // The requested list of payments. + Payments []*Payment `json:"payments,omitempty" url:"payments,omitempty"` + // The pagination cursor to be used in a subsequent request. If empty, + // this is the final response. + // + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetPaymentResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListPaymentsResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetPaymentResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetPaymentResponse +func (l *ListPaymentsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListPaymentsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetPaymentResponse(value) + *l = ListPaymentsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetPaymentResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListPaymentsResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -type GetPayoutRequest struct { +type ListPayoutEntriesRequest struct { + // The order in which payout entries are listed. + // See [SortOrder](#type-sortorder) for possible values + SortOrder *SortOrder `json:"sort_order,omitempty" url:"sort_order,omitempty"` + // A pagination cursor returned by a previous call to this endpoint. + // Provide this cursor to retrieve the next set of results for the original query. + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + // If request parameters change between requests, subsequent results may contain duplicates or missing records. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // The maximum number of results to be returned in a single page. + // It is possible to receive fewer results than the specified limit on a given page. + // The default value of 100 is also the maximum allowed value. If the provided value is + // greater than 100, it is ignored and the default value is used instead. + // Default: `100` + Limit *int `json:"limit,omitempty" url:"limit,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetPayoutRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListPayoutEntriesRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetPayoutRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetPayoutRequest +func (l *ListPayoutEntriesRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListPayoutEntriesRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetPayoutRequest(value) + *l = ListPayoutEntriesRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetPayoutRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListPayoutEntriesRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -type GetPayoutResponse struct { - // The requested payout. - Payout *Payout `json:"payout,omitempty" url:"payout,omitempty"` +// The response to retrieve payout records entries. +type ListPayoutEntriesResponse struct { + // The requested list of payout entries, ordered with the given or default sort order. + PayoutEntries []*PayoutEntry `json:"payout_entries,omitempty" url:"payout_entries,omitempty"` + // The pagination cursor to be used in a subsequent request. If empty, this is the final response. + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` // Information about errors encountered during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` @@ -27881,4043 +44039,3671 @@ type GetPayoutResponse struct { _rawJSON json.RawMessage } -func (g *GetPayoutResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListPayoutEntriesResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetPayoutResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetPayoutResponse +func (l *ListPayoutEntriesResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListPayoutEntriesResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetPayoutResponse(value) + *l = ListPayoutEntriesResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetPayoutResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListPayoutEntriesResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// A request to get a `Shift` by ID. -type GetShiftRequest struct { +// A request to retrieve payout records. +type ListPayoutsRequest struct { + // The ID of the location for which to list the payouts. + // By default, payouts are returned for the default (main) location associated with the seller. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // If provided, only payouts with the given status are returned. + Status *PayoutStatus `json:"status,omitempty" url:"status,omitempty"` + // The timestamp for the beginning of the payout creation time, in RFC 3339 format. + // Inclusive. Default: The current time minus one year. + BeginTime *string `json:"begin_time,omitempty" url:"begin_time,omitempty"` + // The timestamp for the end of the payout creation time, in RFC 3339 format. + // Default: The current time. + EndTime *string `json:"end_time,omitempty" url:"end_time,omitempty"` + // The order in which payouts are listed. + // See [SortOrder](#type-sortorder) for possible values + SortOrder *SortOrder `json:"sort_order,omitempty" url:"sort_order,omitempty"` + // A pagination cursor returned by a previous call to this endpoint. + // Provide this cursor to retrieve the next set of results for the original query. + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + // If request parameters change between requests, subsequent results may contain duplicates or missing records. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // The maximum number of results to be returned in a single page. + // It is possible to receive fewer results than the specified limit on a given page. + // The default value of 100 is also the maximum allowed value. If the provided value is + // greater than 100, it is ignored and the default value is used instead. + // Default: `100` + Limit *int `json:"limit,omitempty" url:"limit,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetShiftRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListPayoutsRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetShiftRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetShiftRequest +func (l *ListPayoutsRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListPayoutsRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetShiftRequest(value) + *l = ListPayoutsRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetShiftRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListPayoutsRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// A response to a request to get a `Shift`. The response contains -// the requested `Shift` object and might contain a set of `Error` objects if -// the request resulted in errors. -type GetShiftResponse struct { - // The requested `Shift`. - Shift *Shift `json:"shift,omitempty" url:"shift,omitempty"` - // Any errors that occurred during the request. +// The response to retrieve payout records entries. +type ListPayoutsResponse struct { + // The requested list of payouts. + Payouts []*Payout `json:"payouts,omitempty" url:"payouts,omitempty"` + // The pagination cursor to be used in a subsequent request. If empty, this is the final response. + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // Information about errors encountered during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetShiftResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties -} - -func (g *GetShiftResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetShiftResponse - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *g = GetShiftResponse(value) - - extraProperties, err := core.ExtractExtraProperties(data, *g) - if err != nil { - return err - } - g.extraProperties = extraProperties - - g._rawJSON = json.RawMessage(data) - return nil -} - -func (g *GetShiftResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(g); err == nil { - return value - } - return fmt.Sprintf("%#v", g) -} - -// Represents a `RetrieveSnippet` request. -type GetSnippetRequest struct { - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (g *GetSnippetRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListPayoutsResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetSnippetRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetSnippetRequest +func (l *ListPayoutsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListPayoutsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetSnippetRequest(value) + *l = ListPayoutsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetSnippetRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListPayoutsResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Represents a `RetrieveSnippet` response. The response can include either `snippet` or `errors`. -type GetSnippetResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The retrieved snippet. - Snippet *Snippet `json:"snippet,omitempty" url:"snippet,omitempty"` +// Defines the query parameters that can be included in +// a request to the [ListRefunds](api-endpoint:Transactions-ListRefunds) endpoint. +// +// Deprecated - recommend using [SearchOrders](api-endpoint:Orders-SearchOrders) +type ListRefundsRequest struct { + // The beginning of the requested reporting period, in RFC 3339 format. + // + // See [Date ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for details on date inclusivity/exclusivity. + // + // Default value: The current time minus one year. + BeginTime *string `json:"begin_time,omitempty" url:"begin_time,omitempty"` + // The end of the requested reporting period, in RFC 3339 format. + // + // See [Date ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for details on date inclusivity/exclusivity. + // + // Default value: The current time. + EndTime *string `json:"end_time,omitempty" url:"end_time,omitempty"` + // The order in which results are listed in the response (`ASC` for + // oldest first, `DESC` for newest first). + // + // Default value: `DESC` + // See [SortOrder](#type-sortorder) for possible values + SortOrder *SortOrder `json:"sort_order,omitempty" url:"sort_order,omitempty"` + // A pagination cursor returned by a previous call to this endpoint. + // Provide this to retrieve the next set of results for your original query. + // + // See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetSnippetResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListRefundsRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetSnippetResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetSnippetResponse +func (l *ListRefundsRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListRefundsRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetSnippetResponse(value) + *l = ListRefundsRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetSnippetResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListRefundsRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Defines output parameters in a response from the -// [RetrieveSubscription]($e/Subscriptions/RetrieveSubscription) endpoint. -type GetSubscriptionResponse struct { - // Errors encountered during the request. +// Defines the fields that are included in the response body of +// a request to the [ListRefunds](api-endpoint:Transactions-ListRefunds) endpoint. +// +// One of `errors` or `refunds` is present in a given response (never both). +type ListRefundsResponse struct { + // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The subscription retrieved. - Subscription *Subscription `json:"subscription,omitempty" url:"subscription,omitempty"` + // An array of refunds that match your query. + Refunds []*Refund `json:"refunds,omitempty" url:"refunds,omitempty"` + // A pagination cursor for retrieving the next set of results, + // if any remain. Provide this value as the `cursor` parameter in a subsequent + // request to this endpoint. + // + // See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetSubscriptionResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListRefundsResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetSubscriptionResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetSubscriptionResponse +func (l *ListRefundsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListRefundsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetSubscriptionResponse(value) + *l = ListRefundsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetSubscriptionResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListRefundsResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -type GetTeamMemberBookingProfileRequest struct { +// Represents a `ListSites` request. +type ListSitesRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetTeamMemberBookingProfileRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListSitesRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetTeamMemberBookingProfileRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetTeamMemberBookingProfileRequest +func (l *ListSitesRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListSitesRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetTeamMemberBookingProfileRequest(value) + *l = ListSitesRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetTeamMemberBookingProfileRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListSitesRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -type GetTeamMemberBookingProfileResponse struct { - // The returned team member booking profile. - TeamMemberBookingProfile *TeamMemberBookingProfile `json:"team_member_booking_profile,omitempty" url:"team_member_booking_profile,omitempty"` - // Errors that occurred during the request. +// Represents a `ListSites` response. The response can include either `sites` or `errors`. +type ListSitesResponse struct { + // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The sites that belong to the seller. + Sites []*Site `json:"sites,omitempty" url:"sites,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetTeamMemberBookingProfileResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListSitesResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetTeamMemberBookingProfileResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetTeamMemberBookingProfileResponse +func (l *ListSitesResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListSitesResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetTeamMemberBookingProfileResponse(value) + *l = ListSitesResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetTeamMemberBookingProfileResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListSitesResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Represents a retrieve request for a `TeamMember` object. -type GetTeamMemberRequest struct { +// Defines input parameters in a request to the +// [ListSubscriptionEvents](api-endpoint:Subscriptions-ListSubscriptionEvents) +// endpoint. +type ListSubscriptionEventsRequest struct { + // When the total number of resulting subscription events exceeds the limit of a paged response, + // specify the cursor returned from a preceding response here to fetch the next set of results. + // If the cursor is unset, the response contains the last page of the results. + // + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // The upper limit on the number of subscription events to return + // in a paged response. + Limit *int `json:"limit,omitempty" url:"limit,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetTeamMemberRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListSubscriptionEventsRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetTeamMemberRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetTeamMemberRequest +func (l *ListSubscriptionEventsRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListSubscriptionEventsRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetTeamMemberRequest(value) + *l = ListSubscriptionEventsRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetTeamMemberRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListSubscriptionEventsRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Represents a response from a retrieve request containing a `TeamMember` object or error messages. -type GetTeamMemberResponse struct { - // The successfully retrieved `TeamMember` object. - TeamMember *TeamMember `json:"team_member,omitempty" url:"team_member,omitempty"` - // The errors that occurred during the request. +// Defines output parameters in a response from the +// [ListSubscriptionEvents](api-endpoint:Subscriptions-ListSubscriptionEvents). +type ListSubscriptionEventsResponse struct { + // Errors encountered during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The retrieved subscription events. + SubscriptionEvents []*SubscriptionEvent `json:"subscription_events,omitempty" url:"subscription_events,omitempty"` + // When the total number of resulting subscription events exceeds the limit of a paged response, + // the response includes a cursor for you to use in a subsequent request to fetch the next set of events. + // If the cursor is unset, the response contains the last page of the results. + // + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetTeamMemberResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListSubscriptionEventsResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetTeamMemberResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetTeamMemberResponse +func (l *ListSubscriptionEventsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListSubscriptionEventsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetTeamMemberResponse(value) + *l = ListSubscriptionEventsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetTeamMemberResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListSubscriptionEventsResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// A request to get a `TeamMemberWage`. -type GetTeamMemberWageRequest struct { +type ListTeamMemberBookingProfilesRequest struct { + // Indicates whether to include only bookable team members in the returned result (`true`) or not (`false`). + BookableOnly *bool `json:"bookable_only,omitempty" url:"bookable_only,omitempty"` + // The maximum number of results to return in a paged response. + Limit *int `json:"limit,omitempty" 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:"cursor,omitempty" url:"cursor,omitempty"` + // Indicates whether to include only team members enabled at the given location in the returned result. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetTeamMemberWageRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListTeamMemberBookingProfilesRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetTeamMemberWageRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetTeamMemberWageRequest +func (l *ListTeamMemberBookingProfilesRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListTeamMemberBookingProfilesRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetTeamMemberWageRequest(value) + *l = ListTeamMemberBookingProfilesRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetTeamMemberWageRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListTeamMemberBookingProfilesRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// A response to a request to get a `TeamMemberWage`. The response contains -// the requested `TeamMemberWage` objects and might contain a set of `Error` objects if -// the request resulted in errors. -type GetTeamMemberWageResponse struct { - // The requested `TeamMemberWage` object. - TeamMemberWage *TeamMemberWage `json:"team_member_wage,omitempty" url:"team_member_wage,omitempty"` - // Any errors that occurred during the request. +type ListTeamMemberBookingProfilesResponse struct { + // The list of team member booking profiles. The results are returned in the ascending order of the time + // when the team member booking profiles were last updated. Multiple booking profiles updated at the same time + // are further sorted in the ascending order of their IDs. + TeamMemberBookingProfiles []*TeamMemberBookingProfile `json:"team_member_booking_profiles,omitempty" url:"team_member_booking_profiles,omitempty"` + // The pagination cursor to be used in the subsequent request to get the next page of the results. Stop retrieving the next page of the results when the cursor is not set. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // Errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetTeamMemberWageResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListTeamMemberBookingProfilesResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetTeamMemberWageResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetTeamMemberWageResponse +func (l *ListTeamMemberBookingProfilesResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListTeamMemberBookingProfilesResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetTeamMemberWageResponse(value) + *l = ListTeamMemberBookingProfilesResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetTeamMemberWageResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListTeamMemberBookingProfilesResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -type GetTerminalActionRequest struct { +// A request for a set of `TeamMemberWage` objects. +type ListTeamMemberWagesRequest struct { + // Filter the returned wages to only those that are associated with the + // specified team member. + TeamMemberID *string `json:"team_member_id,omitempty" url:"team_member_id,omitempty"` + // The maximum number of `TeamMemberWage` results to return per page. The number can range between + // 1 and 200. The default is 200. + Limit *int `json:"limit,omitempty" url:"limit,omitempty"` + // A pointer to the next page of `EmployeeWage` results to fetch. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetTerminalActionRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListTeamMemberWagesRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetTerminalActionRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetTerminalActionRequest +func (l *ListTeamMemberWagesRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListTeamMemberWagesRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetTerminalActionRequest(value) + *l = ListTeamMemberWagesRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetTerminalActionRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListTeamMemberWagesRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -type GetTerminalActionResponse struct { - // Information on errors encountered during the request. +// The response to a request for a set of `TeamMemberWage` objects. The response contains +// a set of `TeamMemberWage` objects. +type ListTeamMemberWagesResponse struct { + // A page of `TeamMemberWage` results. + TeamMemberWages []*TeamMemberWage `json:"team_member_wages,omitempty" url:"team_member_wages,omitempty"` + // The value supplied in the subsequent request to fetch the next page + // of `TeamMemberWage` results. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The requested `TerminalAction` - Action *TerminalAction `json:"action,omitempty" url:"action,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetTerminalActionResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListTeamMemberWagesResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetTerminalActionResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetTerminalActionResponse +func (l *ListTeamMemberWagesResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListTeamMemberWagesResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetTerminalActionResponse(value) + *l = ListTeamMemberWagesResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetTerminalActionResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListTeamMemberWagesResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -type GetTerminalCheckoutRequest struct { +// Defines the query parameters that can be included in +// a request to the [ListTransactions](api-endpoint:Transactions-ListTransactions) endpoint. +// +// Deprecated - recommend using [SearchOrders](api-endpoint:Orders-SearchOrders) +type ListTransactionsRequest struct { + // The beginning of the requested reporting period, in RFC 3339 format. + // + // See [Date ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for details on date inclusivity/exclusivity. + // + // Default value: The current time minus one year. + BeginTime *string `json:"begin_time,omitempty" url:"begin_time,omitempty"` + // The end of the requested reporting period, in RFC 3339 format. + // + // See [Date ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for details on date inclusivity/exclusivity. + // + // Default value: The current time. + EndTime *string `json:"end_time,omitempty" url:"end_time,omitempty"` + // The order in which results are listed in the response (`ASC` for + // oldest first, `DESC` for newest first). + // + // Default value: `DESC` + // See [SortOrder](#type-sortorder) for possible values + SortOrder *SortOrder `json:"sort_order,omitempty" url:"sort_order,omitempty"` + // A pagination cursor returned by a previous call to this endpoint. + // Provide this to retrieve the next set of results for your original query. + // + // See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetTerminalCheckoutRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListTransactionsRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetTerminalCheckoutRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetTerminalCheckoutRequest +func (l *ListTransactionsRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListTransactionsRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetTerminalCheckoutRequest(value) + *l = ListTransactionsRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetTerminalCheckoutRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListTransactionsRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -type GetTerminalCheckoutResponse struct { - // Information about errors encountered during the request. +// Defines the fields that are included in the response body of +// a request to the [ListTransactions](api-endpoint:Transactions-ListTransactions) endpoint. +// +// One of `errors` or `transactions` is present in a given response (never both). +type ListTransactionsResponse struct { + // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The requested `TerminalCheckout`. - Checkout *TerminalCheckout `json:"checkout,omitempty" url:"checkout,omitempty"` + // An array of transactions that match your query. + Transactions []*Transaction `json:"transactions,omitempty" url:"transactions,omitempty"` + // A pagination cursor for retrieving the next set of results, + // if any remain. Provide this value as the `cursor` parameter in a subsequent + // request to this endpoint. + // + // See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetTerminalCheckoutResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListTransactionsResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetTerminalCheckoutResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetTerminalCheckoutResponse +func (l *ListTransactionsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListTransactionsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetTerminalCheckoutResponse(value) + *l = ListTransactionsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetTerminalCheckoutResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListTransactionsResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -type GetTerminalRefundRequest struct { +// Lists all webhook event types that can be subscribed to. +type ListWebhookEventTypesRequest struct { + // The API version for which to list event types. Setting this field overrides the default version used by the application. + APIVersion *string `json:"api_version,omitempty" url:"api_version,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetTerminalRefundRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListWebhookEventTypesRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetTerminalRefundRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetTerminalRefundRequest +func (l *ListWebhookEventTypesRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListWebhookEventTypesRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetTerminalRefundRequest(value) + *l = ListWebhookEventTypesRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetTerminalRefundRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListWebhookEventTypesRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -type GetTerminalRefundResponse struct { - // Information about errors encountered during the request. +// Defines the fields that are included in the response body of +// a request to the [ListWebhookEventTypes](api-endpoint:WebhookSubscriptions-ListWebhookEventTypes) endpoint. +// +// Note: if there are errors processing the request, the event types field will not be +// present. +type ListWebhookEventTypesResponse struct { + // Information on errors encountered during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The requested `Refund`. - Refund *TerminalRefund `json:"refund,omitempty" url:"refund,omitempty"` + // The list of event types. + EventTypes []string `json:"event_types,omitempty" url:"event_types,omitempty"` + // Contains the metadata of a webhook event type. For more information, see [EventTypeMetadata](entity:EventTypeMetadata). + Metadata []*EventTypeMetadata `json:"metadata,omitempty" url:"metadata,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetTerminalRefundResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListWebhookEventTypesResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetTerminalRefundResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetTerminalRefundResponse +func (l *ListWebhookEventTypesResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListWebhookEventTypesResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetTerminalRefundResponse(value) + *l = ListWebhookEventTypesResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetTerminalRefundResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListWebhookEventTypesResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -type GetTransactionRequest struct { +// Lists all [Subscription](entity:WebhookSubscription)s owned by your application. +type ListWebhookSubscriptionsRequest struct { + // A pagination cursor returned by a previous call to this endpoint. + // Provide this to retrieve the next set of results for your original query. + // + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // Includes disabled [Subscription](entity:WebhookSubscription)s. + // By default, all enabled [Subscription](entity:WebhookSubscription)s are returned. + IncludeDisabled *bool `json:"include_disabled,omitempty" url:"include_disabled,omitempty"` + // Sorts the returned list by when the [Subscription](entity:WebhookSubscription) was created with the specified order. + // This field defaults to ASC. + // See [SortOrder](#type-sortorder) for possible values + SortOrder *SortOrder `json:"sort_order,omitempty" url:"sort_order,omitempty"` + // The maximum number of results to be returned in a single page. + // It is possible to receive fewer results than the specified limit on a given page. + // The default value of 100 is also the maximum allowed value. + // + // Default: 100 + Limit *int `json:"limit,omitempty" url:"limit,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetTransactionRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListWebhookSubscriptionsRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetTransactionRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetTransactionRequest +func (l *ListWebhookSubscriptionsRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListWebhookSubscriptionsRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetTransactionRequest(value) + *l = ListWebhookSubscriptionsRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetTransactionRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListWebhookSubscriptionsRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } // Defines the fields that are included in the response body of -// a request to the [RetrieveTransaction](api-endpoint:Transactions-RetrieveTransaction) endpoint. +// a request to the [ListWebhookSubscriptions](api-endpoint:WebhookSubscriptions-ListWebhookSubscriptions) endpoint. // -// One of `errors` or `transaction` is present in a given response (never both). -type GetTransactionResponse struct { - // Any errors that occurred during the request. +// Note: if there are errors processing the request, the subscriptions field will not be +// present. +type ListWebhookSubscriptionsResponse struct { + // Information on errors encountered during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The requested transaction. - Transaction *Transaction `json:"transaction,omitempty" url:"transaction,omitempty"` + // The requested list of [Subscription](entity:WebhookSubscription)s. + Subscriptions []*WebhookSubscription `json:"subscriptions,omitempty" url:"subscriptions,omitempty"` + // The pagination cursor to be used in a subsequent request. If empty, + // this is the final response. + // + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetTransactionResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListWebhookSubscriptionsResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetTransactionResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetTransactionResponse +func (l *ListWebhookSubscriptionsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListWebhookSubscriptionsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetTransactionResponse(value) + *l = ListWebhookSubscriptionsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetTransactionResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListWebhookSubscriptionsResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Represents an input to a call to [RetrieveVendor]($e/Vendors/RetrieveVendor). -type GetVendorRequest struct { +// A request for a set of `WorkweekConfig` objects. +type ListWorkweekConfigsRequest struct { + // The maximum number of `WorkweekConfigs` results to return per page. + Limit *int `json:"limit,omitempty" url:"limit,omitempty"` + // A pointer to the next page of `WorkweekConfig` results to fetch. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetVendorRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListWorkweekConfigsRequest) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetVendorRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetVendorRequest +func (l *ListWorkweekConfigsRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ListWorkweekConfigsRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetVendorRequest(value) + *l = ListWorkweekConfigsRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetVendorRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListWorkweekConfigsRequest) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Represents an output from a call to [RetrieveVendor]($e/Vendors/RetrieveVendor). -type GetVendorResponse struct { - // Errors encountered when the request fails. +// The response to a request for a set of `WorkweekConfig` objects. The response contains +// the requested `WorkweekConfig` objects and might contain a set of `Error` objects if +// the request resulted in errors. +type ListWorkweekConfigsResponse struct { + // A page of `WorkweekConfig` results. + WorkweekConfigs []*WorkweekConfig `json:"workweek_configs,omitempty" url:"workweek_configs,omitempty"` + // The value supplied in the subsequent request to fetch the next page of + // `WorkweekConfig` results. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The successfully retrieved [Vendor](entity:Vendor) object. - Vendor *Vendor `json:"vendor,omitempty" url:"vendor,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetVendorResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *ListWorkweekConfigsResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetVendorResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetVendorResponse +func (l *ListWorkweekConfigsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ListWorkweekConfigsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetVendorResponse(value) + *l = ListWorkweekConfigsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetVendorResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *ListWorkweekConfigsResponse) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Represents a retrieve request for the wage setting of a team member. -type GetWageSettingRequest struct { +// Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). +type Location struct { + // A short generated string of letters and numbers that uniquely identifies this location instance. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The name of the location. + // This information appears in the Seller Dashboard as the nickname. + // A location name must be unique within a seller account. + Name *string `json:"name,omitempty" url:"name,omitempty"` + // The physical address of the location. + Address *Address `json:"address,omitempty" url:"address,omitempty"` + // The [IANA time zone](https://www.iana.org/time-zones) identifier for + // the time zone of the location. For example, `America/Los_Angeles`. + Timezone *string `json:"timezone,omitempty" url:"timezone,omitempty"` + // The Square features that are enabled for the location. + // See [LocationCapability](entity:LocationCapability) for possible values. + // See [LocationCapability](#type-locationcapability) for possible values + Capabilities []LocationCapability `json:"capabilities,omitempty" url:"capabilities,omitempty"` + // The status of the location. + // See [LocationStatus](#type-locationstatus) for possible values + Status *LocationStatus `json:"status,omitempty" url:"status,omitempty"` + // The time when the location was created, in RFC 3339 format. + // For more information, see [Working with Dates](https://developer.squareup.com/docs/build-basics/working-with-dates). + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The ID of the merchant that owns the location. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The country of the location, in the two-letter format of ISO 3166. For example, `US` or `JP`. + // + // See [Country](entity:Country) for possible values. + // See [Country](#type-country) for possible values + Country *Country `json:"country,omitempty" url:"country,omitempty"` + // The language associated with the location, in + // [BCP 47 format](https://tools.ietf.org/html/bcp47#appendix-A). + // For more information, see [Language Preferences](https://developer.squareup.com/docs/build-basics/general-considerations/language-preferences). + LanguageCode *string `json:"language_code,omitempty" url:"language_code,omitempty"` + // The currency used for all transactions at this location, + // in ISO 4217 format. For example, the currency code for US dollars is `USD`. + // See [Currency](entity:Currency) for possible values. + // See [Currency](#type-currency) for possible values + Currency *Currency `json:"currency,omitempty" url:"currency,omitempty"` + // The phone number of the location. For example, `+1 855-700-6000`. + PhoneNumber *string `json:"phone_number,omitempty" url:"phone_number,omitempty"` + // The name of the location's overall business. This name is present on receipts and other customer-facing branding, and can be changed no more than three times in a twelve-month period. + BusinessName *string `json:"business_name,omitempty" url:"business_name,omitempty"` + // The type of the location. + // See [LocationType](#type-locationtype) for possible values + Type *LocationType `json:"type,omitempty" url:"type,omitempty"` + // The website URL of the location. For example, `https://squareup.com`. + WebsiteURL *string `json:"website_url,omitempty" url:"website_url,omitempty"` + // The hours of operation for the location. + BusinessHours *BusinessHours `json:"business_hours,omitempty" url:"business_hours,omitempty"` + // The email address of the location. This can be unique to the location and is not always the email address for the business owner or administrator. + BusinessEmail *string `json:"business_email,omitempty" url:"business_email,omitempty"` + // The description of the location. For example, `Main Street location`. + Description *string `json:"description,omitempty" url:"description,omitempty"` + // The Twitter username of the location without the '@' symbol. For example, `Square`. + TwitterUsername *string `json:"twitter_username,omitempty" url:"twitter_username,omitempty"` + // The Instagram username of the location without the '@' symbol. For example, `square`. + InstagramUsername *string `json:"instagram_username,omitempty" url:"instagram_username,omitempty"` + // The Facebook profile URL of the location. The URL should begin with 'facebook.com/'. For example, `https://www.facebook.com/square`. + FacebookURL *string `json:"facebook_url,omitempty" url:"facebook_url,omitempty"` + // The physical coordinates (latitude and longitude) of the location. + Coordinates *Coordinates `json:"coordinates,omitempty" url:"coordinates,omitempty"` + // The URL of the logo image for the location. When configured in the Seller + // Dashboard (Receipts section), the logo appears on transactions (such as receipts and invoices) that Square generates on behalf of the seller. + // This image should have a roughly square (1:1) aspect ratio and should be at least 200x200 pixels. + LogoURL *string `json:"logo_url,omitempty" url:"logo_url,omitempty"` + // The URL of the Point of Sale background image for the location. + PosBackgroundURL *string `json:"pos_background_url,omitempty" url:"pos_background_url,omitempty"` + // A four-digit number that describes the kind of goods or services sold at the location. + // The [merchant category code (MCC)](https://developer.squareup.com/docs/locations-api#initialize-a-merchant-category-code) of the location as standardized by ISO 18245. + // For example, `5045`, for a location that sells computer goods and software. + Mcc *string `json:"mcc,omitempty" url:"mcc,omitempty"` + // The URL of a full-format logo image for the location. When configured in the Seller + // Dashboard (Receipts section), the logo appears on transactions (such as receipts and invoices) that Square generates on behalf of the seller. + // This image can be wider than it is tall and should be at least 1280x648 pixels. + FullFormatLogoURL *string `json:"full_format_logo_url,omitempty" url:"full_format_logo_url,omitempty"` + // The tax IDs for this location. + TaxIDs *TaxIDs `json:"tax_ids,omitempty" url:"tax_ids,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetWageSettingRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *Location) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetWageSettingRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetWageSettingRequest +func (l *Location) UnmarshalJSON(data []byte) error { + type unmarshaler Location var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetWageSettingRequest(value) + *l = Location(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetWageSettingRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *Location) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Represents a response from a retrieve request containing the specified `WageSetting` object or error messages. -type GetWageSettingResponse struct { - // The successfully retrieved `WageSetting` object. - WageSetting *WageSetting `json:"wage_setting,omitempty" url:"wage_setting,omitempty"` - // The errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// The booking profile of a seller's location, including the location's ID and whether the location is enabled for online booking. +type LocationBookingProfile struct { + // The ID of the [location](entity:Location). + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // Url for the online booking site for this location. + BookingSiteURL *string `json:"booking_site_url,omitempty" url:"booking_site_url,omitempty"` + // Indicates whether the location is enabled for online booking. + OnlineBookingEnabled *bool `json:"online_booking_enabled,omitempty" url:"online_booking_enabled,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetWageSettingResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *LocationBookingProfile) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetWageSettingResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetWageSettingResponse +func (l *LocationBookingProfile) UnmarshalJSON(data []byte) error { + type unmarshaler LocationBookingProfile var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetWageSettingResponse(value) + *l = LocationBookingProfile(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetWageSettingResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *LocationBookingProfile) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Retrieves a [Subscription]($m/WebhookSubscription) using its id. -type GetWebhookSubscriptionRequest struct { +// The capabilities a location might have. +type LocationCapability string + +const ( + LocationCapabilityCreditCardProcessing LocationCapability = "CREDIT_CARD_PROCESSING" + LocationCapabilityAutomaticTransfers LocationCapability = "AUTOMATIC_TRANSFERS" + LocationCapabilityUnlinkedRefunds LocationCapability = "UNLINKED_REFUNDS" +) + +func NewLocationCapabilityFromString(s string) (LocationCapability, error) { + switch s { + case "CREDIT_CARD_PROCESSING": + return LocationCapabilityCreditCardProcessing, nil + case "AUTOMATIC_TRANSFERS": + return LocationCapabilityAutomaticTransfers, nil + case "UNLINKED_REFUNDS": + return LocationCapabilityUnlinkedRefunds, nil + } + var t LocationCapability + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (l LocationCapability) Ptr() *LocationCapability { + return &l +} + +// Published when a [Location](entity:Location) is created. +type LocationCreatedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The ID of the [Location](entity:Location) associated with the event. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The type of event this represents, `"location.created"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *LocationCreatedEventData `json:"data,omitempty" url:"data,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetWebhookSubscriptionRequest) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *LocationCreatedEvent) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetWebhookSubscriptionRequest) UnmarshalJSON(data []byte) error { - type unmarshaler GetWebhookSubscriptionRequest +func (l *LocationCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler LocationCreatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetWebhookSubscriptionRequest(value) + *l = LocationCreatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetWebhookSubscriptionRequest) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *LocationCreatedEvent) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Defines the fields that are included in the response body of -// a request to the [RetrieveWebhookSubscription]($e/WebhookSubscriptions/RetrieveWebhookSubscription) endpoint. -// -// Note: if there are errors processing the request, the [Subscription]($m/WebhookSubscription) will not be -// present. -type GetWebhookSubscriptionResponse struct { - // Information on errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The requested [Subscription](entity:WebhookSubscription). - Subscription *WebhookSubscription `json:"subscription,omitempty" url:"subscription,omitempty"` +type LocationCreatedEventData struct { + // Name of the affected object’s type, `"location"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the updated [Location](entity:Location). + ID *string `json:"id,omitempty" url:"id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GetWebhookSubscriptionResponse) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *LocationCreatedEventData) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GetWebhookSubscriptionResponse) UnmarshalJSON(data []byte) error { - type unmarshaler GetWebhookSubscriptionResponse +func (l *LocationCreatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler LocationCreatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GetWebhookSubscriptionResponse(value) + *l = LocationCreatedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GetWebhookSubscriptionResponse) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *LocationCreatedEventData) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Represents a Square gift card. -type GiftCard struct { - // The Square-assigned ID of the gift card. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The gift card type. - // See [Type](#type-type) for possible values - Type GiftCardType `json:"type" url:"type"` - // The source that generated the gift card account number (GAN). The default value is `SQUARE`. - // See [GANSource](#type-gansource) for possible values - GanSource *GiftCardGanSource `json:"gan_source,omitempty" url:"gan_source,omitempty"` - // The current gift card state. - // See [Status](#type-status) for possible values - State *GiftCardStatus `json:"state,omitempty" url:"state,omitempty"` - // The current gift card balance. This balance is always greater than or equal to zero. - BalanceMoney *Money `json:"balance_money,omitempty" url:"balance_money,omitempty"` - // The gift card account number (GAN). Buyers can use the GAN to make purchases or check - // the gift card balance. - Gan *string `json:"gan,omitempty" url:"gan,omitempty"` - // The timestamp when the gift card was created, in RFC 3339 format. - // In the case of a digital gift card, it is the time when you create a card - // (using the Square Point of Sale application, Seller Dashboard, or Gift Cards API). - // In the case of a plastic gift card, it is the time when Square associates the card with the - // seller at the time of activation. +// Published when a location [custom attribute definition](entity:CustomAttributeDefinition) +// is created by the subscribing application. +type LocationCustomAttributeDefinitionOwnedCreatedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"location.custom_attribute_definition.owned.created"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The IDs of the [customer profiles](entity:Customer) to whom this gift card is linked. - CustomerIDs []string `json:"customer_ids,omitempty" url:"customer_ids,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GiftCard) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *LocationCustomAttributeDefinitionOwnedCreatedEvent) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GiftCard) UnmarshalJSON(data []byte) error { - type unmarshaler GiftCard +func (l *LocationCustomAttributeDefinitionOwnedCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler LocationCustomAttributeDefinitionOwnedCreatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GiftCard(value) + *l = LocationCustomAttributeDefinitionOwnedCreatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GiftCard) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(g); err == nil { - return value - } - return fmt.Sprintf("%#v", g) -} - -// Represents an action performed on a [gift card]($m/GiftCard) that affects its state or balance. -// A gift card activity contains information about a specific activity type. For example, a `REDEEM` activity -// includes a `redeem_activity_details` field that contains information about the redemption. -type GiftCardActivity struct { - // The Square-assigned ID of the gift card activity. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The type of gift card activity. - // See [Type](#type-type) for possible values - Type GiftCardActivityType `json:"type" url:"type"` - // The ID of the [business location](entity:Location) where the activity occurred. - LocationID string `json:"location_id" url:"location_id"` - // The timestamp when the gift card activity was created, in RFC 3339 format. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The gift card ID. When creating a gift card activity, `gift_card_id` is not required if - // `gift_card_gan` is specified. - GiftCardID *string `json:"gift_card_id,omitempty" url:"gift_card_id,omitempty"` - // The gift card account number (GAN). When creating a gift card activity, `gift_card_gan` - // is not required if `gift_card_id` is specified. - GiftCardGan *string `json:"gift_card_gan,omitempty" url:"gift_card_gan,omitempty"` - // The final balance on the gift card after the action is completed. - GiftCardBalanceMoney *Money `json:"gift_card_balance_money,omitempty" url:"gift_card_balance_money,omitempty"` - // Additional details about a `LOAD` activity, which is used to reload money onto a gift card. - LoadActivityDetails *GiftCardActivityLoad `json:"load_activity_details,omitempty" url:"load_activity_details,omitempty"` - // Additional details about an `ACTIVATE` activity, which is used to activate a gift card with - // an initial balance. - ActivateActivityDetails *GiftCardActivityActivate `json:"activate_activity_details,omitempty" url:"activate_activity_details,omitempty"` - // Additional details about a `REDEEM` activity, which is used to redeem a gift card for a purchase. - // - // For applications that process payments using the Square Payments API, Square creates a `REDEEM` activity that - // updates the gift card balance after the corresponding [CreatePayment](api-endpoint:Payments-CreatePayment) - // request is completed. Applications that use a custom payment processing system must call - // [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) to create the `REDEEM` activity. - RedeemActivityDetails *GiftCardActivityRedeem `json:"redeem_activity_details,omitempty" url:"redeem_activity_details,omitempty"` - // Additional details about a `CLEAR_BALANCE` activity, which is used to set the balance of a gift card to zero. - ClearBalanceActivityDetails *GiftCardActivityClearBalance `json:"clear_balance_activity_details,omitempty" url:"clear_balance_activity_details,omitempty"` - // Additional details about a `DEACTIVATE` activity, which is used to deactivate a gift card. - DeactivateActivityDetails *GiftCardActivityDeactivate `json:"deactivate_activity_details,omitempty" url:"deactivate_activity_details,omitempty"` - // Additional details about an `ADJUST_INCREMENT` activity, which is used to add money to a gift card - // outside of a typical `ACTIVATE`, `LOAD`, or `REFUND` activity flow. - AdjustIncrementActivityDetails *GiftCardActivityAdjustIncrement `json:"adjust_increment_activity_details,omitempty" url:"adjust_increment_activity_details,omitempty"` - // Additional details about an `ADJUST_DECREMENT` activity, which is used to deduct money from a gift - // card outside of a typical `REDEEM` activity flow. - AdjustDecrementActivityDetails *GiftCardActivityAdjustDecrement `json:"adjust_decrement_activity_details,omitempty" url:"adjust_decrement_activity_details,omitempty"` - // Additional details about a `REFUND` activity, which is used to add money to a gift card when - // refunding a payment. - // - // For applications that refund payments to a gift card using the Square Refunds API, Square automatically - // creates a `REFUND` activity that updates the gift card balance after a [RefundPayment](api-endpoint:Refunds-RefundPayment) - // request is completed. Applications that use a custom processing system must call - // [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) to create the `REFUND` activity. - RefundActivityDetails *GiftCardActivityRefund `json:"refund_activity_details,omitempty" url:"refund_activity_details,omitempty"` - // Additional details about an `UNLINKED_ACTIVITY_REFUND` activity. This activity is used to add money - // to a gift card when refunding a payment that was processed using a custom payment processing system - // and not linked to the gift card. - UnlinkedActivityRefundActivityDetails *GiftCardActivityUnlinkedActivityRefund `json:"unlinked_activity_refund_activity_details,omitempty" url:"unlinked_activity_refund_activity_details,omitempty"` - // Additional details about an `IMPORT` activity, which Square uses to import a third-party - // gift card with a balance. - ImportActivityDetails *GiftCardActivityImport `json:"import_activity_details,omitempty" url:"import_activity_details,omitempty"` - // Additional details about a `BLOCK` activity, which Square uses to temporarily block a gift card. - BlockActivityDetails *GiftCardActivityBlock `json:"block_activity_details,omitempty" url:"block_activity_details,omitempty"` - // Additional details about an `UNBLOCK` activity, which Square uses to unblock a gift card. - UnblockActivityDetails *GiftCardActivityUnblock `json:"unblock_activity_details,omitempty" url:"unblock_activity_details,omitempty"` - // Additional details about an `IMPORT_REVERSAL` activity, which Square uses to reverse the - // import of a third-party gift card. - ImportReversalActivityDetails *GiftCardActivityImportReversal `json:"import_reversal_activity_details,omitempty" url:"import_reversal_activity_details,omitempty"` - // Additional details about a `TRANSFER_BALANCE_TO` activity, which Square uses to add money to - // a gift card as the result of a transfer from another gift card. - TransferBalanceToActivityDetails *GiftCardActivityTransferBalanceTo `json:"transfer_balance_to_activity_details,omitempty" url:"transfer_balance_to_activity_details,omitempty"` - // Additional details about a `TRANSFER_BALANCE_FROM` activity, which Square uses to deduct money from - // a gift as the result of a transfer to another gift card. - TransferBalanceFromActivityDetails *GiftCardActivityTransferBalanceFrom `json:"transfer_balance_from_activity_details,omitempty" url:"transfer_balance_from_activity_details,omitempty"` +func (l *LocationCustomAttributeDefinitionOwnedCreatedEvent) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(l); err == nil { + return value + } + return fmt.Sprintf("%#v", l) +} + +// Published when a location [custom attribute definition](entity:CustomAttributeDefinition) +// created by the subscribing application is deleted. A custom attribute definition can only be deleted by +// the application that created it. +type LocationCustomAttributeDefinitionOwnedDeletedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"location.custom_attribute_definition.owned.deleted"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GiftCardActivity) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *LocationCustomAttributeDefinitionOwnedDeletedEvent) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GiftCardActivity) UnmarshalJSON(data []byte) error { - type unmarshaler GiftCardActivity +func (l *LocationCustomAttributeDefinitionOwnedDeletedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler LocationCustomAttributeDefinitionOwnedDeletedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GiftCardActivity(value) + *l = LocationCustomAttributeDefinitionOwnedDeletedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GiftCardActivity) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *LocationCustomAttributeDefinitionOwnedDeletedEvent) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Represents details about an `ACTIVATE` [gift card activity type]($m/GiftCardActivityType). -type GiftCardActivityActivate struct { - // The amount added to the gift card. This value is a positive integer. - // - // Applications that use a custom order processing system must specify this amount in the - // [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. - AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` - // The ID of the [order](entity:Order) that contains the `GIFT_CARD` line item. - // - // Applications that use the Square Orders API to process orders must specify the order ID - // [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. - OrderID *string `json:"order_id,omitempty" url:"order_id,omitempty"` - // The UID of the `GIFT_CARD` line item in the order that represents the gift card purchase. - // - // Applications that use the Square Orders API to process orders must specify the line item UID - // in the [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. - LineItemUID *string `json:"line_item_uid,omitempty" url:"line_item_uid,omitempty"` - // A client-specified ID that associates the gift card activity with an entity in another system. - // - // Applications that use a custom order processing system can use this field to track information - // related to an order or payment. - ReferenceID *string `json:"reference_id,omitempty" url:"reference_id,omitempty"` - // The payment instrument IDs used to process the gift card purchase, such as a credit card ID - // or bank account ID. - // - // Applications that use a custom order processing system must specify payment instrument IDs in - // the [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. - // Square uses this information to perform compliance checks. - // - // For applications that use the Square Orders API to process payments, Square has the necessary - // instrument IDs to perform compliance checks. - // - // Each buyer payment instrument ID can contain a maximum of 255 characters. - BuyerPaymentInstrumentIDs []string `json:"buyer_payment_instrument_ids,omitempty" url:"buyer_payment_instrument_ids,omitempty"` +// Published when a location [custom attribute definition](entity:CustomAttributeDefinition) +// created by the subscribing application is updated. A custom attribute definition can only be updated +// by the application that created it. +type LocationCustomAttributeDefinitionOwnedUpdatedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"location.custom_attribute_definition.owned.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GiftCardActivityActivate) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *LocationCustomAttributeDefinitionOwnedUpdatedEvent) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GiftCardActivityActivate) UnmarshalJSON(data []byte) error { - type unmarshaler GiftCardActivityActivate +func (l *LocationCustomAttributeDefinitionOwnedUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler LocationCustomAttributeDefinitionOwnedUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GiftCardActivityActivate(value) + *l = LocationCustomAttributeDefinitionOwnedUpdatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GiftCardActivityActivate) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *LocationCustomAttributeDefinitionOwnedUpdatedEvent) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Represents details about an `ADJUST_DECREMENT` [gift card activity type]($m/GiftCardActivityType). -type GiftCardActivityAdjustDecrement struct { - // The amount deducted from the gift card balance. This value is a positive integer. - AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` - // The reason the gift card balance was adjusted. - // See [Reason](#type-reason) for possible values - Reason GiftCardActivityAdjustDecrementReason `json:"reason" url:"reason"` +// Published when a location [custom attribute definition](entity:CustomAttributeDefinition) +// that is visible to the subscribing application is created. A notification is sent when your application +// creates a custom attribute definition or another application creates a custom attribute definition whose +// `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. +type LocationCustomAttributeDefinitionVisibleCreatedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"location.custom_attribute_definition.visible.created"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GiftCardActivityAdjustDecrement) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *LocationCustomAttributeDefinitionVisibleCreatedEvent) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GiftCardActivityAdjustDecrement) UnmarshalJSON(data []byte) error { - type unmarshaler GiftCardActivityAdjustDecrement +func (l *LocationCustomAttributeDefinitionVisibleCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler LocationCustomAttributeDefinitionVisibleCreatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GiftCardActivityAdjustDecrement(value) + *l = LocationCustomAttributeDefinitionVisibleCreatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GiftCardActivityAdjustDecrement) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *LocationCustomAttributeDefinitionVisibleCreatedEvent) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) -} - -// Indicates the reason for deducting money from a [gift card]($m/GiftCard). -type GiftCardActivityAdjustDecrementReason string - -const ( - GiftCardActivityAdjustDecrementReasonSuspiciousActivity GiftCardActivityAdjustDecrementReason = "SUSPICIOUS_ACTIVITY" - GiftCardActivityAdjustDecrementReasonBalanceAccidentallyIncreased GiftCardActivityAdjustDecrementReason = "BALANCE_ACCIDENTALLY_INCREASED" - GiftCardActivityAdjustDecrementReasonSupportIssue GiftCardActivityAdjustDecrementReason = "SUPPORT_ISSUE" - GiftCardActivityAdjustDecrementReasonPurchaseWasRefunded GiftCardActivityAdjustDecrementReason = "PURCHASE_WAS_REFUNDED" -) - -func NewGiftCardActivityAdjustDecrementReasonFromString(s string) (GiftCardActivityAdjustDecrementReason, error) { - switch s { - case "SUSPICIOUS_ACTIVITY": - return GiftCardActivityAdjustDecrementReasonSuspiciousActivity, nil - case "BALANCE_ACCIDENTALLY_INCREASED": - return GiftCardActivityAdjustDecrementReasonBalanceAccidentallyIncreased, nil - case "SUPPORT_ISSUE": - return GiftCardActivityAdjustDecrementReasonSupportIssue, nil - case "PURCHASE_WAS_REFUNDED": - return GiftCardActivityAdjustDecrementReasonPurchaseWasRefunded, nil - } - var t GiftCardActivityAdjustDecrementReason - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (g GiftCardActivityAdjustDecrementReason) Ptr() *GiftCardActivityAdjustDecrementReason { - return &g + return fmt.Sprintf("%#v", l) } -// Represents details about an `ADJUST_INCREMENT` [gift card activity type]($m/GiftCardActivityType). -type GiftCardActivityAdjustIncrement struct { - // The amount added to the gift card balance. This value is a positive integer. - AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` - // The reason the gift card balance was adjusted. - // See [Reason](#type-reason) for possible values - Reason GiftCardActivityAdjustIncrementReason `json:"reason" url:"reason"` +// Published when a location [custom attribute definition](entity:CustomAttributeDefinition) +// that is visible to the subscribing application is deleted. A custom attribute definition can only +// be deleted by the application that created it. A notification is sent when your application deletes +// a custom attribute definition or when another application deletes a custom attribute definition whose +// `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. +type LocationCustomAttributeDefinitionVisibleDeletedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"location.custom_attribute_definition.visible.deleted"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GiftCardActivityAdjustIncrement) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *LocationCustomAttributeDefinitionVisibleDeletedEvent) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GiftCardActivityAdjustIncrement) UnmarshalJSON(data []byte) error { - type unmarshaler GiftCardActivityAdjustIncrement +func (l *LocationCustomAttributeDefinitionVisibleDeletedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler LocationCustomAttributeDefinitionVisibleDeletedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GiftCardActivityAdjustIncrement(value) + *l = LocationCustomAttributeDefinitionVisibleDeletedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GiftCardActivityAdjustIncrement) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *LocationCustomAttributeDefinitionVisibleDeletedEvent) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) -} - -// Indicates the reason for adding money to a [gift card]($m/GiftCard). -type GiftCardActivityAdjustIncrementReason string - -const ( - GiftCardActivityAdjustIncrementReasonComplimentary GiftCardActivityAdjustIncrementReason = "COMPLIMENTARY" - GiftCardActivityAdjustIncrementReasonSupportIssue GiftCardActivityAdjustIncrementReason = "SUPPORT_ISSUE" - GiftCardActivityAdjustIncrementReasonTransactionVoided GiftCardActivityAdjustIncrementReason = "TRANSACTION_VOIDED" -) - -func NewGiftCardActivityAdjustIncrementReasonFromString(s string) (GiftCardActivityAdjustIncrementReason, error) { - switch s { - case "COMPLIMENTARY": - return GiftCardActivityAdjustIncrementReasonComplimentary, nil - case "SUPPORT_ISSUE": - return GiftCardActivityAdjustIncrementReasonSupportIssue, nil - case "TRANSACTION_VOIDED": - return GiftCardActivityAdjustIncrementReasonTransactionVoided, nil - } - var t GiftCardActivityAdjustIncrementReason - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (g GiftCardActivityAdjustIncrementReason) Ptr() *GiftCardActivityAdjustIncrementReason { - return &g + return fmt.Sprintf("%#v", l) } -// Represents details about a `BLOCK` [gift card activity type]($m/GiftCardActivityType). -type GiftCardActivityBlock struct { - // The reason the gift card was blocked. - // See [Reason](#type-reason) for possible values - Reason GiftCardActivityBlockReason `json:"reason,omitempty" url:"reason,omitempty"` +// Published when a location [custom attribute definition](entity:CustomAttributeDefinition) +// that is visible to the subscribing application is updated. A custom attribute definition can only be updated +// by the application that created it. A notification is sent when your application updates a custom attribute +// definition or when another application updates a custom attribute definition whose `visibility` is +// `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. +type LocationCustomAttributeDefinitionVisibleUpdatedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"location.custom_attribute_definition.visible.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GiftCardActivityBlock) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *LocationCustomAttributeDefinitionVisibleUpdatedEvent) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GiftCardActivityBlock) UnmarshalJSON(data []byte) error { - type unmarshaler GiftCardActivityBlock +func (l *LocationCustomAttributeDefinitionVisibleUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler LocationCustomAttributeDefinitionVisibleUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GiftCardActivityBlock(value) + *l = LocationCustomAttributeDefinitionVisibleUpdatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GiftCardActivityBlock) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *LocationCustomAttributeDefinitionVisibleUpdatedEvent) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Indicates the reason for blocking a [gift card]($m/GiftCard). -type GiftCardActivityBlockReason = string - -// Represents details about a `CLEAR_BALANCE` [gift card activity type]($m/GiftCardActivityType). -type GiftCardActivityClearBalance struct { - // The reason the gift card balance was cleared. - // See [Reason](#type-reason) for possible values - Reason GiftCardActivityClearBalanceReason `json:"reason" url:"reason"` +// Published when a location [custom attribute](entity:CustomAttribute) +// owned by the subscribing application is deleted. Custom attributes are owned by the +// application that created the corresponding [custom attribute definition](entity:CustomAttributeDefinition). +// Custom attributes whose `visibility` is `VISIBILITY_READ_WRITE_VALUES` can be deleted by any application. +type LocationCustomAttributeOwnedDeletedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"location.custom_attribute.owned.deleted"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GiftCardActivityClearBalance) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *LocationCustomAttributeOwnedDeletedEvent) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GiftCardActivityClearBalance) UnmarshalJSON(data []byte) error { - type unmarshaler GiftCardActivityClearBalance +func (l *LocationCustomAttributeOwnedDeletedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler LocationCustomAttributeOwnedDeletedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GiftCardActivityClearBalance(value) + *l = LocationCustomAttributeOwnedDeletedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GiftCardActivityClearBalance) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *LocationCustomAttributeOwnedDeletedEvent) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) -} - -// Indicates the reason for clearing the balance of a [gift card]($m/GiftCard). -type GiftCardActivityClearBalanceReason string - -const ( - GiftCardActivityClearBalanceReasonSuspiciousActivity GiftCardActivityClearBalanceReason = "SUSPICIOUS_ACTIVITY" - GiftCardActivityClearBalanceReasonReuseGiftcard GiftCardActivityClearBalanceReason = "REUSE_GIFTCARD" - GiftCardActivityClearBalanceReasonUnknownReason GiftCardActivityClearBalanceReason = "UNKNOWN_REASON" -) - -func NewGiftCardActivityClearBalanceReasonFromString(s string) (GiftCardActivityClearBalanceReason, error) { - switch s { - case "SUSPICIOUS_ACTIVITY": - return GiftCardActivityClearBalanceReasonSuspiciousActivity, nil - case "REUSE_GIFTCARD": - return GiftCardActivityClearBalanceReasonReuseGiftcard, nil - case "UNKNOWN_REASON": - return GiftCardActivityClearBalanceReasonUnknownReason, nil - } - var t GiftCardActivityClearBalanceReason - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (g GiftCardActivityClearBalanceReason) Ptr() *GiftCardActivityClearBalanceReason { - return &g + return fmt.Sprintf("%#v", l) } -// Represents details about a `DEACTIVATE` [gift card activity type]($m/GiftCardActivityType). -type GiftCardActivityDeactivate struct { - // The reason the gift card was deactivated. - // See [Reason](#type-reason) for possible values - Reason GiftCardActivityDeactivateReason `json:"reason" url:"reason"` +// Published when a location [custom attribute](entity:CustomAttribute) owned by the +// subscribing application is created or updated. Custom attributes are owned by the application that created +// the corresponding [custom attribute definition](entity:CustomAttributeDefinition). Custom attributes whose +// `visibility` is `VISIBILITY_READ_WRITE_VALUES` can be created or updated by any application. +type LocationCustomAttributeOwnedUpdatedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"location.custom_attribute.owned.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GiftCardActivityDeactivate) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *LocationCustomAttributeOwnedUpdatedEvent) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GiftCardActivityDeactivate) UnmarshalJSON(data []byte) error { - type unmarshaler GiftCardActivityDeactivate +func (l *LocationCustomAttributeOwnedUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler LocationCustomAttributeOwnedUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GiftCardActivityDeactivate(value) + *l = LocationCustomAttributeOwnedUpdatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GiftCardActivityDeactivate) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *LocationCustomAttributeOwnedUpdatedEvent) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) -} - -// Indicates the reason for deactivating a [gift card]($m/GiftCard). -type GiftCardActivityDeactivateReason string - -const ( - GiftCardActivityDeactivateReasonSuspiciousActivity GiftCardActivityDeactivateReason = "SUSPICIOUS_ACTIVITY" - GiftCardActivityDeactivateReasonUnknownReason GiftCardActivityDeactivateReason = "UNKNOWN_REASON" - GiftCardActivityDeactivateReasonChargebackDeactivate GiftCardActivityDeactivateReason = "CHARGEBACK_DEACTIVATE" -) - -func NewGiftCardActivityDeactivateReasonFromString(s string) (GiftCardActivityDeactivateReason, error) { - switch s { - case "SUSPICIOUS_ACTIVITY": - return GiftCardActivityDeactivateReasonSuspiciousActivity, nil - case "UNKNOWN_REASON": - return GiftCardActivityDeactivateReasonUnknownReason, nil - case "CHARGEBACK_DEACTIVATE": - return GiftCardActivityDeactivateReasonChargebackDeactivate, nil - } - var t GiftCardActivityDeactivateReason - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (g GiftCardActivityDeactivateReason) Ptr() *GiftCardActivityDeactivateReason { - return &g + return fmt.Sprintf("%#v", l) } -// Represents details about an `IMPORT` [gift card activity type]($m/GiftCardActivityType). -// This activity type is used when Square imports a third-party gift card, in which case the -// `gan_source` of the gift card is set to `OTHER`. -type GiftCardActivityImport struct { - // The balance amount on the imported gift card. - AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` +// Published when a location [custom attribute](entity:CustomAttribute) that is visible to the +// subscribing application is deleted. A notification is sent when: +// +// - Your application deletes a custom attribute owned by your application, regardless of the `visibility` setting. +// - Any application deletes a custom attribute whose `visibility` is `VISIBILITY_READ_ONLY` +// or `VISIBILITY_READ_WRITE_VALUES`. +// +// Custom attributes set to `VISIBILITY_READ_WRITE_VALUES` can be deleted by any application, but those set to +// `VISIBILITY_READ_ONLY` or `VISIBILITY_HIDDEN` can only be deleted by the owner. Custom attributes are owned +// by the application that created the corresponding [custom attribute definition](entity:CustomAttributeDefinition). +type LocationCustomAttributeVisibleDeletedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"location.custom_attribute.visible.deleted"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GiftCardActivityImport) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *LocationCustomAttributeVisibleDeletedEvent) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GiftCardActivityImport) UnmarshalJSON(data []byte) error { - type unmarshaler GiftCardActivityImport +func (l *LocationCustomAttributeVisibleDeletedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler LocationCustomAttributeVisibleDeletedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GiftCardActivityImport(value) + *l = LocationCustomAttributeVisibleDeletedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GiftCardActivityImport) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *LocationCustomAttributeVisibleDeletedEvent) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Represents details about an `IMPORT_REVERSAL` [gift card activity type]($m/GiftCardActivityType). -type GiftCardActivityImportReversal struct { - // The amount of money cleared from the third-party gift card when - // the import was reversed. - AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` +// Published when a location [custom attribute](entity:CustomAttribute) that is visible +// to the subscribing application is created or updated. A notification is sent when: +// +// - Your application creates or updates a custom attribute owned by your application, regardless of the `visibility` setting. +// - Any application creates or updates a custom attribute whose `visibility` is `VISIBILITY_READ_ONLY` +// or `VISIBILITY_READ_WRITE_VALUES`. +// +// Custom attributes set to `VISIBILITY_READ_WRITE_VALUES` can be created or updated by any application, but those set to +// `VISIBILITY_READ_ONLY` or `VISIBILITY_HIDDEN` can only be created or updated by the owner. Custom attributes are owned +// by the application that created the corresponding [custom attribute definition](entity:CustomAttributeDefinition). +type LocationCustomAttributeVisibleUpdatedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"location.custom_attribute.visible.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GiftCardActivityImportReversal) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *LocationCustomAttributeVisibleUpdatedEvent) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GiftCardActivityImportReversal) UnmarshalJSON(data []byte) error { - type unmarshaler GiftCardActivityImportReversal +func (l *LocationCustomAttributeVisibleUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler LocationCustomAttributeVisibleUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GiftCardActivityImportReversal(value) + *l = LocationCustomAttributeVisibleUpdatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GiftCardActivityImportReversal) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *LocationCustomAttributeVisibleUpdatedEvent) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Represents details about a `LOAD` [gift card activity type]($m/GiftCardActivityType). -type GiftCardActivityLoad struct { - // The amount added to the gift card. This value is a positive integer. - // - // Applications that use a custom order processing system must specify this amount in the - // [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. - AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` - // The ID of the [order](entity:Order) that contains the `GIFT_CARD` line item. - // - // Applications that use the Square Orders API to process orders must specify the order ID in the - // [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. - OrderID *string `json:"order_id,omitempty" url:"order_id,omitempty"` - // The UID of the `GIFT_CARD` line item in the order that represents the additional funds for the gift card. - // - // Applications that use the Square Orders API to process orders must specify the line item UID - // in the [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. - LineItemUID *string `json:"line_item_uid,omitempty" url:"line_item_uid,omitempty"` - // A client-specified ID that associates the gift card activity with an entity in another system. - // - // Applications that use a custom order processing system can use this field to track information related to - // an order or payment. - ReferenceID *string `json:"reference_id,omitempty" url:"reference_id,omitempty"` - // The payment instrument IDs used to process the order for the additional funds, such as a credit card ID - // or bank account ID. - // - // Applications that use a custom order processing system must specify payment instrument IDs in - // the [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. - // Square uses this information to perform compliance checks. - // - // For applications that use the Square Orders API to process payments, Square has the necessary - // instrument IDs to perform compliance checks. - // - // Each buyer payment instrument ID can contain a maximum of 255 characters. - BuyerPaymentInstrumentIDs []string `json:"buyer_payment_instrument_ids,omitempty" url:"buyer_payment_instrument_ids,omitempty"` +// Published when online checkout location settings are updated +type LocationSettingsUpdatedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents, `"online_checkout.location_settings.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // RFC 3339 timestamp of when the event was created. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *LocationSettingsUpdatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GiftCardActivityLoad) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *LocationSettingsUpdatedEvent) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GiftCardActivityLoad) UnmarshalJSON(data []byte) error { - type unmarshaler GiftCardActivityLoad +func (l *LocationSettingsUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler LocationSettingsUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GiftCardActivityLoad(value) + *l = LocationSettingsUpdatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GiftCardActivityLoad) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *LocationSettingsUpdatedEvent) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Represents details about a `REDEEM` [gift card activity type]($m/GiftCardActivityType). -type GiftCardActivityRedeem struct { - // The amount deducted from the gift card for the redemption. This value is a positive integer. - // - // Applications that use a custom payment processing system must specify this amount in the - // [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. - AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` - // The ID of the payment that represents the gift card redemption. Square populates this field - // if the payment was processed by Square. - PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` - // A client-specified ID that associates the gift card activity with an entity in another system. - // - // Applications that use a custom payment processing system can use this field to track information - // related to an order or payment. - ReferenceID *string `json:"reference_id,omitempty" url:"reference_id,omitempty"` - // The status of the gift card redemption. Gift cards redeemed from Square Point of Sale or the - // Square Seller Dashboard use a two-state process: `PENDING` - // to `COMPLETED` or `PENDING` to `CANCELED`. Gift cards redeemed using the Gift Card Activities API - // always have a `COMPLETED` status. - // See [Status](#type-status) for possible values - Status *GiftCardActivityRedeemStatus `json:"status,omitempty" url:"status,omitempty"` +type LocationSettingsUpdatedEventData struct { + // Name of the updated object’s type, `"online_checkout.location_settings"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the updated location settings. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the updated location settings. + Object *LocationSettingsUpdatedEventObject `json:"object,omitempty" url:"object,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (l *LocationSettingsUpdatedEventData) GetExtraProperties() map[string]interface{} { + return l.extraProperties +} + +func (l *LocationSettingsUpdatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler LocationSettingsUpdatedEventData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *l = LocationSettingsUpdatedEventData(value) + + extraProperties, err := core.ExtractExtraProperties(data, *l) + if err != nil { + return err + } + l.extraProperties = extraProperties + + l._rawJSON = json.RawMessage(data) + return nil +} + +func (l *LocationSettingsUpdatedEventData) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(l); err == nil { + return value + } + return fmt.Sprintf("%#v", l) +} + +type LocationSettingsUpdatedEventObject struct { + // The updated location settings. + LocationSettings *CheckoutLocationSettings `json:"location_settings,omitempty" url:"location_settings,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GiftCardActivityRedeem) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *LocationSettingsUpdatedEventObject) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GiftCardActivityRedeem) UnmarshalJSON(data []byte) error { - type unmarshaler GiftCardActivityRedeem +func (l *LocationSettingsUpdatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler LocationSettingsUpdatedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GiftCardActivityRedeem(value) + *l = LocationSettingsUpdatedEventObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GiftCardActivityRedeem) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *LocationSettingsUpdatedEventObject) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Indicates the status of a [gift card]($m/GiftCard) redemption. This status is relevant only for -// redemptions made from Square products (such as Square Point of Sale) because Square products use a -// two-state process. Gift cards redeemed using the Gift Card Activities API always have a `COMPLETED` status. -type GiftCardActivityRedeemStatus string +// A location's status. +type LocationStatus string const ( - GiftCardActivityRedeemStatusPending GiftCardActivityRedeemStatus = "PENDING" - GiftCardActivityRedeemStatusCompleted GiftCardActivityRedeemStatus = "COMPLETED" - GiftCardActivityRedeemStatusCanceled GiftCardActivityRedeemStatus = "CANCELED" + LocationStatusActive LocationStatus = "ACTIVE" + LocationStatusInactive LocationStatus = "INACTIVE" ) -func NewGiftCardActivityRedeemStatusFromString(s string) (GiftCardActivityRedeemStatus, error) { +func NewLocationStatusFromString(s string) (LocationStatus, error) { switch s { - case "PENDING": - return GiftCardActivityRedeemStatusPending, nil - case "COMPLETED": - return GiftCardActivityRedeemStatusCompleted, nil - case "CANCELED": - return GiftCardActivityRedeemStatusCanceled, nil + case "ACTIVE": + return LocationStatusActive, nil + case "INACTIVE": + return LocationStatusInactive, nil } - var t GiftCardActivityRedeemStatus + var t LocationStatus return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (g GiftCardActivityRedeemStatus) Ptr() *GiftCardActivityRedeemStatus { - return &g +func (l LocationStatus) Ptr() *LocationStatus { + return &l } -// Represents details about a `REFUND` [gift card activity type]($m/GiftCardActivityType). -type GiftCardActivityRefund struct { - // The ID of the refunded `REDEEM` gift card activity. Square populates this field if the - // `payment_id` in the corresponding [RefundPayment](api-endpoint:Refunds-RefundPayment) request - // represents a gift card redemption. - // - // For applications that use a custom payment processing system, this field is required when creating - // a `REFUND` activity. The provided `REDEEM` activity ID must be linked to the same gift card. - RedeemActivityID *string `json:"redeem_activity_id,omitempty" url:"redeem_activity_id,omitempty"` - // The amount added to the gift card for the refund. This value is a positive integer. - // - // This field is required when creating a `REFUND` activity. The amount can represent a full or partial refund. - AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` - // A client-specified ID that associates the gift card activity with an entity in another system. - ReferenceID *string `json:"reference_id,omitempty" url:"reference_id,omitempty"` - // The ID of the refunded payment. Square populates this field if the refund is for a - // payment processed by Square. This field matches the `payment_id` in the corresponding - // [RefundPayment](api-endpoint:Refunds-RefundPayment) request. - PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` +// A location's type. +type LocationType string + +const ( + LocationTypePhysical LocationType = "PHYSICAL" + LocationTypeMobile LocationType = "MOBILE" +) + +func NewLocationTypeFromString(s string) (LocationType, error) { + switch s { + case "PHYSICAL": + return LocationTypePhysical, nil + case "MOBILE": + return LocationTypeMobile, nil + } + var t LocationType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (l LocationType) Ptr() *LocationType { + return &l +} + +// Published when a [Location](entity:Location) is updated. +type LocationUpdatedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The ID of the [Location](entity:Location) associated with the event. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The type of event this represents, `"location.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *LocationUpdatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GiftCardActivityRefund) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *LocationUpdatedEvent) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GiftCardActivityRefund) UnmarshalJSON(data []byte) error { - type unmarshaler GiftCardActivityRefund +func (l *LocationUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler LocationUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GiftCardActivityRefund(value) + *l = LocationUpdatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GiftCardActivityRefund) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *LocationUpdatedEvent) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Represents details about a `TRANSFER_BALANCE_FROM` [gift card activity type]($m/GiftCardActivityType). -type GiftCardActivityTransferBalanceFrom struct { - // The ID of the gift card to which the specified amount was transferred. - TransferToGiftCardID string `json:"transfer_to_gift_card_id" url:"transfer_to_gift_card_id"` - // The amount deducted from the gift card for the transfer. This value is a positive integer. - AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` +type LocationUpdatedEventData struct { + // Name of the affected object’s type, `"location"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the updated [Location](entity:Location). + ID *string `json:"id,omitempty" url:"id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GiftCardActivityTransferBalanceFrom) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *LocationUpdatedEventData) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GiftCardActivityTransferBalanceFrom) UnmarshalJSON(data []byte) error { - type unmarshaler GiftCardActivityTransferBalanceFrom +func (l *LocationUpdatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler LocationUpdatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GiftCardActivityTransferBalanceFrom(value) + *l = LocationUpdatedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GiftCardActivityTransferBalanceFrom) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *LocationUpdatedEventData) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Represents details about a `TRANSFER_BALANCE_TO` [gift card activity type]($m/GiftCardActivityType). -type GiftCardActivityTransferBalanceTo struct { - // The ID of the gift card from which the specified amount was transferred. - TransferFromGiftCardID string `json:"transfer_from_gift_card_id" url:"transfer_from_gift_card_id"` - // The amount added to the gift card balance for the transfer. This value is a positive integer. - AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` +// Describes a loyalty account in a [loyalty program](entity:LoyaltyProgram). For more information, see +// [Create and Retrieve Loyalty Accounts](https://developer.squareup.com/docs/loyalty-api/loyalty-accounts). +type LoyaltyAccount struct { + // The Square-assigned ID of the loyalty account. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The list of mappings that the account is associated with. + // Currently, a buyer can only be mapped to a loyalty account using + // a phone number. Therefore, the list can only have one mapping. + // RETIRED at version 2021-05-13. Replaced by the `mapping` field. + Mappings []*LoyaltyAccountMapping `json:"mappings,omitempty" url:"mappings,omitempty"` + // The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram) to which the account belongs. + ProgramID string `json:"program_id" url:"program_id"` + // The available point balance in the loyalty account. If points are scheduled to expire, they are listed in the `expiring_point_deadlines` field. + // + // Your application should be able to handle loyalty accounts that have a negative point balance (`balance` is less than 0). This might occur if a seller makes a manual adjustment or as a result of a refund or exchange. + Balance *int `json:"balance,omitempty" url:"balance,omitempty"` + // The total points accrued during the lifetime of the account. + LifetimePoints *int `json:"lifetime_points,omitempty" url:"lifetime_points,omitempty"` + // The Square-assigned ID of the [customer](entity:Customer) that is associated with the account. + CustomerID *string `json:"customer_id,omitempty" url:"customer_id,omitempty"` + // The timestamp when the buyer joined the loyalty program, in RFC 3339 format. This field is used to display the **Enrolled On** or **Member Since** date in first-party Square products. + // + // If this field is not set in a `CreateLoyaltyAccount` request, Square populates it after the buyer's first action on their account + // (when `AccumulateLoyaltyPoints` or `CreateLoyaltyReward` is called). In first-party flows, Square populates the field when the buyer agrees to the terms of service in Square Point of Sale. + // + // This field is typically specified in a `CreateLoyaltyAccount` request when creating a loyalty account for a buyer who already interacted with their account. + // For example, you would set this field when migrating accounts from an external system. The timestamp in the request can represent a current or previous date and time, but it cannot be set for the future. + EnrolledAt *string `json:"enrolled_at,omitempty" url:"enrolled_at,omitempty"` + // The timestamp when the loyalty account was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The timestamp when the loyalty account was last updated, in RFC 3339 format. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // The mapping that associates the loyalty account with a buyer. Currently, + // a loyalty account can only be mapped to a buyer by phone number. + // + // To create a loyalty account, you must specify the `mapping` field, with the buyer's phone number + // in the `phone_number` field. + Mapping *LoyaltyAccountMapping `json:"mapping,omitempty" url:"mapping,omitempty"` + // The schedule for when points expire in the loyalty account balance. This field is present only if the account has points that are scheduled to expire. + // + // The total number of points in this field equals the number of points in the `balance` field. + ExpiringPointDeadlines []*LoyaltyAccountExpiringPointDeadline `json:"expiring_point_deadlines,omitempty" url:"expiring_point_deadlines,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GiftCardActivityTransferBalanceTo) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *LoyaltyAccount) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GiftCardActivityTransferBalanceTo) UnmarshalJSON(data []byte) error { - type unmarshaler GiftCardActivityTransferBalanceTo +func (l *LoyaltyAccount) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyAccount var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GiftCardActivityTransferBalanceTo(value) + *l = LoyaltyAccount(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GiftCardActivityTransferBalanceTo) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *LoyaltyAccount) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) -} - -// Indicates the type of [gift card activity]($m/GiftCardActivity). -type GiftCardActivityType string - -const ( - GiftCardActivityTypeActivate GiftCardActivityType = "ACTIVATE" - GiftCardActivityTypeLoad GiftCardActivityType = "LOAD" - GiftCardActivityTypeRedeem GiftCardActivityType = "REDEEM" - GiftCardActivityTypeClearBalance GiftCardActivityType = "CLEAR_BALANCE" - GiftCardActivityTypeDeactivate GiftCardActivityType = "DEACTIVATE" - GiftCardActivityTypeAdjustIncrement GiftCardActivityType = "ADJUST_INCREMENT" - GiftCardActivityTypeAdjustDecrement GiftCardActivityType = "ADJUST_DECREMENT" - GiftCardActivityTypeRefund GiftCardActivityType = "REFUND" - GiftCardActivityTypeUnlinkedActivityRefund GiftCardActivityType = "UNLINKED_ACTIVITY_REFUND" - GiftCardActivityTypeImport GiftCardActivityType = "IMPORT" - GiftCardActivityTypeBlock GiftCardActivityType = "BLOCK" - GiftCardActivityTypeUnblock GiftCardActivityType = "UNBLOCK" - GiftCardActivityTypeImportReversal GiftCardActivityType = "IMPORT_REVERSAL" - GiftCardActivityTypeTransferBalanceFrom GiftCardActivityType = "TRANSFER_BALANCE_FROM" - GiftCardActivityTypeTransferBalanceTo GiftCardActivityType = "TRANSFER_BALANCE_TO" -) - -func NewGiftCardActivityTypeFromString(s string) (GiftCardActivityType, error) { - switch s { - case "ACTIVATE": - return GiftCardActivityTypeActivate, nil - case "LOAD": - return GiftCardActivityTypeLoad, nil - case "REDEEM": - return GiftCardActivityTypeRedeem, nil - case "CLEAR_BALANCE": - return GiftCardActivityTypeClearBalance, nil - case "DEACTIVATE": - return GiftCardActivityTypeDeactivate, nil - case "ADJUST_INCREMENT": - return GiftCardActivityTypeAdjustIncrement, nil - case "ADJUST_DECREMENT": - return GiftCardActivityTypeAdjustDecrement, nil - case "REFUND": - return GiftCardActivityTypeRefund, nil - case "UNLINKED_ACTIVITY_REFUND": - return GiftCardActivityTypeUnlinkedActivityRefund, nil - case "IMPORT": - return GiftCardActivityTypeImport, nil - case "BLOCK": - return GiftCardActivityTypeBlock, nil - case "UNBLOCK": - return GiftCardActivityTypeUnblock, nil - case "IMPORT_REVERSAL": - return GiftCardActivityTypeImportReversal, nil - case "TRANSFER_BALANCE_FROM": - return GiftCardActivityTypeTransferBalanceFrom, nil - case "TRANSFER_BALANCE_TO": - return GiftCardActivityTypeTransferBalanceTo, nil - } - var t GiftCardActivityType - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (g GiftCardActivityType) Ptr() *GiftCardActivityType { - return &g + return fmt.Sprintf("%#v", l) } -// Represents details about an `UNBLOCK` [gift card activity type]($m/GiftCardActivityType). -type GiftCardActivityUnblock struct { - // The reason the gift card was unblocked. - // See [Reason](#type-reason) for possible values - Reason GiftCardActivityUnblockReason `json:"reason,omitempty" url:"reason,omitempty"` +// Published when a [loyalty account](entity:LoyaltyAccount) is created. +type LoyaltyAccountCreatedEvent struct { + // The ID of the Square seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event. For this event, the value is `loyalty.account.created`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The unique ID for the event, which is used for + // [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *LoyaltyAccountCreatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GiftCardActivityUnblock) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *LoyaltyAccountCreatedEvent) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GiftCardActivityUnblock) UnmarshalJSON(data []byte) error { - type unmarshaler GiftCardActivityUnblock +func (l *LoyaltyAccountCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyAccountCreatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GiftCardActivityUnblock(value) + *l = LoyaltyAccountCreatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GiftCardActivityUnblock) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *LoyaltyAccountCreatedEvent) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Indicates the reason for unblocking a [gift card]($m/GiftCard). -type GiftCardActivityUnblockReason = string - -// Represents details about an `UNLINKED_ACTIVITY_REFUND` [gift card activity type]($m/GiftCardActivityType). -type GiftCardActivityUnlinkedActivityRefund struct { - // The amount added to the gift card for the refund. This value is a positive integer. - AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` - // A client-specified ID that associates the gift card activity with an entity in another system. - ReferenceID *string `json:"reference_id,omitempty" url:"reference_id,omitempty"` - // The ID of the refunded payment. This field is not used starting in Square version 2022-06-16. - PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` +// The data associated with a `loyalty.account.created` event. +type LoyaltyAccountCreatedEventData struct { + // The type of object affected by the event. For this event, the value is `loyalty_account`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The ID of the affected loyalty account. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object that contains the new loyalty account. + Object *LoyaltyAccountCreatedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (g *GiftCardActivityUnlinkedActivityRefund) GetExtraProperties() map[string]interface{} { - return g.extraProperties +func (l *LoyaltyAccountCreatedEventData) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (g *GiftCardActivityUnlinkedActivityRefund) UnmarshalJSON(data []byte) error { - type unmarshaler GiftCardActivityUnlinkedActivityRefund +func (l *LoyaltyAccountCreatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyAccountCreatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *g = GiftCardActivityUnlinkedActivityRefund(value) + *l = LoyaltyAccountCreatedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *g) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - g.extraProperties = extraProperties + l.extraProperties = extraProperties - g._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (g *GiftCardActivityUnlinkedActivityRefund) String() string { - if len(g._rawJSON) > 0 { - if value, err := core.StringifyJSON(g._rawJSON); err == nil { +func (l *LoyaltyAccountCreatedEventData) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(g); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", g) + return fmt.Sprintf("%#v", l) } -// Indicates the source that generated the gift card -// account number (GAN). -type GiftCardGanSource string - -const ( - GiftCardGanSourceSquare GiftCardGanSource = "SQUARE" - GiftCardGanSourceOther GiftCardGanSource = "OTHER" -) +type LoyaltyAccountCreatedEventObject struct { + // The loyalty account that was created. + LoyaltyAccount *LoyaltyAccount `json:"loyalty_account,omitempty" url:"loyalty_account,omitempty"` -func NewGiftCardGanSourceFromString(s string) (GiftCardGanSource, error) { - switch s { - case "SQUARE": - return GiftCardGanSourceSquare, nil - case "OTHER": - return GiftCardGanSourceOther, nil - } - var t GiftCardGanSource - return "", fmt.Errorf("%s is not a valid %T", s, t) + extraProperties map[string]interface{} + _rawJSON json.RawMessage } -func (g GiftCardGanSource) Ptr() *GiftCardGanSource { - return &g +func (l *LoyaltyAccountCreatedEventObject) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -// Indicates the gift card state. -type GiftCardStatus string +func (l *LoyaltyAccountCreatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyAccountCreatedEventObject + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *l = LoyaltyAccountCreatedEventObject(value) -const ( - GiftCardStatusActive GiftCardStatus = "ACTIVE" - GiftCardStatusDeactivated GiftCardStatus = "DEACTIVATED" - GiftCardStatusBlocked GiftCardStatus = "BLOCKED" - GiftCardStatusPending GiftCardStatus = "PENDING" -) + extraProperties, err := core.ExtractExtraProperties(data, *l) + if err != nil { + return err + } + l.extraProperties = extraProperties -func NewGiftCardStatusFromString(s string) (GiftCardStatus, error) { - switch s { - case "ACTIVE": - return GiftCardStatusActive, nil - case "DEACTIVATED": - return GiftCardStatusDeactivated, nil - case "BLOCKED": - return GiftCardStatusBlocked, nil - case "PENDING": - return GiftCardStatusPending, nil + l._rawJSON = json.RawMessage(data) + return nil +} + +func (l *LoyaltyAccountCreatedEventObject) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { + return value + } } - var t GiftCardStatus - return "", fmt.Errorf("%s is not a valid %T", s, t) + if value, err := core.StringifyJSON(l); err == nil { + return value + } + return fmt.Sprintf("%#v", l) } -func (g GiftCardStatus) Ptr() *GiftCardStatus { - return &g +// Published when a [loyalty account](entity:LoyaltyAccount) is deleted. +type LoyaltyAccountDeletedEvent struct { + // The ID of the Square seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event. For this event, the value is `loyalty.account.deleted`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The unique ID for the event, which is used for + // [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *LoyaltyAccountDeletedEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage } -// Indicates the gift card type. -type GiftCardType string +func (l *LoyaltyAccountDeletedEvent) GetExtraProperties() map[string]interface{} { + return l.extraProperties +} -const ( - GiftCardTypePhysical GiftCardType = "PHYSICAL" - GiftCardTypeDigital GiftCardType = "DIGITAL" -) +func (l *LoyaltyAccountDeletedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyAccountDeletedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *l = LoyaltyAccountDeletedEvent(value) -func NewGiftCardTypeFromString(s string) (GiftCardType, error) { - switch s { - case "PHYSICAL": - return GiftCardTypePhysical, nil - case "DIGITAL": - return GiftCardTypeDigital, nil + extraProperties, err := core.ExtractExtraProperties(data, *l) + if err != nil { + return err } - var t GiftCardType - return "", fmt.Errorf("%s is not a valid %T", s, t) -} + l.extraProperties = extraProperties -func (g GiftCardType) Ptr() *GiftCardType { - return &g + l._rawJSON = json.RawMessage(data) + return nil } -// 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"` +func (l *LoyaltyAccountDeletedEvent) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(l); err == nil { + return value + } + return fmt.Sprintf("%#v", l) +} + +// The data associated with a `loyalty.account.deleted` event. +type LoyaltyAccountDeletedEventData struct { + // The type of object affected by the event. For this event, the value is `loyalty_account`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The ID of the affected loyalty account. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object that contains the loyalty account that was deleted. + Object *LoyaltyAccountDeletedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (i *InventoryAdjustment) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (l *LoyaltyAccountDeletedEventData) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (i *InventoryAdjustment) UnmarshalJSON(data []byte) error { - type unmarshaler InventoryAdjustment +func (l *LoyaltyAccountDeletedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyAccountDeletedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *i = InventoryAdjustment(value) + *l = LoyaltyAccountDeletedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *i) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - i.extraProperties = extraProperties + l.extraProperties = extraProperties - i._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (i *InventoryAdjustment) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (l *LoyaltyAccountDeletedEventData) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", i) + return fmt.Sprintf("%#v", l) } -type InventoryAdjustmentGroup struct { - // A unique ID generated by Square for the - // `InventoryAdjustmentGroup`. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The inventory adjustment of the composed variation. - RootAdjustmentID *string `json:"root_adjustment_id,omitempty" url:"root_adjustment_id,omitempty"` - // Representative `from_state` for adjustments within the group. For example, for a group adjustment from `IN_STOCK` to `SOLD`, - // there can be two component adjustments in the group: one from `IN_STOCK`to `COMPOSED` and the other one from `COMPOSED` to `SOLD`. - // Here, the representative `from_state` for the `InventoryAdjustmentGroup` is `IN_STOCK`. - // See [InventoryState](#type-inventorystate) for possible values - FromState *InventoryState `json:"from_state,omitempty" url:"from_state,omitempty"` - // Representative `to_state` for adjustments within group. For example, for a group adjustment from `IN_STOCK` to `SOLD`, - // the two component adjustments in the group can be from `IN_STOCK` to `COMPOSED` and from `COMPOSED` to `SOLD`. - // Here, the representative `to_state` of the `InventoryAdjustmentGroup` is `SOLD`. - // See [InventoryState](#type-inventorystate) for possible values - ToState *InventoryState `json:"to_state,omitempty" url:"to_state,omitempty"` +type LoyaltyAccountDeletedEventObject struct { + // The loyalty account that was deleted. + LoyaltyAccount *LoyaltyAccount `json:"loyalty_account,omitempty" url:"loyalty_account,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (i *InventoryAdjustmentGroup) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (l *LoyaltyAccountDeletedEventObject) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (i *InventoryAdjustmentGroup) UnmarshalJSON(data []byte) error { - type unmarshaler InventoryAdjustmentGroup +func (l *LoyaltyAccountDeletedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyAccountDeletedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *i = InventoryAdjustmentGroup(value) + *l = LoyaltyAccountDeletedEventObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *i) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - i.extraProperties = extraProperties + l.extraProperties = extraProperties - i._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (i *InventoryAdjustmentGroup) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (l *LoyaltyAccountDeletedEventObject) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", i) + return fmt.Sprintf("%#v", l) } -// Indicates whether Square should alert the merchant when the inventory quantity of a CatalogItemVariation is low. -type InventoryAlertType string +// Represents a set of points for a loyalty account that are scheduled to expire on a specific date. +type LoyaltyAccountExpiringPointDeadline struct { + // The number of points scheduled to expire at the `expires_at` timestamp. + Points int `json:"points" url:"points"` + // The timestamp of when the points are scheduled to expire, in RFC 3339 format. + ExpiresAt string `json:"expires_at" url:"expires_at"` -const ( - InventoryAlertTypeNone InventoryAlertType = "NONE" - InventoryAlertTypeLowQuantity InventoryAlertType = "LOW_QUANTITY" -) + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} -func NewInventoryAlertTypeFromString(s string) (InventoryAlertType, error) { - switch s { - case "NONE": - return InventoryAlertTypeNone, nil - case "LOW_QUANTITY": - return InventoryAlertTypeLowQuantity, nil +func (l *LoyaltyAccountExpiringPointDeadline) GetExtraProperties() map[string]interface{} { + return l.extraProperties +} + +func (l *LoyaltyAccountExpiringPointDeadline) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyAccountExpiringPointDeadline + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - var t InventoryAlertType - return "", fmt.Errorf("%s is not a valid %T", s, t) + *l = LoyaltyAccountExpiringPointDeadline(value) + + extraProperties, err := core.ExtractExtraProperties(data, *l) + if err != nil { + return err + } + l.extraProperties = extraProperties + + l._rawJSON = json.RawMessage(data) + return nil } -func (i InventoryAlertType) Ptr() *InventoryAlertType { - return &i +func (l *LoyaltyAccountExpiringPointDeadline) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(l); err == nil { + return value + } + return fmt.Sprintf("%#v", l) } -// Represents a single physical count, inventory, adjustment, or transfer -// that is part of the history of inventory changes for a particular -// [CatalogObject]($m/CatalogObject) instance. -type InventoryChange struct { - // Indicates how the inventory change is applied. See - // [InventoryChangeType](entity:InventoryChangeType) for all possible values. - // See [InventoryChangeType](#type-inventorychangetype) for possible values - Type *InventoryChangeType `json:"type,omitempty" url:"type,omitempty"` - // Contains details about the physical count when `type` is - // `PHYSICAL_COUNT`, and is unset for all other change types. - PhysicalCount *InventoryPhysicalCount `json:"physical_count,omitempty" url:"physical_count,omitempty"` - // Contains details about the inventory adjustment when `type` is - // `ADJUSTMENT`, and is unset for all other change types. - Adjustment *InventoryAdjustment `json:"adjustment,omitempty" url:"adjustment,omitempty"` - // Contains details about the inventory transfer when `type` is - // `TRANSFER`, and is unset for all other change types. - // - // _Note:_ An [InventoryTransfer](entity:InventoryTransfer) object can only be set in the input to the - // [BatchChangeInventory](api-endpoint:Inventory-BatchChangeInventory) endpoint when the seller has an active Retail Plus subscription. - Transfer *InventoryTransfer `json:"transfer,omitempty" url:"transfer,omitempty"` - // The [CatalogMeasurementUnit](entity:CatalogMeasurementUnit) object representing the catalog measurement unit associated with the inventory change. - MeasurementUnit *CatalogMeasurementUnit `json:"measurement_unit,omitempty" url:"measurement_unit,omitempty"` - // The ID of the [CatalogMeasurementUnit](entity:CatalogMeasurementUnit) object representing the catalog measurement unit associated with the inventory change. - MeasurementUnitID *string `json:"measurement_unit_id,omitempty" url:"measurement_unit_id,omitempty"` +// Represents the mapping that associates a loyalty account with a buyer. +// +// Currently, a loyalty account can only be mapped to a buyer by phone number. For more information, see +// [Loyalty Overview](https://developer.squareup.com/docs/loyalty/overview). +type LoyaltyAccountMapping struct { + // The Square-assigned ID of the mapping. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The mapping type, which is used with `value` to represent a phone number mapping. + // RETIRED at version 2021-05-13. When specifying a mapping, use the `phone_number` field instead. + // See [LoyaltyAccountMappingType](#type-loyaltyaccountmappingtype) for possible values + Type *LoyaltyAccountMappingType `json:"type,omitempty" url:"type,omitempty"` + // The mapping value, which is used with `type` to represent a phone number mapping. + // The value can be a phone number in E.164 format. For example, "+14155551111". + // RETIRED at version 2021-05-13. When specifying a mapping, use the `phone_number` field instead. + Value *string `json:"value,omitempty" url:"value,omitempty"` + // The timestamp when the mapping was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The phone number of the buyer, in E.164 format. For example, "+14155551111". + PhoneNumber *string `json:"phone_number,omitempty" url:"phone_number,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (i *InventoryChange) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (l *LoyaltyAccountMapping) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (i *InventoryChange) UnmarshalJSON(data []byte) error { - type unmarshaler InventoryChange +func (l *LoyaltyAccountMapping) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyAccountMapping var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *i = InventoryChange(value) + *l = LoyaltyAccountMapping(value) - extraProperties, err := core.ExtractExtraProperties(data, *i) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - i.extraProperties = extraProperties + l.extraProperties = extraProperties - i._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (i *InventoryChange) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (l *LoyaltyAccountMapping) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", i) + return fmt.Sprintf("%#v", l) } -// Indicates how the inventory change was applied to a tracked product quantity. -type InventoryChangeType string +// The type of mapping. +type LoyaltyAccountMappingType string const ( - InventoryChangeTypePhysicalCount InventoryChangeType = "PHYSICAL_COUNT" - InventoryChangeTypeAdjustment InventoryChangeType = "ADJUSTMENT" - InventoryChangeTypeTransfer InventoryChangeType = "TRANSFER" + LoyaltyAccountMappingTypeTypeDoNotUse LoyaltyAccountMappingType = "TYPE_DO_NOT_USE" + LoyaltyAccountMappingTypePhone LoyaltyAccountMappingType = "PHONE" ) -func NewInventoryChangeTypeFromString(s string) (InventoryChangeType, error) { +func NewLoyaltyAccountMappingTypeFromString(s string) (LoyaltyAccountMappingType, error) { switch s { - case "PHYSICAL_COUNT": - return InventoryChangeTypePhysicalCount, nil - case "ADJUSTMENT": - return InventoryChangeTypeAdjustment, nil - case "TRANSFER": - return InventoryChangeTypeTransfer, nil + case "TYPE_DO_NOT_USE": + return LoyaltyAccountMappingTypeTypeDoNotUse, nil + case "PHONE": + return LoyaltyAccountMappingTypePhone, nil } - var t InventoryChangeType + var t LoyaltyAccountMappingType return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (i InventoryChangeType) Ptr() *InventoryChangeType { - return &i +func (l LoyaltyAccountMappingType) Ptr() *LoyaltyAccountMappingType { + return &l } -// Represents Square-estimated quantity of items in a particular state at a -// particular seller location based on the known history of physical counts and -// inventory adjustments. -type InventoryCount struct { - // 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 current [inventory state](entity:InventoryState) for the related - // quantity of items. - // See [InventoryState](#type-inventorystate) for possible values - State *InventoryState `json:"state,omitempty" url:"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 number of items affected by the estimated count as a decimal string. - // Can support up to 5 digits after the decimal point. - Quantity *string `json:"quantity,omitempty" url:"quantity,omitempty"` - // An RFC 3339-formatted timestamp that indicates when the most recent physical count or adjustment affecting - // the estimated count is received. - CalculatedAt *string `json:"calculated_at,omitempty" url:"calculated_at,omitempty"` - // Whether the inventory count is for composed variation (TRUE) or not (FALSE). If true, the inventory count will not be present in the response of - // any of these endpoints: [BatchChangeInventory]($e/Inventory/BatchChangeInventory), - // [BatchRetrieveInventoryChanges]($e/Inventory/BatchRetrieveInventoryChanges), - // [BatchRetrieveInventoryCounts]($e/Inventory/BatchRetrieveInventoryCounts), and - // [RetrieveInventoryChanges]($e/Inventory/RetrieveInventoryChanges). - IsEstimated *bool `json:"is_estimated,omitempty" url:"is_estimated,omitempty"` +// Published when a [loyalty account](entity:LoyaltyAccount) is updated. +type LoyaltyAccountUpdatedEvent struct { + // The ID of the Square seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event. For this event, the value is `loyalty.account.updated`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The unique ID for the event, which is used for + // [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *LoyaltyAccountUpdatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (i *InventoryCount) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (l *LoyaltyAccountUpdatedEvent) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (i *InventoryCount) UnmarshalJSON(data []byte) error { - type unmarshaler InventoryCount +func (l *LoyaltyAccountUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyAccountUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *i = InventoryCount(value) + *l = LoyaltyAccountUpdatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *i) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - i.extraProperties = extraProperties + l.extraProperties = extraProperties - i._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (i *InventoryCount) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (l *LoyaltyAccountUpdatedEvent) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", i) + return fmt.Sprintf("%#v", l) } -// Represents the quantity of an item variation that is physically present -// at a specific location, verified by a seller or a seller's employee. For example, -// a physical count might come from an employee counting the item variations on -// hand or from syncing with an external system. -type InventoryPhysicalCount struct { - // A unique Square-generated ID for the - // [InventoryPhysicalCount](entity:InventoryPhysicalCount). +// The data associated with a `loyalty.account.updated` event. +type LoyaltyAccountUpdatedEventData struct { + // The type of object affected by the event. For this event, the value is `loyalty_account`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The ID of the affected loyalty account. ID *string `json:"id,omitempty" url:"id,omitempty"` - // An optional ID provided by the application to tie the - // [InventoryPhysicalCount](entity:InventoryPhysicalCount) to an external - // system. - ReferenceID *string `json:"reference_id,omitempty" url:"reference_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 current [inventory state](entity:InventoryState) for the related - // quantity of items. - // See [InventoryState](#type-inventorystate) for possible values - State *InventoryState `json:"state,omitempty" url:"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 number of items affected by the physical count as a decimal string. - // The number can support up to 5 digits after the decimal point. - Quantity *string `json:"quantity,omitempty" url:"quantity,omitempty"` - // Information about the application with which the - // physical count is submitted. - Source *SourceApplication `json:"source,omitempty" url:"source,omitempty"` - // The Square-generated ID of the [Employee](entity:Employee) responsible for the - // physical count. - EmployeeID *string `json:"employee_id,omitempty" url:"employee_id,omitempty"` - // The Square-generated ID of the [Team Member](entity:TeamMember) responsible for the - // physical count. - TeamMemberID *string `json:"team_member_id,omitempty" url:"team_member_id,omitempty"` - // A client-generated RFC 3339-formatted timestamp that indicates when - // the physical count was examined. For physical count 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 physical count is received. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // An object that contains the loyalty account that was updated. + Object *LoyaltyAccountUpdatedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (i *InventoryPhysicalCount) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (l *LoyaltyAccountUpdatedEventData) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (i *InventoryPhysicalCount) UnmarshalJSON(data []byte) error { - type unmarshaler InventoryPhysicalCount +func (l *LoyaltyAccountUpdatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyAccountUpdatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *i = InventoryPhysicalCount(value) + *l = LoyaltyAccountUpdatedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *i) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - i.extraProperties = extraProperties + l.extraProperties = extraProperties - i._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (i *InventoryPhysicalCount) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (l *LoyaltyAccountUpdatedEventData) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", i) + return fmt.Sprintf("%#v", l) } -// Indicates the state of a tracked item quantity in the lifecycle of goods. -type InventoryState string +type LoyaltyAccountUpdatedEventObject struct { + // The loyalty account that was updated. + LoyaltyAccount *LoyaltyAccount `json:"loyalty_account,omitempty" url:"loyalty_account,omitempty"` -const ( - InventoryStateCustom InventoryState = "CUSTOM" - InventoryStateInStock InventoryState = "IN_STOCK" - InventoryStateSold InventoryState = "SOLD" - InventoryStateReturnedByCustomer InventoryState = "RETURNED_BY_CUSTOMER" - InventoryStateReservedForSale InventoryState = "RESERVED_FOR_SALE" - InventoryStateSoldOnline InventoryState = "SOLD_ONLINE" - InventoryStateOrderedFromVendor InventoryState = "ORDERED_FROM_VENDOR" - InventoryStateReceivedFromVendor InventoryState = "RECEIVED_FROM_VENDOR" - InventoryStateInTransitTo InventoryState = "IN_TRANSIT_TO" - InventoryStateNone InventoryState = "NONE" - InventoryStateWaste InventoryState = "WASTE" - InventoryStateUnlinkedReturn InventoryState = "UNLINKED_RETURN" - InventoryStateComposed InventoryState = "COMPOSED" - InventoryStateDecomposed InventoryState = "DECOMPOSED" - InventoryStateSupportedByNewerVersion InventoryState = "SUPPORTED_BY_NEWER_VERSION" - InventoryStateInTransit InventoryState = "IN_TRANSIT" -) + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} -func NewInventoryStateFromString(s string) (InventoryState, error) { - switch s { - case "CUSTOM": - return InventoryStateCustom, nil - case "IN_STOCK": - return InventoryStateInStock, nil - case "SOLD": - return InventoryStateSold, nil - case "RETURNED_BY_CUSTOMER": - return InventoryStateReturnedByCustomer, nil - case "RESERVED_FOR_SALE": - return InventoryStateReservedForSale, nil - case "SOLD_ONLINE": - return InventoryStateSoldOnline, nil - case "ORDERED_FROM_VENDOR": - return InventoryStateOrderedFromVendor, nil - case "RECEIVED_FROM_VENDOR": - return InventoryStateReceivedFromVendor, nil - case "IN_TRANSIT_TO": - return InventoryStateInTransitTo, nil - case "NONE": - return InventoryStateNone, nil - case "WASTE": - return InventoryStateWaste, nil - case "UNLINKED_RETURN": - return InventoryStateUnlinkedReturn, nil - case "COMPOSED": - return InventoryStateComposed, nil - case "DECOMPOSED": - return InventoryStateDecomposed, nil - case "SUPPORTED_BY_NEWER_VERSION": - return InventoryStateSupportedByNewerVersion, nil - case "IN_TRANSIT": - return InventoryStateInTransit, nil +func (l *LoyaltyAccountUpdatedEventObject) GetExtraProperties() map[string]interface{} { + return l.extraProperties +} + +func (l *LoyaltyAccountUpdatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyAccountUpdatedEventObject + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - var t InventoryState - return "", fmt.Errorf("%s is not a valid %T", s, t) + *l = LoyaltyAccountUpdatedEventObject(value) + + extraProperties, err := core.ExtractExtraProperties(data, *l) + if err != nil { + return err + } + l.extraProperties = extraProperties + + l._rawJSON = json.RawMessage(data) + return nil } -func (i InventoryState) Ptr() *InventoryState { - return &i +func (l *LoyaltyAccountUpdatedEventObject) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(l); err == nil { + return value + } + return fmt.Sprintf("%#v", l) } -// Represents the transfer of a quantity of product inventory at a -// particular time from one location to another. -type InventoryTransfer struct { - // A unique ID generated by Square for the - // `InventoryTransfer`. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // An optional ID provided by the application to tie the - // `InventoryTransfer` to an external system. - ReferenceID *string `json:"reference_id,omitempty" url:"reference_id,omitempty"` - // The [inventory state](entity:InventoryState) for the quantity of - // items being transferred. - // See [InventoryState](#type-inventorystate) for possible values - State *InventoryState `json:"state,omitempty" url:"state,omitempty"` - // The Square-generated ID of the [Location](entity:Location) where the related - // quantity of items was tracked before the transfer. - FromLocationID *string `json:"from_location_id,omitempty" url:"from_location_id,omitempty"` - // The Square-generated ID of the [Location](entity:Location) where the related - // quantity of items was tracked after the transfer. - ToLocationID *string `json:"to_location_id,omitempty" url:"to_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 transfer as a decimal string. - // Can support up to 5 digits after the decimal point. - Quantity *string `json:"quantity,omitempty" url:"quantity,omitempty"` - // A client-generated RFC 3339-formatted timestamp that indicates when - // the transfer took place. For write actions, 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 Square - // received the transfer request. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // Information about the application that initiated the - // inventory transfer. - Source *SourceApplication `json:"source,omitempty" url:"source,omitempty"` - // The Square-generated ID of the [Employee](entity:Employee) responsible for the - // inventory transfer. - EmployeeID *string `json:"employee_id,omitempty" url:"employee_id,omitempty"` - // The Square-generated ID of the [Team Member](entity:TeamMember) responsible for the - // inventory transfer. - TeamMemberID *string `json:"team_member_id,omitempty" url:"team_member_id,omitempty"` +// Provides information about a loyalty event. +// For more information, see [Search for Balance-Changing Loyalty Events](https://developer.squareup.com/docs/loyalty-api/loyalty-events). +type LoyaltyEvent struct { + // The Square-assigned ID of the loyalty event. + ID string `json:"id" url:"id"` + // The type of the loyalty event. + // See [LoyaltyEventType](#type-loyaltyeventtype) for possible values + Type LoyaltyEventType `json:"type" url:"type"` + // The timestamp when the event was created, in RFC 3339 format. + CreatedAt string `json:"created_at" url:"created_at"` + // Provides metadata when the event `type` is `ACCUMULATE_POINTS`. + AccumulatePoints *LoyaltyEventAccumulatePoints `json:"accumulate_points,omitempty" url:"accumulate_points,omitempty"` + // Provides metadata when the event `type` is `CREATE_REWARD`. + CreateReward *LoyaltyEventCreateReward `json:"create_reward,omitempty" url:"create_reward,omitempty"` + // Provides metadata when the event `type` is `REDEEM_REWARD`. + RedeemReward *LoyaltyEventRedeemReward `json:"redeem_reward,omitempty" url:"redeem_reward,omitempty"` + // Provides metadata when the event `type` is `DELETE_REWARD`. + DeleteReward *LoyaltyEventDeleteReward `json:"delete_reward,omitempty" url:"delete_reward,omitempty"` + // Provides metadata when the event `type` is `ADJUST_POINTS`. + AdjustPoints *LoyaltyEventAdjustPoints `json:"adjust_points,omitempty" url:"adjust_points,omitempty"` + // The ID of the [loyalty account](entity:LoyaltyAccount) associated with the event. + LoyaltyAccountID string `json:"loyalty_account_id" url:"loyalty_account_id"` + // The ID of the [location](entity:Location) where the event occurred. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // Defines whether the event was generated by the Square Point of Sale. + // See [LoyaltyEventSource](#type-loyaltyeventsource) for possible values + Source LoyaltyEventSource `json:"source" url:"source"` + // Provides metadata when the event `type` is `EXPIRE_POINTS`. + ExpirePoints *LoyaltyEventExpirePoints `json:"expire_points,omitempty" url:"expire_points,omitempty"` + // Provides metadata when the event `type` is `OTHER`. + OtherEvent *LoyaltyEventOther `json:"other_event,omitempty" url:"other_event,omitempty"` + // Provides metadata when the event `type` is `ACCUMULATE_PROMOTION_POINTS`. + AccumulatePromotionPoints *LoyaltyEventAccumulatePromotionPoints `json:"accumulate_promotion_points,omitempty" url:"accumulate_promotion_points,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (l *LoyaltyEvent) GetExtraProperties() map[string]interface{} { + return l.extraProperties +} + +func (l *LoyaltyEvent) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *l = LoyaltyEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *l) + if err != nil { + return err + } + l.extraProperties = extraProperties + + l._rawJSON = json.RawMessage(data) + return nil +} + +func (l *LoyaltyEvent) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(l); err == nil { + return value + } + return fmt.Sprintf("%#v", l) +} + +// Provides metadata when the event `type` is `ACCUMULATE_POINTS`. +type LoyaltyEventAccumulatePoints struct { + // The ID of the [loyalty program](entity:LoyaltyProgram). + LoyaltyProgramID *string `json:"loyalty_program_id,omitempty" url:"loyalty_program_id,omitempty"` + // The number of points accumulated by the event. + Points *int `json:"points,omitempty" url:"points,omitempty"` + // The ID of the [order](entity:Order) for which the buyer accumulated the points. + // This field is returned only if the Orders API is used to process orders. + OrderID *string `json:"order_id,omitempty" url:"order_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (i *InventoryTransfer) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (l *LoyaltyEventAccumulatePoints) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (i *InventoryTransfer) UnmarshalJSON(data []byte) error { - type unmarshaler InventoryTransfer +func (l *LoyaltyEventAccumulatePoints) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyEventAccumulatePoints var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *i = InventoryTransfer(value) + *l = LoyaltyEventAccumulatePoints(value) - extraProperties, err := core.ExtractExtraProperties(data, *i) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - i.extraProperties = extraProperties + l.extraProperties = extraProperties - i._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (i *InventoryTransfer) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (l *LoyaltyEventAccumulatePoints) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", i) + return fmt.Sprintf("%#v", l) } -// Stores information about an invoice. You use the Invoices API to create and manage -// invoices. For more information, see [Invoices API Overview](https://developer.squareup.com/docs/invoices-api/overview). -type Invoice struct { - // The Square-assigned ID of the invoice. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The Square-assigned version number, which is incremented each time an update is committed to the invoice. - Version *int `json:"version,omitempty" url:"version,omitempty"` - // The ID of the location that this invoice is associated with. - // - // If specified in a `CreateInvoice` request, the value must match the `location_id` of the associated order. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` - // The ID of the [order](entity:Order) for which the invoice is created. - // This field is required when creating an invoice, and the order must be in the `OPEN` state. - // - // To view the line items and other information for the associated order, call the - // [RetrieveOrder](api-endpoint:Orders-RetrieveOrder) endpoint using the order ID. - OrderID *string `json:"order_id,omitempty" url:"order_id,omitempty"` - // The customer who receives the invoice. This customer data is displayed on the invoice and used by Square to deliver the invoice. - // - // This field is required to publish an invoice, and it must specify the `customer_id`. - PrimaryRecipient *InvoiceRecipient `json:"primary_recipient,omitempty" url:"primary_recipient,omitempty"` - // The payment schedule for the invoice, represented by one or more payment requests that - // define payment settings, such as amount due and due date. An invoice supports the following payment request combinations: - // - // - One balance - // - One deposit with one balance - // - 2–12 installments - // - One deposit with 2–12 installments - // - // This field is required when creating an invoice. It must contain at least one payment request. - // All payment requests for the invoice must equal the total order amount. For more information, see - // [Configuring payment requests](https://developer.squareup.com/docs/invoices-api/create-publish-invoices#payment-requests). - // - // Adding `INSTALLMENT` payment requests to an invoice requires an - // [Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription). - PaymentRequests []*InvoicePaymentRequest `json:"payment_requests,omitempty" url:"payment_requests,omitempty"` - // The delivery method that Square uses to send the invoice, reminders, and receipts to - // the customer. After the invoice is published, Square processes the invoice based on the delivery - // method and payment request settings, either immediately or on the `scheduled_at` date, if specified. - // For example, Square might send the invoice or receipt for an automatic payment. For invoices with - // automatic payments, this field must be set to `EMAIL`. - // - // One of the following is required when creating an invoice: - // - // - (Recommended) This `delivery_method` field. To configure an automatic payment, the - // `automatic_payment_source` field of the payment request is also required. - // - The deprecated `request_method` field of the payment request. Note that `invoice` - // objects returned in responses do not include `request_method`. - // See [InvoiceDeliveryMethod](#type-invoicedeliverymethod) for possible values - DeliveryMethod *InvoiceDeliveryMethod `json:"delivery_method,omitempty" url:"delivery_method,omitempty"` - // A user-friendly invoice number that is displayed on the invoice. The value is unique within a location. - // If not provided when creating an invoice, Square assigns a value. - // It increments from 1 and is padded with zeros making it 7 characters long - // (for example, 0000001 and 0000002). - InvoiceNumber *string `json:"invoice_number,omitempty" url:"invoice_number,omitempty"` - // The title of the invoice, which is displayed on the invoice. - Title *string `json:"title,omitempty" url:"title,omitempty"` - // The description of the invoice, which is displayed on the invoice. - Description *string `json:"description,omitempty" url:"description,omitempty"` - // The timestamp when the invoice is scheduled for processing, in RFC 3339 format. - // After the invoice is published, Square processes the invoice on the specified date, - // according to the delivery method and payment request settings. - // - // If the field is not set, Square processes the invoice immediately after it is published. - ScheduledAt *string `json:"scheduled_at,omitempty" url:"scheduled_at,omitempty"` - // The URL of the Square-hosted invoice page. - // After you publish the invoice using the `PublishInvoice` endpoint, Square hosts the invoice - // page and returns the page URL in the response. - PublicURL *string `json:"public_url,omitempty" url:"public_url,omitempty"` - // The current amount due for the invoice. In addition to the - // amount due on the next payment request, this includes any overdue payment amounts. - NextPaymentAmountMoney *Money `json:"next_payment_amount_money,omitempty" url:"next_payment_amount_money,omitempty"` - // The status of the invoice. - // See [InvoiceStatus](#type-invoicestatus) for possible values - Status *InvoiceStatus `json:"status,omitempty" url:"status,omitempty"` - // The time zone used to interpret calendar dates on the invoice, such as `due_date`. - // When an invoice is created, this field is set to the `timezone` specified for the seller - // location. The value cannot be changed. - // - // For example, a payment `due_date` of 2021-03-09 with a `timezone` of America/Los_Angeles - // becomes overdue at midnight on March 9 in America/Los_Angeles (which equals a UTC timestamp - // of 2021-03-10T08:00:00Z). - Timezone *string `json:"timezone,omitempty" url:"timezone,omitempty"` - // The timestamp when the invoice was created, in RFC 3339 format. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The timestamp when the invoice was last updated, in RFC 3339 format. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` - // The payment methods that customers can use to pay the invoice on the Square-hosted - // invoice page. This setting is independent of any automatic payment requests for the invoice. - // - // This field is required when creating an invoice and must set at least one payment method to `true`. - AcceptedPaymentMethods *InvoiceAcceptedPaymentMethods `json:"accepted_payment_methods,omitempty" url:"accepted_payment_methods,omitempty"` - // Additional seller-defined fields that are displayed on the invoice. For more information, see - // [Custom fields](https://developer.squareup.com/docs/invoices-api/overview#custom-fields). - // - // Adding custom fields to an invoice requires an - // [Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription). - // - // Max: 2 custom fields - CustomFields []*InvoiceCustomField `json:"custom_fields,omitempty" url:"custom_fields,omitempty"` - // The ID of the [subscription](entity:Subscription) associated with the invoice. - // This field is present only on subscription billing invoices. - SubscriptionID *string `json:"subscription_id,omitempty" url:"subscription_id,omitempty"` - // The date of the sale or the date that the service is rendered, in `YYYY-MM-DD` format. - // This field can be used to specify a past or future date which is displayed on the invoice. - SaleOrServiceDate *string `json:"sale_or_service_date,omitempty" url:"sale_or_service_date,omitempty"` - // **France only.** The payment terms and conditions that are displayed on the invoice. For more information, - // see [Payment conditions](https://developer.squareup.com/docs/invoices-api/overview#payment-conditions). - // - // For countries other than France, Square returns an `INVALID_REQUEST_ERROR` with a `BAD_REQUEST` code and - // "Payment conditions are not supported for this location's country" detail if this field is included in `CreateInvoice` or `UpdateInvoice` requests. - PaymentConditions *string `json:"payment_conditions,omitempty" url:"payment_conditions,omitempty"` - // Indicates whether to allow a customer to save a credit or debit card as a card on file or a bank transfer as a - // bank account on file. If `true`, Square displays a **Save my card on file** or **Save my bank on file** checkbox on the - // invoice payment page. Stored payment information can be used for future automatic payments. The default value is `false`. - StorePaymentMethodEnabled *bool `json:"store_payment_method_enabled,omitempty" url:"store_payment_method_enabled,omitempty"` - // Metadata about the attachments on the invoice. Invoice attachments are managed using the - // [CreateInvoiceAttachment](api-endpoint:Invoices-CreateInvoiceAttachment) and [DeleteInvoiceAttachment](api-endpoint:Invoices-DeleteInvoiceAttachment) endpoints. - Attachments []*InvoiceAttachment `json:"attachments,omitempty" url:"attachments,omitempty"` +// Provides metadata when the event `type` is `ACCUMULATE_PROMOTION_POINTS`. +type LoyaltyEventAccumulatePromotionPoints struct { + // The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram). + LoyaltyProgramID *string `json:"loyalty_program_id,omitempty" url:"loyalty_program_id,omitempty"` + // The Square-assigned ID of the [loyalty promotion](entity:LoyaltyPromotion). + LoyaltyPromotionID *string `json:"loyalty_promotion_id,omitempty" url:"loyalty_promotion_id,omitempty"` + // The number of points earned by the event. + Points int `json:"points" url:"points"` + // The ID of the [order](entity:Order) for which the buyer earned the promotion points. + // Only applications that use the Orders API to process orders can trigger this event. + OrderID string `json:"order_id" url:"order_id"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (i *Invoice) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (l *LoyaltyEventAccumulatePromotionPoints) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (i *Invoice) UnmarshalJSON(data []byte) error { - type unmarshaler Invoice +func (l *LoyaltyEventAccumulatePromotionPoints) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyEventAccumulatePromotionPoints var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *i = Invoice(value) + *l = LoyaltyEventAccumulatePromotionPoints(value) - extraProperties, err := core.ExtractExtraProperties(data, *i) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - i.extraProperties = extraProperties + l.extraProperties = extraProperties - i._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (i *Invoice) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (l *LoyaltyEventAccumulatePromotionPoints) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", i) + return fmt.Sprintf("%#v", l) } -// The payment methods that customers can use to pay an [invoice]($m/Invoice) on the Square-hosted invoice payment page. -type InvoiceAcceptedPaymentMethods struct { - // Indicates whether credit card or debit card payments are accepted. The default value is `false`. - Card *bool `json:"card,omitempty" url:"card,omitempty"` - // Indicates whether Square gift card payments are accepted. The default value is `false`. - SquareGiftCard *bool `json:"square_gift_card,omitempty" url:"square_gift_card,omitempty"` - // Indicates whether ACH bank transfer payments are accepted. The default value is `false`. - BankAccount *bool `json:"bank_account,omitempty" url:"bank_account,omitempty"` - // Indicates whether Afterpay (also known as Clearpay) payments are accepted. The default value is `false`. - // - // This option is allowed only for invoices that have a single payment request of the `BALANCE` type. This payment method is - // supported if the seller account accepts Afterpay payments and the seller location is in a country where Afterpay - // invoice payments are supported. As a best practice, consider enabling an additional payment method when allowing - // `buy_now_pay_later` payments. For more information, including detailed requirements and processing limits, see - // [Buy Now Pay Later payments with Afterpay](https://developer.squareup.com/docs/invoices-api/overview#buy-now-pay-later). - BuyNowPayLater *bool `json:"buy_now_pay_later,omitempty" url:"buy_now_pay_later,omitempty"` - // Indicates whether Cash App payments are accepted. The default value is `false`. - // - // This payment method is supported only for seller [locations](entity:Location) in the United States. - CashAppPay *bool `json:"cash_app_pay,omitempty" url:"cash_app_pay,omitempty"` +// Provides metadata when the event `type` is `ADJUST_POINTS`. +type LoyaltyEventAdjustPoints struct { + // The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram). + LoyaltyProgramID *string `json:"loyalty_program_id,omitempty" url:"loyalty_program_id,omitempty"` + // The number of points added or removed. + Points int `json:"points" url:"points"` + // The reason for the adjustment of points. + Reason *string `json:"reason,omitempty" url:"reason,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (i *InvoiceAcceptedPaymentMethods) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (l *LoyaltyEventAdjustPoints) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (i *InvoiceAcceptedPaymentMethods) UnmarshalJSON(data []byte) error { - type unmarshaler InvoiceAcceptedPaymentMethods +func (l *LoyaltyEventAdjustPoints) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyEventAdjustPoints var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *i = InvoiceAcceptedPaymentMethods(value) + *l = LoyaltyEventAdjustPoints(value) - extraProperties, err := core.ExtractExtraProperties(data, *i) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - i.extraProperties = extraProperties + l.extraProperties = extraProperties - i._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (i *InvoiceAcceptedPaymentMethods) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (l *LoyaltyEventAdjustPoints) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", i) + return fmt.Sprintf("%#v", l) } -// Represents a file attached to an [invoice]($m/Invoice). -type InvoiceAttachment struct { - // The Square-assigned ID of the attachment. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The file name of the attachment, which is displayed on the invoice. - Filename *string `json:"filename,omitempty" url:"filename,omitempty"` - // The description of the attachment, which is displayed on the invoice. - // This field maps to the seller-defined **Message** field. - Description *string `json:"description,omitempty" url:"description,omitempty"` - // The file size of the attachment in bytes. - Filesize *int `json:"filesize,omitempty" url:"filesize,omitempty"` - // The MD5 hash that was generated from the file contents. - Hash *string `json:"hash,omitempty" url:"hash,omitempty"` - // The mime type of the attachment. - // The following mime types are supported: - // image/gif, image/jpeg, image/png, image/tiff, image/bmp, application/pdf. - MimeType *string `json:"mime_type,omitempty" url:"mime_type,omitempty"` - // The timestamp when the attachment was uploaded, in RFC 3339 format. - UploadedAt *string `json:"uploaded_at,omitempty" url:"uploaded_at,omitempty"` +// Provides metadata when the event `type` is `CREATE_REWARD`. +type LoyaltyEventCreateReward struct { + // The ID of the [loyalty program](entity:LoyaltyProgram). + LoyaltyProgramID string `json:"loyalty_program_id" url:"loyalty_program_id"` + // The Square-assigned ID of the created [loyalty reward](entity:LoyaltyReward). + // This field is returned only if the event source is `LOYALTY_API`. + RewardID *string `json:"reward_id,omitempty" url:"reward_id,omitempty"` + // The loyalty points used to create the reward. + Points int `json:"points" url:"points"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (i *InvoiceAttachment) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (l *LoyaltyEventCreateReward) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (i *InvoiceAttachment) UnmarshalJSON(data []byte) error { - type unmarshaler InvoiceAttachment +func (l *LoyaltyEventCreateReward) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyEventCreateReward var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *i = InvoiceAttachment(value) + *l = LoyaltyEventCreateReward(value) - extraProperties, err := core.ExtractExtraProperties(data, *i) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - i.extraProperties = extraProperties + l.extraProperties = extraProperties - i._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (i *InvoiceAttachment) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (l *LoyaltyEventCreateReward) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", i) + return fmt.Sprintf("%#v", l) } -// Indicates the automatic payment method for an [invoice payment request]($m/InvoicePaymentRequest). -type InvoiceAutomaticPaymentSource string +// Published when a [loyalty event](entity:LoyaltyEvent) is created. +type LoyaltyEventCreatedEvent struct { + // The ID of the Square seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event. For this event, the value is `loyalty.event.created`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The unique ID for the event, which is used for + // [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *LoyaltyEventCreatedEventData `json:"data,omitempty" url:"data,omitempty"` -const ( - InvoiceAutomaticPaymentSourceNone InvoiceAutomaticPaymentSource = "NONE" - InvoiceAutomaticPaymentSourceCardOnFile InvoiceAutomaticPaymentSource = "CARD_ON_FILE" - InvoiceAutomaticPaymentSourceBankOnFile InvoiceAutomaticPaymentSource = "BANK_ON_FILE" -) + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} -func NewInvoiceAutomaticPaymentSourceFromString(s string) (InvoiceAutomaticPaymentSource, error) { - switch s { - case "NONE": - return InvoiceAutomaticPaymentSourceNone, nil - case "CARD_ON_FILE": - return InvoiceAutomaticPaymentSourceCardOnFile, nil - case "BANK_ON_FILE": - return InvoiceAutomaticPaymentSourceBankOnFile, nil +func (l *LoyaltyEventCreatedEvent) GetExtraProperties() map[string]interface{} { + return l.extraProperties +} + +func (l *LoyaltyEventCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyEventCreatedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - var t InvoiceAutomaticPaymentSource - return "", fmt.Errorf("%s is not a valid %T", s, t) + *l = LoyaltyEventCreatedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *l) + if err != nil { + return err + } + l.extraProperties = extraProperties + + l._rawJSON = json.RawMessage(data) + return nil } -func (i InvoiceAutomaticPaymentSource) Ptr() *InvoiceAutomaticPaymentSource { - return &i +func (l *LoyaltyEventCreatedEvent) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(l); err == nil { + return value + } + return fmt.Sprintf("%#v", l) } -// An additional seller-defined and customer-facing field to include on the invoice. For more information, -// see [Custom fields](https://developer.squareup.com/docs/invoices-api/overview#custom-fields). -// -// Adding custom fields to an invoice requires an -// [Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription). -type InvoiceCustomField struct { - // The label or title of the custom field. This field is required for a custom field. - Label *string `json:"label,omitempty" url:"label,omitempty"` - // The text of the custom field. If omitted, only the label is rendered. - Value *string `json:"value,omitempty" url:"value,omitempty"` - // The location of the custom field on the invoice. This field is required for a custom field. - // See [InvoiceCustomFieldPlacement](#type-invoicecustomfieldplacement) for possible values - Placement *InvoiceCustomFieldPlacement `json:"placement,omitempty" url:"placement,omitempty"` +// The data associated with a `loyalty.event.created` event. +type LoyaltyEventCreatedEventData struct { + // The type of object affected by the event. For this event, the value is `loyalty_event`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the affected loyalty event. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object that contains the new loyalty event. + Object *LoyaltyEventCreatedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (i *InvoiceCustomField) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (l *LoyaltyEventCreatedEventData) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (i *InvoiceCustomField) UnmarshalJSON(data []byte) error { - type unmarshaler InvoiceCustomField +func (l *LoyaltyEventCreatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyEventCreatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *i = InvoiceCustomField(value) + *l = LoyaltyEventCreatedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *i) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - i.extraProperties = extraProperties + l.extraProperties = extraProperties - i._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (i *InvoiceCustomField) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (l *LoyaltyEventCreatedEventData) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", i) + return fmt.Sprintf("%#v", l) } -// Indicates where to render a custom field on the Square-hosted invoice page and in emailed or PDF -// copies of the invoice. -type InvoiceCustomFieldPlacement string - -const ( - InvoiceCustomFieldPlacementAboveLineItems InvoiceCustomFieldPlacement = "ABOVE_LINE_ITEMS" - InvoiceCustomFieldPlacementBelowLineItems InvoiceCustomFieldPlacement = "BELOW_LINE_ITEMS" -) +type LoyaltyEventCreatedEventObject struct { + // The loyalty event that was created. + LoyaltyEvent *LoyaltyEvent `json:"loyalty_event,omitempty" url:"loyalty_event,omitempty"` -func NewInvoiceCustomFieldPlacementFromString(s string) (InvoiceCustomFieldPlacement, error) { - switch s { - case "ABOVE_LINE_ITEMS": - return InvoiceCustomFieldPlacementAboveLineItems, nil - case "BELOW_LINE_ITEMS": - return InvoiceCustomFieldPlacementBelowLineItems, nil - } - var t InvoiceCustomFieldPlacement - return "", fmt.Errorf("%s is not a valid %T", s, t) + extraProperties map[string]interface{} + _rawJSON json.RawMessage } -func (i InvoiceCustomFieldPlacement) Ptr() *InvoiceCustomFieldPlacement { - return &i +func (l *LoyaltyEventCreatedEventObject) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -// Indicates how Square delivers the [invoice]($m/Invoice) to the customer. -type InvoiceDeliveryMethod string - -const ( - InvoiceDeliveryMethodEmail InvoiceDeliveryMethod = "EMAIL" - InvoiceDeliveryMethodShareManually InvoiceDeliveryMethod = "SHARE_MANUALLY" - InvoiceDeliveryMethodSms InvoiceDeliveryMethod = "SMS" -) +func (l *LoyaltyEventCreatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyEventCreatedEventObject + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *l = LoyaltyEventCreatedEventObject(value) -func NewInvoiceDeliveryMethodFromString(s string) (InvoiceDeliveryMethod, error) { - switch s { - case "EMAIL": - return InvoiceDeliveryMethodEmail, nil - case "SHARE_MANUALLY": - return InvoiceDeliveryMethodShareManually, nil - case "SMS": - return InvoiceDeliveryMethodSms, nil + extraProperties, err := core.ExtractExtraProperties(data, *l) + if err != nil { + return err } - var t InvoiceDeliveryMethod - return "", fmt.Errorf("%s is not a valid %T", s, t) + l.extraProperties = extraProperties + + l._rawJSON = json.RawMessage(data) + return nil } -func (i InvoiceDeliveryMethod) Ptr() *InvoiceDeliveryMethod { - return &i +func (l *LoyaltyEventCreatedEventObject) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(l); err == nil { + return value + } + return fmt.Sprintf("%#v", l) } -// Describes query filters to apply. -type InvoiceFilter struct { - // Limits the search to the specified locations. A location is required. - // In the current implementation, only one location can be specified. - LocationIDs []string `json:"location_ids,omitempty" url:"location_ids,omitempty"` - // Limits the search to the specified customers, within the specified locations. - // Specifying a customer is optional. In the current implementation, - // a maximum of one customer can be specified. - CustomerIDs []string `json:"customer_ids,omitempty" url:"customer_ids,omitempty"` +// Filter events by date time range. +type LoyaltyEventDateTimeFilter struct { + // The `created_at` date time range used to filter the result. + CreatedAt *TimeRange `json:"created_at,omitempty" url:"created_at,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (i *InvoiceFilter) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (l *LoyaltyEventDateTimeFilter) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (i *InvoiceFilter) UnmarshalJSON(data []byte) error { - type unmarshaler InvoiceFilter +func (l *LoyaltyEventDateTimeFilter) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyEventDateTimeFilter var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *i = InvoiceFilter(value) + *l = LoyaltyEventDateTimeFilter(value) - extraProperties, err := core.ExtractExtraProperties(data, *i) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - i.extraProperties = extraProperties + l.extraProperties = extraProperties - i._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (i *InvoiceFilter) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (l *LoyaltyEventDateTimeFilter) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", i) + return fmt.Sprintf("%#v", l) } -// Describes a payment request reminder (automatic notification) that Square sends -// to the customer. You configure a reminder relative to the payment request -// `due_date`. -type InvoicePaymentReminder struct { - // A Square-assigned ID that uniquely identifies the reminder within the - // `InvoicePaymentRequest`. - UID *string `json:"uid,omitempty" url:"uid,omitempty"` - // The number of days before (a negative number) or after (a positive number) - // the payment request `due_date` when the reminder is sent. For example, -3 indicates that - // the reminder should be sent 3 days before the payment request `due_date`. - RelativeScheduledDays *int `json:"relative_scheduled_days,omitempty" url:"relative_scheduled_days,omitempty"` - // The reminder message. - Message *string `json:"message,omitempty" url:"message,omitempty"` - // The status of the reminder. - // See [InvoicePaymentReminderStatus](#type-invoicepaymentreminderstatus) for possible values - Status *InvoicePaymentReminderStatus `json:"status,omitempty" url:"status,omitempty"` - // If sent, the timestamp when the reminder was sent, in RFC 3339 format. - SentAt *string `json:"sent_at,omitempty" url:"sent_at,omitempty"` +// Provides metadata when the event `type` is `DELETE_REWARD`. +type LoyaltyEventDeleteReward struct { + // The ID of the [loyalty program](entity:LoyaltyProgram). + LoyaltyProgramID string `json:"loyalty_program_id" url:"loyalty_program_id"` + // The ID of the deleted [loyalty reward](entity:LoyaltyReward). + // This field is returned only if the event source is `LOYALTY_API`. + RewardID *string `json:"reward_id,omitempty" url:"reward_id,omitempty"` + // The number of points returned to the loyalty account. + Points int `json:"points" url:"points"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (i *InvoicePaymentReminder) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (l *LoyaltyEventDeleteReward) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (i *InvoicePaymentReminder) UnmarshalJSON(data []byte) error { - type unmarshaler InvoicePaymentReminder +func (l *LoyaltyEventDeleteReward) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyEventDeleteReward var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *i = InvoicePaymentReminder(value) + *l = LoyaltyEventDeleteReward(value) - extraProperties, err := core.ExtractExtraProperties(data, *i) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - i.extraProperties = extraProperties + l.extraProperties = extraProperties - i._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (i *InvoicePaymentReminder) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (l *LoyaltyEventDeleteReward) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", i) -} - -// The status of a payment request reminder. -type InvoicePaymentReminderStatus string - -const ( - InvoicePaymentReminderStatusPending InvoicePaymentReminderStatus = "PENDING" - InvoicePaymentReminderStatusNotApplicable InvoicePaymentReminderStatus = "NOT_APPLICABLE" - InvoicePaymentReminderStatusSent InvoicePaymentReminderStatus = "SENT" -) - -func NewInvoicePaymentReminderStatusFromString(s string) (InvoicePaymentReminderStatus, error) { - switch s { - case "PENDING": - return InvoicePaymentReminderStatusPending, nil - case "NOT_APPLICABLE": - return InvoicePaymentReminderStatusNotApplicable, nil - case "SENT": - return InvoicePaymentReminderStatusSent, nil - } - var t InvoicePaymentReminderStatus - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (i InvoicePaymentReminderStatus) Ptr() *InvoicePaymentReminderStatus { - return &i + return fmt.Sprintf("%#v", l) } -// Represents a payment request for an [invoice]($m/Invoice). Invoices can specify a maximum -// of 13 payment requests, with up to 12 `INSTALLMENT` request types. For more information, -// see [Configuring payment requests](https://developer.squareup.com/docs/invoices-api/create-publish-invoices#payment-requests). -// -// Adding `INSTALLMENT` payment requests to an invoice requires an -// [Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription). -type InvoicePaymentRequest struct { - // The Square-generated ID of the payment request in an [invoice](entity:Invoice). - UID *string `json:"uid,omitempty" url:"uid,omitempty"` - // Indicates how Square processes the payment request. DEPRECATED at version 2021-01-21. Replaced by the - // `Invoice.delivery_method` and `InvoicePaymentRequest.automatic_payment_source` fields. - // - // One of the following is required when creating an invoice: - // - // - (Recommended) The `delivery_method` field of the invoice. To configure an automatic payment, the - // `automatic_payment_source` field of the payment request is also required. - // - This `request_method` field. Note that `invoice` objects returned in responses do not include `request_method`. - // See [InvoiceRequestMethod](#type-invoicerequestmethod) for possible values - RequestMethod *InvoiceRequestMethod `json:"request_method,omitempty" url:"request_method,omitempty"` - // Identifies the payment request type. This type defines how the payment request amount is determined. - // This field is required to create a payment request. - // See [InvoiceRequestType](#type-invoicerequesttype) for possible values - RequestType *InvoiceRequestType `json:"request_type,omitempty" url:"request_type,omitempty"` - // The due date (in the invoice's time zone) for the payment request, in `YYYY-MM-DD` format. This field - // is required to create a payment request. If an `automatic_payment_source` is defined for the request, Square - // charges the payment source on this date. - // - // After this date, the invoice becomes overdue. For example, a payment `due_date` of 2021-03-09 with a `timezone` - // of America/Los_Angeles becomes overdue at midnight on March 9 in America/Los_Angeles (which equals a UTC - // timestamp of 2021-03-10T08:00:00Z). - DueDate *string `json:"due_date,omitempty" url:"due_date,omitempty"` - // If the payment request specifies `DEPOSIT` or `INSTALLMENT` as the `request_type`, - // this indicates the request amount. - // You cannot specify this when `request_type` is `BALANCE` or when the - // payment request includes the `percentage_requested` field. - FixedAmountRequestedMoney *Money `json:"fixed_amount_requested_money,omitempty" url:"fixed_amount_requested_money,omitempty"` - // Specifies the amount for the payment request in percentage: - // - // - When the payment `request_type` is `DEPOSIT`, it is the percentage of the order's total amount. - // - When the payment `request_type` is `INSTALLMENT`, it is the percentage of the order's total less - // the deposit, if requested. The sum of the `percentage_requested` in all installment - // payment requests must be equal to 100. - // - // You cannot specify this when the payment `request_type` is `BALANCE` or when the - // payment request specifies the `fixed_amount_requested_money` field. - PercentageRequested *string `json:"percentage_requested,omitempty" url:"percentage_requested,omitempty"` - // If set to true, the Square-hosted invoice page (the `public_url` field of the invoice) - // provides a place for the customer to pay a tip. - // - // This field is allowed only on the final payment request - // and the payment `request_type` must be `BALANCE` or `INSTALLMENT`. - TippingEnabled *bool `json:"tipping_enabled,omitempty" url:"tipping_enabled,omitempty"` - // The payment method for an automatic payment. - // - // The default value is `NONE`. - // See [InvoiceAutomaticPaymentSource](#type-invoiceautomaticpaymentsource) for possible values - AutomaticPaymentSource *InvoiceAutomaticPaymentSource `json:"automatic_payment_source,omitempty" url:"automatic_payment_source,omitempty"` - // The ID of the credit or debit card on file to charge for the payment request. To get the cards on file for a customer, - // call [ListCards](api-endpoint:Cards-ListCards) and include the `customer_id` of the invoice recipient. - CardID *string `json:"card_id,omitempty" url:"card_id,omitempty"` - // A list of one or more reminders to send for the payment request. - Reminders []*InvoicePaymentReminder `json:"reminders,omitempty" url:"reminders,omitempty"` - // The amount of the payment request, computed using the order amount and information from the various payment - // request fields (`request_type`, `fixed_amount_requested_money`, and `percentage_requested`). - ComputedAmountMoney *Money `json:"computed_amount_money,omitempty" url:"computed_amount_money,omitempty"` - // The amount of money already paid for the specific payment request. - // This amount might include a rounding adjustment if the most recent invoice payment - // was in cash in a currency that rounds cash payments (such as, `CAD` or `AUD`). - TotalCompletedAmountMoney *Money `json:"total_completed_amount_money,omitempty" url:"total_completed_amount_money,omitempty"` - // If the most recent payment was a cash payment - // in a currency that rounds cash payments (such as, `CAD` or `AUD`) and the payment - // is rounded from `computed_amount_money` in the payment request, then this - // field specifies the rounding adjustment applied. This amount - // might be negative. - RoundingAdjustmentIncludedMoney *Money `json:"rounding_adjustment_included_money,omitempty" url:"rounding_adjustment_included_money,omitempty"` +// Provides metadata when the event `type` is `EXPIRE_POINTS`. +type LoyaltyEventExpirePoints struct { + // The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram). + LoyaltyProgramID string `json:"loyalty_program_id" url:"loyalty_program_id"` + // The number of points expired. + Points int `json:"points" url:"points"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (i *InvoicePaymentRequest) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (l *LoyaltyEventExpirePoints) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (i *InvoicePaymentRequest) UnmarshalJSON(data []byte) error { - type unmarshaler InvoicePaymentRequest +func (l *LoyaltyEventExpirePoints) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyEventExpirePoints var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *i = InvoicePaymentRequest(value) + *l = LoyaltyEventExpirePoints(value) - extraProperties, err := core.ExtractExtraProperties(data, *i) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - i.extraProperties = extraProperties + l.extraProperties = extraProperties - i._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (i *InvoicePaymentRequest) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (l *LoyaltyEventExpirePoints) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", i) + return fmt.Sprintf("%#v", l) } -// Describes query criteria for searching invoices. -type InvoiceQuery struct { - // Query filters to apply in searching invoices. - // For more information, see [Search for invoices](https://developer.squareup.com/docs/invoices-api/retrieve-list-search-invoices#search-invoices). - Filter *InvoiceFilter `json:"filter,omitempty" url:"filter,omitempty"` - // Describes the sort order for the search result. - Sort *InvoiceSort `json:"sort,omitempty" url:"sort,omitempty"` +// The filtering criteria. If the request specifies multiple filters, +// the endpoint uses a logical AND to evaluate them. +type LoyaltyEventFilter struct { + // Filter events by loyalty account. + LoyaltyAccountFilter *LoyaltyEventLoyaltyAccountFilter `json:"loyalty_account_filter,omitempty" url:"loyalty_account_filter,omitempty"` + // Filter events by event type. + TypeFilter *LoyaltyEventTypeFilter `json:"type_filter,omitempty" url:"type_filter,omitempty"` + // Filter events by date time range. + // For each range, the start time is inclusive and the end time + // is exclusive. + DateTimeFilter *LoyaltyEventDateTimeFilter `json:"date_time_filter,omitempty" url:"date_time_filter,omitempty"` + // Filter events by location. + LocationFilter *LoyaltyEventLocationFilter `json:"location_filter,omitempty" url:"location_filter,omitempty"` + // Filter events by the order associated with the event. + OrderFilter *LoyaltyEventOrderFilter `json:"order_filter,omitempty" url:"order_filter,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (i *InvoiceQuery) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (l *LoyaltyEventFilter) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (i *InvoiceQuery) UnmarshalJSON(data []byte) error { - type unmarshaler InvoiceQuery +func (l *LoyaltyEventFilter) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyEventFilter var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *i = InvoiceQuery(value) + *l = LoyaltyEventFilter(value) - extraProperties, err := core.ExtractExtraProperties(data, *i) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - i.extraProperties = extraProperties + l.extraProperties = extraProperties - i._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (i *InvoiceQuery) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (l *LoyaltyEventFilter) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", i) + return fmt.Sprintf("%#v", l) } -// Represents a snapshot of customer data. This object stores customer data that is displayed on the invoice -// and that Square uses to deliver the invoice. -// -// When you provide a customer ID for a draft invoice, Square retrieves the associated customer profile and populates -// the remaining `InvoiceRecipient` fields. You cannot update these fields after the invoice is published. -// Square updates the customer ID in response to a merge operation, but does not update other fields. -type InvoiceRecipient struct { - // The ID of the customer. This is the customer profile ID that - // you provide when creating a draft invoice. - CustomerID *string `json:"customer_id,omitempty" url:"customer_id,omitempty"` - // The recipient's given (that is, first) name. - GivenName *string `json:"given_name,omitempty" url:"given_name,omitempty"` - // The recipient's family (that is, last) name. - FamilyName *string `json:"family_name,omitempty" url:"family_name,omitempty"` - // The recipient's email address. - EmailAddress *string `json:"email_address,omitempty" url:"email_address,omitempty"` - // The recipient's physical address. - Address *Address `json:"address,omitempty" url:"address,omitempty"` - // The recipient's phone number. - PhoneNumber *string `json:"phone_number,omitempty" url:"phone_number,omitempty"` - // The name of the recipient's company. - CompanyName *string `json:"company_name,omitempty" url:"company_name,omitempty"` - // The recipient's tax IDs. The country of the seller account determines whether this field - // is available for the customer. For more information, see [Invoice recipient tax IDs](https://developer.squareup.com/docs/invoices-api/overview#recipient-tax-ids). - TaxIDs *InvoiceRecipientTaxIDs `json:"tax_ids,omitempty" url:"tax_ids,omitempty"` +// Filter events by location. +type LoyaltyEventLocationFilter struct { + // The [location](entity:Location) IDs for loyalty events to query. + // If multiple values are specified, the endpoint uses + // a logical OR to combine them. + LocationIDs []string `json:"location_ids,omitempty" url:"location_ids,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (i *InvoiceRecipient) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (l *LoyaltyEventLocationFilter) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (i *InvoiceRecipient) UnmarshalJSON(data []byte) error { - type unmarshaler InvoiceRecipient +func (l *LoyaltyEventLocationFilter) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyEventLocationFilter var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *i = InvoiceRecipient(value) + *l = LoyaltyEventLocationFilter(value) - extraProperties, err := core.ExtractExtraProperties(data, *i) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - i.extraProperties = extraProperties + l.extraProperties = extraProperties - i._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (i *InvoiceRecipient) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (l *LoyaltyEventLocationFilter) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", i) + return fmt.Sprintf("%#v", l) } -// Represents the tax IDs for an invoice recipient. The country of the seller account determines -// whether the corresponding `tax_ids` field is available for the customer. For more information, -// see [Invoice recipient tax IDs](https://developer.squareup.com/docs/invoices-api/overview#recipient-tax-ids). -type InvoiceRecipientTaxIDs struct { - // The EU VAT identification number for the invoice recipient. For example, `IE3426675K`. - EuVat *string `json:"eu_vat,omitempty" url:"eu_vat,omitempty"` +// Filter events by loyalty account. +type LoyaltyEventLoyaltyAccountFilter struct { + // The ID of the [loyalty account](entity:LoyaltyAccount) associated with loyalty events. + LoyaltyAccountID string `json:"loyalty_account_id" url:"loyalty_account_id"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (i *InvoiceRecipientTaxIDs) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (l *LoyaltyEventLoyaltyAccountFilter) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (i *InvoiceRecipientTaxIDs) UnmarshalJSON(data []byte) error { - type unmarshaler InvoiceRecipientTaxIDs +func (l *LoyaltyEventLoyaltyAccountFilter) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyEventLoyaltyAccountFilter var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *i = InvoiceRecipientTaxIDs(value) + *l = LoyaltyEventLoyaltyAccountFilter(value) - extraProperties, err := core.ExtractExtraProperties(data, *i) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - i.extraProperties = extraProperties + l.extraProperties = extraProperties - i._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (i *InvoiceRecipientTaxIDs) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (l *LoyaltyEventLoyaltyAccountFilter) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", i) -} - -// Specifies the action for Square to take for processing the invoice. For example, -// email the invoice, charge a customer's card on file, or do nothing. DEPRECATED at -// version 2021-01-21. The corresponding `request_method` field is replaced by the -// `Invoice.delivery_method` and `InvoicePaymentRequest.automatic_payment_source` fields. -type InvoiceRequestMethod string - -const ( - InvoiceRequestMethodEmail InvoiceRequestMethod = "EMAIL" - InvoiceRequestMethodChargeCardOnFile InvoiceRequestMethod = "CHARGE_CARD_ON_FILE" - InvoiceRequestMethodShareManually InvoiceRequestMethod = "SHARE_MANUALLY" - InvoiceRequestMethodChargeBankOnFile InvoiceRequestMethod = "CHARGE_BANK_ON_FILE" - InvoiceRequestMethodSms InvoiceRequestMethod = "SMS" - InvoiceRequestMethodSmsChargeCardOnFile InvoiceRequestMethod = "SMS_CHARGE_CARD_ON_FILE" - InvoiceRequestMethodSmsChargeBankOnFile InvoiceRequestMethod = "SMS_CHARGE_BANK_ON_FILE" -) - -func NewInvoiceRequestMethodFromString(s string) (InvoiceRequestMethod, error) { - switch s { - case "EMAIL": - return InvoiceRequestMethodEmail, nil - case "CHARGE_CARD_ON_FILE": - return InvoiceRequestMethodChargeCardOnFile, nil - case "SHARE_MANUALLY": - return InvoiceRequestMethodShareManually, nil - case "CHARGE_BANK_ON_FILE": - return InvoiceRequestMethodChargeBankOnFile, nil - case "SMS": - return InvoiceRequestMethodSms, nil - case "SMS_CHARGE_CARD_ON_FILE": - return InvoiceRequestMethodSmsChargeCardOnFile, nil - case "SMS_CHARGE_BANK_ON_FILE": - return InvoiceRequestMethodSmsChargeBankOnFile, nil - } - var t InvoiceRequestMethod - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (i InvoiceRequestMethod) Ptr() *InvoiceRequestMethod { - return &i -} - -// Indicates the type of the payment request. For more information, see -// [Configuring payment requests](https://developer.squareup.com/docs/invoices-api/create-publish-invoices#payment-requests). -type InvoiceRequestType string - -const ( - InvoiceRequestTypeBalance InvoiceRequestType = "BALANCE" - InvoiceRequestTypeDeposit InvoiceRequestType = "DEPOSIT" - InvoiceRequestTypeInstallment InvoiceRequestType = "INSTALLMENT" -) - -func NewInvoiceRequestTypeFromString(s string) (InvoiceRequestType, error) { - switch s { - case "BALANCE": - return InvoiceRequestTypeBalance, nil - case "DEPOSIT": - return InvoiceRequestTypeDeposit, nil - case "INSTALLMENT": - return InvoiceRequestTypeInstallment, nil - } - var t InvoiceRequestType - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (i InvoiceRequestType) Ptr() *InvoiceRequestType { - return &i + return fmt.Sprintf("%#v", l) } -// Identifies the sort field and sort order. -type InvoiceSort struct { - // The field to use for sorting. - // See [InvoiceSortField](#type-invoicesortfield) for possible values - Field InvoiceSortField `json:"field,omitempty" url:"field,omitempty"` - // The order to use for sorting the results. - // See [SortOrder](#type-sortorder) for possible values - Order *SortOrder `json:"order,omitempty" url:"order,omitempty"` +// Filter events by the order associated with the event. +type LoyaltyEventOrderFilter struct { + // The ID of the [order](entity:Order) associated with the event. + OrderID string `json:"order_id" url:"order_id"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (i *InvoiceSort) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (l *LoyaltyEventOrderFilter) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (i *InvoiceSort) UnmarshalJSON(data []byte) error { - type unmarshaler InvoiceSort +func (l *LoyaltyEventOrderFilter) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyEventOrderFilter var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *i = InvoiceSort(value) + *l = LoyaltyEventOrderFilter(value) - extraProperties, err := core.ExtractExtraProperties(data, *i) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - i.extraProperties = extraProperties + l.extraProperties = extraProperties - i._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (i *InvoiceSort) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (l *LoyaltyEventOrderFilter) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", i) -} - -// The field to use for sorting. -type InvoiceSortField = string - -// Indicates the status of an invoice. -type InvoiceStatus string - -const ( - InvoiceStatusDraft InvoiceStatus = "DRAFT" - InvoiceStatusUnpaid InvoiceStatus = "UNPAID" - InvoiceStatusScheduled InvoiceStatus = "SCHEDULED" - InvoiceStatusPartiallyPaid InvoiceStatus = "PARTIALLY_PAID" - InvoiceStatusPaid InvoiceStatus = "PAID" - InvoiceStatusPartiallyRefunded InvoiceStatus = "PARTIALLY_REFUNDED" - InvoiceStatusRefunded InvoiceStatus = "REFUNDED" - InvoiceStatusCanceled InvoiceStatus = "CANCELED" - InvoiceStatusFailed InvoiceStatus = "FAILED" - InvoiceStatusPaymentPending InvoiceStatus = "PAYMENT_PENDING" -) - -func NewInvoiceStatusFromString(s string) (InvoiceStatus, error) { - switch s { - case "DRAFT": - return InvoiceStatusDraft, nil - case "UNPAID": - return InvoiceStatusUnpaid, nil - case "SCHEDULED": - return InvoiceStatusScheduled, nil - case "PARTIALLY_PAID": - return InvoiceStatusPartiallyPaid, nil - case "PAID": - return InvoiceStatusPaid, nil - case "PARTIALLY_REFUNDED": - return InvoiceStatusPartiallyRefunded, nil - case "REFUNDED": - return InvoiceStatusRefunded, nil - case "CANCELED": - return InvoiceStatusCanceled, nil - case "FAILED": - return InvoiceStatusFailed, nil - case "PAYMENT_PENDING": - return InvoiceStatusPaymentPending, nil - } - var t InvoiceStatus - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (i InvoiceStatus) Ptr() *InvoiceStatus { - return &i + return fmt.Sprintf("%#v", l) } -// Price and inventory alerting overrides for a `CatalogItemVariation` at a specific `Location`. -type ItemVariationLocationOverrides struct { - // The ID of the `Location`. This can include locations that are deactivated. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` - // The price of the `CatalogItemVariation` at the given `Location`, or blank for variable pricing. - PriceMoney *Money `json:"price_money,omitempty" url:"price_money,omitempty"` - // The pricing type (fixed or variable) for the `CatalogItemVariation` at the given `Location`. - // See [CatalogPricingType](#type-catalogpricingtype) for possible values - PricingType *CatalogPricingType `json:"pricing_type,omitempty" url:"pricing_type,omitempty"` - // If `true`, inventory tracking is active for the `CatalogItemVariation` at this `Location`. - TrackInventory *bool `json:"track_inventory,omitempty" url:"track_inventory,omitempty"` - // Indicates whether the `CatalogItemVariation` displays an alert when its inventory - // quantity is less than or equal to its `inventory_alert_threshold`. - // See [InventoryAlertType](#type-inventoryalerttype) for possible values - InventoryAlertType *InventoryAlertType `json:"inventory_alert_type,omitempty" url:"inventory_alert_type,omitempty"` - // If the inventory quantity for the variation is less than or equal to this value and `inventory_alert_type` - // is `LOW_QUANTITY`, the variation displays an alert in the merchant dashboard. - // - // This value is always an integer. - InventoryAlertThreshold *int64 `json:"inventory_alert_threshold,omitempty" url:"inventory_alert_threshold,omitempty"` - // Indicates whether the overridden item variation is sold out at the specified location. - // - // When inventory tracking is enabled on the item variation either globally or at the specified location, - // the item variation is automatically marked as sold out when its inventory count reaches zero. The seller - // can manually set the item variation as sold out even when the inventory count is greater than zero. - // Attempts by an application to set this attribute are ignored. Regardless how the sold-out status is set, - // applications should treat its inventory count as zero when this attribute value is `true`. - SoldOut *bool `json:"sold_out,omitempty" url:"sold_out,omitempty"` - // The seller-assigned timestamp, of the RFC 3339 format, to indicate when this sold-out variation - // becomes available again at the specified location. Attempts by an application to set this attribute are ignored. - // When the current time is later than this attribute value, the affected item variation is no longer sold out. - SoldOutValidUntil *string `json:"sold_out_valid_until,omitempty" url:"sold_out_valid_until,omitempty"` +// Provides metadata when the event `type` is `OTHER`. +type LoyaltyEventOther struct { + // The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram). + LoyaltyProgramID string `json:"loyalty_program_id" url:"loyalty_program_id"` + // The number of points added or removed. + Points int `json:"points" url:"points"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (i *ItemVariationLocationOverrides) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (l *LoyaltyEventOther) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (i *ItemVariationLocationOverrides) UnmarshalJSON(data []byte) error { - type unmarshaler ItemVariationLocationOverrides +func (l *LoyaltyEventOther) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyEventOther var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *i = ItemVariationLocationOverrides(value) + *l = LoyaltyEventOther(value) - extraProperties, err := core.ExtractExtraProperties(data, *i) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - i.extraProperties = extraProperties + l.extraProperties = extraProperties - i._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (i *ItemVariationLocationOverrides) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (l *LoyaltyEventOther) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", i) -} - -// An object describing a job that a team member is assigned to. -type JobAssignment struct { - // The title of the job. - JobTitle string `json:"job_title" url:"job_title"` - // The current pay type for the job assignment used to - // calculate the pay amount in a pay period. - // See [JobAssignmentPayType](#type-jobassignmentpaytype) for possible values - PayType JobAssignmentPayType `json:"pay_type" url:"pay_type"` - // The hourly pay rate of the job. - HourlyRate *Money `json:"hourly_rate,omitempty" url:"hourly_rate,omitempty"` - // The total pay amount for a 12-month period on the job. Set if the job `PayType` is `SALARY`. - AnnualRate *Money `json:"annual_rate,omitempty" url:"annual_rate,omitempty"` - // The planned hours per week for the job. Set if the job `PayType` is `SALARY`. - WeeklyHours *int `json:"weekly_hours,omitempty" url:"weekly_hours,omitempty"` + return fmt.Sprintf("%#v", l) +} + +// Represents a query used to search for loyalty events. +type LoyaltyEventQuery struct { + // The query filter criteria. + Filter *LoyaltyEventFilter `json:"filter,omitempty" url:"filter,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (j *JobAssignment) GetExtraProperties() map[string]interface{} { - return j.extraProperties +func (l *LoyaltyEventQuery) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (j *JobAssignment) UnmarshalJSON(data []byte) error { - type unmarshaler JobAssignment +func (l *LoyaltyEventQuery) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyEventQuery var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *j = JobAssignment(value) + *l = LoyaltyEventQuery(value) - extraProperties, err := core.ExtractExtraProperties(data, *j) + extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { return err } - j.extraProperties = extraProperties + l.extraProperties = extraProperties - j._rawJSON = json.RawMessage(data) + l._rawJSON = json.RawMessage(data) return nil } -func (j *JobAssignment) String() string { - if len(j._rawJSON) > 0 { - if value, err := core.StringifyJSON(j._rawJSON); err == nil { +func (l *LoyaltyEventQuery) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(j); err == nil { + if value, err := core.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", j) -} - -// Enumerates the possible pay types that a job can be assigned. -type JobAssignmentPayType string - -const ( - JobAssignmentPayTypeNone JobAssignmentPayType = "NONE" - JobAssignmentPayTypeHourly JobAssignmentPayType = "HOURLY" - JobAssignmentPayTypeSalary JobAssignmentPayType = "SALARY" -) - -func NewJobAssignmentPayTypeFromString(s string) (JobAssignmentPayType, error) { - switch s { - case "NONE": - return JobAssignmentPayTypeNone, nil - case "HOURLY": - return JobAssignmentPayTypeHourly, nil - case "SALARY": - return JobAssignmentPayTypeSalary, nil - } - var t JobAssignmentPayType - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (j JobAssignmentPayType) Ptr() *JobAssignmentPayType { - return &j + return fmt.Sprintf("%#v", l) } -// A response that contains the linked `GiftCard` object. If the request resulted in errors, -// the response contains a set of `Error` objects. -type LinkCustomerToGiftCardResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The gift card with the ID of the linked customer listed in the `customer_ids` field. - GiftCard *GiftCard `json:"gift_card,omitempty" url:"gift_card,omitempty"` +// Provides metadata when the event `type` is `REDEEM_REWARD`. +type LoyaltyEventRedeemReward struct { + // The ID of the [loyalty program](entity:LoyaltyProgram). + LoyaltyProgramID string `json:"loyalty_program_id" url:"loyalty_program_id"` + // The ID of the redeemed [loyalty reward](entity:LoyaltyReward). + // This field is returned only if the event source is `LOYALTY_API`. + RewardID *string `json:"reward_id,omitempty" url:"reward_id,omitempty"` + // The ID of the [order](entity:Order) that redeemed the reward. + // This field is returned only if the Orders API is used to process orders. + OrderID *string `json:"order_id,omitempty" url:"order_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LinkCustomerToGiftCardResponse) GetExtraProperties() map[string]interface{} { +func (l *LoyaltyEventRedeemReward) GetExtraProperties() map[string]interface{} { return l.extraProperties } -func (l *LinkCustomerToGiftCardResponse) UnmarshalJSON(data []byte) error { - type unmarshaler LinkCustomerToGiftCardResponse +func (l *LoyaltyEventRedeemReward) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyEventRedeemReward var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LinkCustomerToGiftCardResponse(value) + *l = LoyaltyEventRedeemReward(value) extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { @@ -31929,7 +47715,7 @@ func (l *LinkCustomerToGiftCardResponse) UnmarshalJSON(data []byte) error { return nil } -func (l *LinkCustomerToGiftCardResponse) String() string { +func (l *LoyaltyEventRedeemReward) String() string { if len(l._rawJSON) > 0 { if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value @@ -31941,38 +47727,105 @@ func (l *LinkCustomerToGiftCardResponse) String() string { return fmt.Sprintf("%#v", l) } -// Request object for fetching all `BankAccount` -// objects linked to a account. -type ListBankAccountsRequest struct { - // The pagination cursor returned by a previous call to this endpoint. - // Use it in the next `ListBankAccounts` request to retrieve the next set - // of results. - // - // See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // Upper limit on the number of bank accounts to return in the response. - // Currently, 1000 is the largest supported limit. You can specify a limit - // of up to 1000 bank accounts. This is also the default limit. - Limit *int `json:"limit,omitempty" url:"limit,omitempty"` - // Location ID. You can specify this optional filter - // to retrieve only the linked bank accounts belonging to a specific location. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` +// Defines whether the event was generated by the Square Point of Sale. +type LoyaltyEventSource string + +const ( + LoyaltyEventSourceSourceDoNotUse LoyaltyEventSource = "SOURCE_DO_NOT_USE" + LoyaltyEventSourceSquare LoyaltyEventSource = "SQUARE" + LoyaltyEventSourceLoyaltyAPI LoyaltyEventSource = "LOYALTY_API" +) + +func NewLoyaltyEventSourceFromString(s string) (LoyaltyEventSource, error) { + switch s { + case "SOURCE_DO_NOT_USE": + return LoyaltyEventSourceSourceDoNotUse, nil + case "SQUARE": + return LoyaltyEventSourceSquare, nil + case "LOYALTY_API": + return LoyaltyEventSourceLoyaltyAPI, nil + } + var t LoyaltyEventSource + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (l LoyaltyEventSource) Ptr() *LoyaltyEventSource { + return &l +} + +// The type of the loyalty event. +type LoyaltyEventType string + +const ( + LoyaltyEventTypeTypeDoNotUse LoyaltyEventType = "TYPE_DO_NOT_USE" + LoyaltyEventTypeCreateAccount LoyaltyEventType = "CREATE_ACCOUNT" + LoyaltyEventTypeAccumulatePoints LoyaltyEventType = "ACCUMULATE_POINTS" + LoyaltyEventTypeCreateReward LoyaltyEventType = "CREATE_REWARD" + LoyaltyEventTypeRedeemReward LoyaltyEventType = "REDEEM_REWARD" + LoyaltyEventTypeDeleteReward LoyaltyEventType = "DELETE_REWARD" + LoyaltyEventTypeAdjustPoints LoyaltyEventType = "ADJUST_POINTS" + LoyaltyEventTypeExpirePoints LoyaltyEventType = "EXPIRE_POINTS" + LoyaltyEventTypeOther LoyaltyEventType = "OTHER" + LoyaltyEventTypeAccumulatePromotionPoints LoyaltyEventType = "ACCUMULATE_PROMOTION_POINTS" + LoyaltyEventTypeAccumulateTierPoints LoyaltyEventType = "ACCUMULATE_TIER_POINTS" +) + +func NewLoyaltyEventTypeFromString(s string) (LoyaltyEventType, error) { + switch s { + case "TYPE_DO_NOT_USE": + return LoyaltyEventTypeTypeDoNotUse, nil + case "CREATE_ACCOUNT": + return LoyaltyEventTypeCreateAccount, nil + case "ACCUMULATE_POINTS": + return LoyaltyEventTypeAccumulatePoints, nil + case "CREATE_REWARD": + return LoyaltyEventTypeCreateReward, nil + case "REDEEM_REWARD": + return LoyaltyEventTypeRedeemReward, nil + case "DELETE_REWARD": + return LoyaltyEventTypeDeleteReward, nil + case "ADJUST_POINTS": + return LoyaltyEventTypeAdjustPoints, nil + case "EXPIRE_POINTS": + return LoyaltyEventTypeExpirePoints, nil + case "OTHER": + return LoyaltyEventTypeOther, nil + case "ACCUMULATE_PROMOTION_POINTS": + return LoyaltyEventTypeAccumulatePromotionPoints, nil + case "ACCUMULATE_TIER_POINTS": + return LoyaltyEventTypeAccumulateTierPoints, nil + } + var t LoyaltyEventType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (l LoyaltyEventType) Ptr() *LoyaltyEventType { + return &l +} + +// Filter events by event type. +type LoyaltyEventTypeFilter struct { + // The loyalty event types used to filter the result. + // If multiple values are specified, the endpoint uses a + // logical OR to combine them. + // See [LoyaltyEventType](#type-loyaltyeventtype) for possible values + Types []LoyaltyEventType `json:"types,omitempty" url:"types,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListBankAccountsRequest) GetExtraProperties() map[string]interface{} { +func (l *LoyaltyEventTypeFilter) GetExtraProperties() map[string]interface{} { return l.extraProperties } -func (l *ListBankAccountsRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListBankAccountsRequest +func (l *LoyaltyEventTypeFilter) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyEventTypeFilter var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListBankAccountsRequest(value) + *l = LoyaltyEventTypeFilter(value) extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { @@ -31984,7 +47837,7 @@ func (l *ListBankAccountsRequest) UnmarshalJSON(data []byte) error { return nil } -func (l *ListBankAccountsRequest) String() string { +func (l *LoyaltyEventTypeFilter) String() string { if len(l._rawJSON) > 0 { if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value @@ -31996,34 +47849,48 @@ func (l *ListBankAccountsRequest) String() string { return fmt.Sprintf("%#v", l) } -// Response object returned by ListBankAccounts. -type ListBankAccountsResponse struct { - // Information on errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // List of BankAccounts associated with this account. - BankAccounts []*BankAccount `json:"bank_accounts,omitempty" url:"bank_accounts,omitempty"` - // When a response is truncated, it includes a cursor that you can - // use in a subsequent request to fetch next set of bank accounts. - // If empty, this is the final response. - // - // For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` +// Represents a Square loyalty program. Loyalty programs define how buyers can earn points and redeem points for rewards. +// Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard. +// For more information, see [Loyalty Program Overview](https://developer.squareup.com/docs/loyalty/overview). +type LoyaltyProgram struct { + // The Square-assigned ID of the loyalty program. Updates to + // the loyalty program do not modify the identifier. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // Whether the program is currently active. + // See [LoyaltyProgramStatus](#type-loyaltyprogramstatus) for possible values + Status *LoyaltyProgramStatus `json:"status,omitempty" url:"status,omitempty"` + // The list of rewards for buyers, sorted by ascending points. + RewardTiers []*LoyaltyProgramRewardTier `json:"reward_tiers,omitempty" url:"reward_tiers,omitempty"` + // If present, details for how points expire. + ExpirationPolicy *LoyaltyProgramExpirationPolicy `json:"expiration_policy,omitempty" url:"expiration_policy,omitempty"` + // A cosmetic name for the “points” currency. + Terminology *LoyaltyProgramTerminology `json:"terminology,omitempty" url:"terminology,omitempty"` + // The [locations](entity:Location) at which the program is active. + LocationIDs []string `json:"location_ids,omitempty" url:"location_ids,omitempty"` + // The timestamp when the program was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The timestamp when the reward was last updated, in RFC 3339 format. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // Defines how buyers can earn loyalty points from the base loyalty program. + // To check for associated [loyalty promotions](entity:LoyaltyPromotion) that enable + // buyers to earn extra points, call [ListLoyaltyPromotions](api-endpoint:Loyalty-ListLoyaltyPromotions). + AccrualRules []*LoyaltyProgramAccrualRule `json:"accrual_rules,omitempty" url:"accrual_rules,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListBankAccountsResponse) GetExtraProperties() map[string]interface{} { +func (l *LoyaltyProgram) GetExtraProperties() map[string]interface{} { return l.extraProperties } -func (l *ListBankAccountsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListBankAccountsResponse +func (l *LoyaltyProgram) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyProgram var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListBankAccountsResponse(value) + *l = LoyaltyProgram(value) extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { @@ -32035,7 +47902,7 @@ func (l *ListBankAccountsResponse) UnmarshalJSON(data []byte) error { return nil } -func (l *ListBankAccountsResponse) String() string { +func (l *LoyaltyProgram) String() string { if len(l._rawJSON) > 0 { if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value @@ -32047,35 +47914,66 @@ func (l *ListBankAccountsResponse) String() string { return fmt.Sprintf("%#v", l) } -// Represents a [ListBookingCustomAttributeDefinitions]($e/BookingCustomAttributes/ListBookingCustomAttributeDefinitions) response. -// Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response. -// If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`. -type ListBookingCustomAttributeDefinitionsResponse struct { - // The retrieved custom attribute definitions. If no custom attribute definitions are found, - // Square returns an empty object (`{}`). - CustomAttributeDefinitions []*CustomAttributeDefinition `json:"custom_attribute_definitions,omitempty" url:"custom_attribute_definitions,omitempty"` - // The cursor to provide in your next call to this endpoint to retrieve the next page of - // results for your original request. This field is present only if the request succeeded and - // additional results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Represents an accrual rule, which defines how buyers can earn points from the base [loyalty program](entity:LoyaltyProgram). +type LoyaltyProgramAccrualRule struct { + // The type of the accrual rule that defines how buyers can earn points. + // See [LoyaltyProgramAccrualRuleType](#type-loyaltyprogramaccrualruletype) for possible values + AccrualType LoyaltyProgramAccrualRuleType `json:"accrual_type" url:"accrual_type"` + // The number of points that + // buyers earn based on the `accrual_type`. + Points *int `json:"points,omitempty" url:"points,omitempty"` + // When the accrual rule is visit-based (`accrual_type` is `VISIT`), + // this field indicates the minimum purchase required during the visit to + // quality for the reward. + VisitMinimumAmountMoney *Money `json:"visit_minimum_amount_money,omitempty" url:"visit_minimum_amount_money,omitempty"` + // When the accrual rule is spend-based (`accrual_type` is `SPEND`), + // this field indicates the amount that a buyer must spend + // to earn the points. For example, + // suppose the accrual rule is "earn 1 point for every $10 you spend". + // Then, buyer earns a point for every $10 they spend. If + // buyer spends $105, the buyer earns 10 points. + SpendAmountMoney *Money `json:"spend_amount_money,omitempty" url:"spend_amount_money,omitempty"` + // When the accrual rule is item-based or category-based, this field specifies the ID + // of the [catalog object](entity:CatalogObject) that buyers can purchase to earn points. + // If `accrual_type` is `ITEM_VARIATION`, the object is an item variation. + // If `accrual_type` is `CATEGORY`, the object is a category. + CatalogObjectID *string `json:"catalog_object_id,omitempty" url:"catalog_object_id,omitempty"` + // When the accrual rule is spend-based (`accrual_type` is `SPEND`), this field + // lists the IDs of any `CATEGORY` catalog objects that are excluded from points accrual. + // + // You can use the [BatchRetrieveCatalogObjects](api-endpoint:Catalog-BatchRetrieveCatalogObjects) + // endpoint to retrieve information about the excluded categories. + ExcludedCategoryIDs []string `json:"excluded_category_ids,omitempty" url:"excluded_category_ids,omitempty"` + // When the accrual rule is spend-based (`accrual_type` is `SPEND`), this field + // lists the IDs of any `ITEM_VARIATION` catalog objects that are excluded from points accrual. + // + // You can use the [BatchRetrieveCatalogObjects](api-endpoint:Catalog-BatchRetrieveCatalogObjects) + // endpoint to retrieve information about the excluded item variations. + ExcludedItemVariationIDs []string `json:"excluded_item_variation_ids,omitempty" url:"excluded_item_variation_ids,omitempty"` + // Additional data for rules with the `VISIT` accrual type. + VisitData *LoyaltyProgramAccrualRuleVisitData `json:"visit_data,omitempty" url:"visit_data,omitempty"` + // Additional data for rules with the `SPEND` accrual type. + SpendData *LoyaltyProgramAccrualRuleSpendData `json:"spend_data,omitempty" url:"spend_data,omitempty"` + // Additional data for rules with the `ITEM_VARIATION` accrual type. + ItemVariationData *LoyaltyProgramAccrualRuleItemVariationData `json:"item_variation_data,omitempty" url:"item_variation_data,omitempty"` + // Additional data for rules with the `CATEGORY` accrual type. + CategoryData *LoyaltyProgramAccrualRuleCategoryData `json:"category_data,omitempty" url:"category_data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListBookingCustomAttributeDefinitionsResponse) GetExtraProperties() map[string]interface{} { +func (l *LoyaltyProgramAccrualRule) GetExtraProperties() map[string]interface{} { return l.extraProperties } -func (l *ListBookingCustomAttributeDefinitionsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListBookingCustomAttributeDefinitionsResponse +func (l *LoyaltyProgramAccrualRule) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyProgramAccrualRule var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListBookingCustomAttributeDefinitionsResponse(value) + *l = LoyaltyProgramAccrualRule(value) extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { @@ -32087,7 +47985,7 @@ func (l *ListBookingCustomAttributeDefinitionsResponse) UnmarshalJSON(data []byt return nil } -func (l *ListBookingCustomAttributeDefinitionsResponse) String() string { +func (l *LoyaltyProgramAccrualRule) String() string { if len(l._rawJSON) > 0 { if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value @@ -32099,37 +47997,27 @@ func (l *ListBookingCustomAttributeDefinitionsResponse) String() string { return fmt.Sprintf("%#v", l) } -// Represents a [ListBookingCustomAttributes]($e/BookingCustomAttributes/ListBookingCustomAttributes) response. -// Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional -// results are available, the `cursor` field is also present along with `custom_attributes`. -type ListBookingCustomAttributesResponse struct { - // The retrieved custom attributes. If `with_definitions` was set to `true` in the request, - // the custom attribute definition is returned in the `definition` field of each custom attribute. - // - // If no custom attributes are found, Square returns an empty object (`{}`). - CustomAttributes []*CustomAttribute `json:"custom_attributes,omitempty" url:"custom_attributes,omitempty"` - // The cursor to use in your next call to this endpoint to retrieve the next page of results - // for your original request. This field is present only if the request succeeded and additional - // results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Represents additional data for rules with the `CATEGORY` accrual type. +type LoyaltyProgramAccrualRuleCategoryData struct { + // The ID of the `CATEGORY` [catalog object](entity:CatalogObject) that buyers can purchase to earn + // points. + CategoryID string `json:"category_id" url:"category_id"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListBookingCustomAttributesResponse) GetExtraProperties() map[string]interface{} { +func (l *LoyaltyProgramAccrualRuleCategoryData) GetExtraProperties() map[string]interface{} { return l.extraProperties } -func (l *ListBookingCustomAttributesResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListBookingCustomAttributesResponse +func (l *LoyaltyProgramAccrualRuleCategoryData) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyProgramAccrualRuleCategoryData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListBookingCustomAttributesResponse(value) + *l = LoyaltyProgramAccrualRuleCategoryData(value) extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { @@ -32141,7 +48029,7 @@ func (l *ListBookingCustomAttributesResponse) UnmarshalJSON(data []byte) error { return nil } -func (l *ListBookingCustomAttributesResponse) String() string { +func (l *LoyaltyProgramAccrualRuleCategoryData) String() string { if len(l._rawJSON) > 0 { if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value @@ -32153,37 +48041,27 @@ func (l *ListBookingCustomAttributesResponse) String() string { return fmt.Sprintf("%#v", l) } -type ListBookingsRequest struct { - // The maximum number of results per page to return in a paged response. - Limit *int `json:"limit,omitempty" 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:"cursor,omitempty" 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:"customer_id,omitempty" 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:"team_member_id,omitempty" 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:"location_id,omitempty" 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:"start_at_min,omitempty" 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:"start_at_max,omitempty" url:"start_at_max,omitempty"` +// Represents additional data for rules with the `ITEM_VARIATION` accrual type. +type LoyaltyProgramAccrualRuleItemVariationData struct { + // The ID of the `ITEM_VARIATION` [catalog object](entity:CatalogObject) that buyers can purchase to earn + // points. + ItemVariationID string `json:"item_variation_id" url:"item_variation_id"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListBookingsRequest) GetExtraProperties() map[string]interface{} { +func (l *LoyaltyProgramAccrualRuleItemVariationData) GetExtraProperties() map[string]interface{} { return l.extraProperties } -func (l *ListBookingsRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListBookingsRequest +func (l *LoyaltyProgramAccrualRuleItemVariationData) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyProgramAccrualRuleItemVariationData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListBookingsRequest(value) + *l = LoyaltyProgramAccrualRuleItemVariationData(value) extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { @@ -32195,7 +48073,7 @@ func (l *ListBookingsRequest) UnmarshalJSON(data []byte) error { return nil } -func (l *ListBookingsRequest) String() string { +func (l *LoyaltyProgramAccrualRuleItemVariationData) String() string { if len(l._rawJSON) > 0 { if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value @@ -32207,29 +48085,40 @@ func (l *ListBookingsRequest) String() string { return fmt.Sprintf("%#v", l) } -type ListBookingsResponse struct { - // The list of targeted bookings. - Bookings []*Booking `json:"bookings,omitempty" url:"bookings,omitempty"` - // The pagination cursor to be used in the subsequent request to get the next page of the results. Stop retrieving the next page of the results when the cursor is not set. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // Errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Represents additional data for rules with the `SPEND` accrual type. +type LoyaltyProgramAccrualRuleSpendData struct { + // The amount that buyers must spend to earn points. + // For example, given an "Earn 1 point for every $10 spent" accrual rule, a buyer who spends $105 earns 10 points. + AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` + // The IDs of any `CATEGORY` catalog objects that are excluded from points accrual. + // + // You can use the [BatchRetrieveCatalogObjects](api-endpoint:Catalog-BatchRetrieveCatalogObjects) + // endpoint to retrieve information about the excluded categories. + ExcludedCategoryIDs []string `json:"excluded_category_ids,omitempty" url:"excluded_category_ids,omitempty"` + // The IDs of any `ITEM_VARIATION` catalog objects that are excluded from points accrual. + // + // You can use the [BatchRetrieveCatalogObjects](api-endpoint:Catalog-BatchRetrieveCatalogObjects) + // endpoint to retrieve information about the excluded item variations. + ExcludedItemVariationIDs []string `json:"excluded_item_variation_ids,omitempty" url:"excluded_item_variation_ids,omitempty"` + // Indicates how taxes should be treated when calculating the purchase amount used for points accrual. + // See [LoyaltyProgramAccrualRuleTaxMode](#type-loyaltyprogramaccrualruletaxmode) for possible values + TaxMode LoyaltyProgramAccrualRuleTaxMode `json:"tax_mode" url:"tax_mode"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListBookingsResponse) GetExtraProperties() map[string]interface{} { +func (l *LoyaltyProgramAccrualRuleSpendData) GetExtraProperties() map[string]interface{} { return l.extraProperties } -func (l *ListBookingsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListBookingsResponse +func (l *LoyaltyProgramAccrualRuleSpendData) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyProgramAccrualRuleSpendData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListBookingsResponse(value) + *l = LoyaltyProgramAccrualRuleSpendData(value) extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { @@ -32241,7 +48130,7 @@ func (l *ListBookingsResponse) UnmarshalJSON(data []byte) error { return nil } -func (l *ListBookingsResponse) String() string { +func (l *LoyaltyProgramAccrualRuleSpendData) String() string { if len(l._rawJSON) > 0 { if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value @@ -32253,32 +48142,89 @@ func (l *ListBookingsResponse) String() string { return fmt.Sprintf("%#v", l) } -// A request for a filtered set of `BreakType` objects. -type ListBreakTypesRequest struct { - // Filter the returned `BreakType` results to only those that are associated with the - // specified location. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` - // The maximum number of `BreakType` results to return per page. The number can range between 1 - // and 200. The default is 200. - Limit *int `json:"limit,omitempty" url:"limit,omitempty"` - // A pointer to the next page of `BreakType` results to fetch. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` +// Indicates how taxes should be treated when calculating the purchase amount used for loyalty points accrual. +// This setting applies only to `SPEND` accrual rules or `VISIT` accrual rules that have a minimum spend requirement. +type LoyaltyProgramAccrualRuleTaxMode string + +const ( + LoyaltyProgramAccrualRuleTaxModeTaxModeDoNotUse LoyaltyProgramAccrualRuleTaxMode = "TAX_MODE_DO_NOT_USE" + LoyaltyProgramAccrualRuleTaxModeBeforeTax LoyaltyProgramAccrualRuleTaxMode = "BEFORE_TAX" + LoyaltyProgramAccrualRuleTaxModeAfterTax LoyaltyProgramAccrualRuleTaxMode = "AFTER_TAX" +) + +func NewLoyaltyProgramAccrualRuleTaxModeFromString(s string) (LoyaltyProgramAccrualRuleTaxMode, error) { + switch s { + case "TAX_MODE_DO_NOT_USE": + return LoyaltyProgramAccrualRuleTaxModeTaxModeDoNotUse, nil + case "BEFORE_TAX": + return LoyaltyProgramAccrualRuleTaxModeBeforeTax, nil + case "AFTER_TAX": + return LoyaltyProgramAccrualRuleTaxModeAfterTax, nil + } + var t LoyaltyProgramAccrualRuleTaxMode + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (l LoyaltyProgramAccrualRuleTaxMode) Ptr() *LoyaltyProgramAccrualRuleTaxMode { + return &l +} + +// The type of the accrual rule that defines how buyers can earn points. +type LoyaltyProgramAccrualRuleType string + +const ( + LoyaltyProgramAccrualRuleTypeTypeDoNotUse LoyaltyProgramAccrualRuleType = "TYPE_DO_NOT_USE" + LoyaltyProgramAccrualRuleTypeVisit LoyaltyProgramAccrualRuleType = "VISIT" + LoyaltyProgramAccrualRuleTypeSpend LoyaltyProgramAccrualRuleType = "SPEND" + LoyaltyProgramAccrualRuleTypeItemVariation LoyaltyProgramAccrualRuleType = "ITEM_VARIATION" + LoyaltyProgramAccrualRuleTypeCategory LoyaltyProgramAccrualRuleType = "CATEGORY" +) + +func NewLoyaltyProgramAccrualRuleTypeFromString(s string) (LoyaltyProgramAccrualRuleType, error) { + switch s { + case "TYPE_DO_NOT_USE": + return LoyaltyProgramAccrualRuleTypeTypeDoNotUse, nil + case "VISIT": + return LoyaltyProgramAccrualRuleTypeVisit, nil + case "SPEND": + return LoyaltyProgramAccrualRuleTypeSpend, nil + case "ITEM_VARIATION": + return LoyaltyProgramAccrualRuleTypeItemVariation, nil + case "CATEGORY": + return LoyaltyProgramAccrualRuleTypeCategory, nil + } + var t LoyaltyProgramAccrualRuleType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (l LoyaltyProgramAccrualRuleType) Ptr() *LoyaltyProgramAccrualRuleType { + return &l +} + +// Represents additional data for rules with the `VISIT` accrual type. +type LoyaltyProgramAccrualRuleVisitData struct { + // The minimum purchase required during the visit to quality for points. + MinimumAmountMoney *Money `json:"minimum_amount_money,omitempty" url:"minimum_amount_money,omitempty"` + // Indicates how taxes should be treated when calculating the purchase amount to determine whether the visit qualifies for points. + // This setting applies only if `minimum_amount_money` is specified. + // See [LoyaltyProgramAccrualRuleTaxMode](#type-loyaltyprogramaccrualruletaxmode) for possible values + TaxMode LoyaltyProgramAccrualRuleTaxMode `json:"tax_mode" url:"tax_mode"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListBreakTypesRequest) GetExtraProperties() map[string]interface{} { +func (l *LoyaltyProgramAccrualRuleVisitData) GetExtraProperties() map[string]interface{} { return l.extraProperties } -func (l *ListBreakTypesRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListBreakTypesRequest +func (l *LoyaltyProgramAccrualRuleVisitData) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyProgramAccrualRuleVisitData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListBreakTypesRequest(value) + *l = LoyaltyProgramAccrualRuleVisitData(value) extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { @@ -32290,7 +48236,7 @@ func (l *ListBreakTypesRequest) UnmarshalJSON(data []byte) error { return nil } -func (l *ListBreakTypesRequest) String() string { +func (l *LoyaltyProgramAccrualRuleVisitData) String() string { if len(l._rawJSON) > 0 { if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value @@ -32302,33 +48248,35 @@ func (l *ListBreakTypesRequest) String() string { return fmt.Sprintf("%#v", l) } -// The response to a request for a set of `BreakType` objects. The response contains -// the requested `BreakType` objects and might contain a set of `Error` objects if -// the request resulted in errors. -type ListBreakTypesResponse struct { - // A page of `BreakType` results. - BreakTypes []*BreakType `json:"break_types,omitempty" url:"break_types,omitempty"` - // The value supplied in the subsequent request to fetch the next page - // of `BreakType` results. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Published when a [loyalty program](entity:LoyaltyProgram) is created. +type LoyaltyProgramCreatedEvent struct { + // The ID of the Square seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event. For this event, the value is `loyalty.program.created`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The unique ID for the event, which is used for + // [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *LoyaltyProgramCreatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListBreakTypesResponse) GetExtraProperties() map[string]interface{} { +func (l *LoyaltyProgramCreatedEvent) GetExtraProperties() map[string]interface{} { return l.extraProperties } -func (l *ListBreakTypesResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListBreakTypesResponse +func (l *LoyaltyProgramCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyProgramCreatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListBreakTypesResponse(value) + *l = LoyaltyProgramCreatedEvent(value) extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { @@ -32340,7 +48288,7 @@ func (l *ListBreakTypesResponse) UnmarshalJSON(data []byte) error { return nil } -func (l *ListBreakTypesResponse) String() string { +func (l *LoyaltyProgramCreatedEvent) String() string { if len(l._rawJSON) > 0 { if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value @@ -32352,42 +48300,30 @@ func (l *ListBreakTypesResponse) String() string { return fmt.Sprintf("%#v", l) } -// Retrieves details for a specific Card. Accessible via -// HTTP requests at GET https://connect.squareup.com/v2/cards -type ListCardsRequest struct { - // A pagination cursor returned by a previous call to this endpoint. - // Provide this to retrieve the next set of results for your original query. - // - // See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // Limit results to cards associated with the customer supplied. - // By default, all cards owned by the merchant are returned. - CustomerID *string `json:"customer_id,omitempty" url:"customer_id,omitempty"` - // Includes disabled cards. - // By default, all enabled cards owned by the merchant are returned. - IncludeDisabled *bool `json:"include_disabled,omitempty" url:"include_disabled,omitempty"` - // Limit results to cards associated with the reference_id supplied. - ReferenceID *string `json:"reference_id,omitempty" url:"reference_id,omitempty"` - // Sorts the returned list by when the card was created with the specified order. - // This field defaults to ASC. - // See [SortOrder](#type-sortorder) for possible values - SortOrder *SortOrder `json:"sort_order,omitempty" url:"sort_order,omitempty"` +// The data associated with a `loyalty.program.created` event. +type LoyaltyProgramCreatedEventData struct { + // The type of object affected by the event. For this event, the value is `loyalty_program`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The ID of the created loyalty program. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object that contains the loyalty program that was created. + Object *LoyaltyProgramCreatedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListCardsRequest) GetExtraProperties() map[string]interface{} { +func (l *LoyaltyProgramCreatedEventData) GetExtraProperties() map[string]interface{} { return l.extraProperties } -func (l *ListCardsRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListCardsRequest +func (l *LoyaltyProgramCreatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyProgramCreatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListCardsRequest(value) + *l = LoyaltyProgramCreatedEventData(value) extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { @@ -32399,7 +48335,7 @@ func (l *ListCardsRequest) UnmarshalJSON(data []byte) error { return nil } -func (l *ListCardsRequest) String() string { +func (l *LoyaltyProgramCreatedEventData) String() string { if len(l._rawJSON) > 0 { if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value @@ -32411,37 +48347,26 @@ func (l *ListCardsRequest) String() string { return fmt.Sprintf("%#v", l) } -// Defines the fields that are included in the response body of -// a request to the [ListCards]($e/Cards/ListCards) endpoint. -// -// Note: if there are errors processing the request, the card field will not be -// present. -type ListCardsResponse struct { - // Information on errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The requested list of `Card`s. - Cards []*Card `json:"cards,omitempty" url:"cards,omitempty"` - // The pagination cursor to be used in a subsequent request. If empty, - // this is the final response. - // - // See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` +// An object that contains the loyalty program associated with a `loyalty.program.created` event. +type LoyaltyProgramCreatedEventObject struct { + // The loyalty program that was created. + LoyaltyProgram *LoyaltyProgram `json:"loyalty_program,omitempty" url:"loyalty_program,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListCardsResponse) GetExtraProperties() map[string]interface{} { +func (l *LoyaltyProgramCreatedEventObject) GetExtraProperties() map[string]interface{} { return l.extraProperties } -func (l *ListCardsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListCardsResponse +func (l *LoyaltyProgramCreatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyProgramCreatedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListCardsResponse(value) + *l = LoyaltyProgramCreatedEventObject(value) extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { @@ -32453,7 +48378,7 @@ func (l *ListCardsResponse) UnmarshalJSON(data []byte) error { return nil } -func (l *ListCardsResponse) String() string { +func (l *LoyaltyProgramCreatedEventObject) String() string { if len(l._rawJSON) > 0 { if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value @@ -32465,30 +48390,27 @@ func (l *ListCardsResponse) String() string { return fmt.Sprintf("%#v", l) } -type ListCashDrawerShiftEventsRequest struct { - // The ID of the location to list cash drawer shifts for. - LocationID string `json:"location_id" url:"location_id"` - // Number of resources to be returned in a page of results (200 by - // default, 1000 max). - Limit *int `json:"limit,omitempty" url:"limit,omitempty"` - // Opaque cursor for fetching the next page of results. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` +// Describes when the loyalty program expires. +type LoyaltyProgramExpirationPolicy struct { + // The number of months before points expire, in `P[n]M` RFC 3339 duration format. For example, a value of `P12M` represents a duration of 12 months. + // Points are valid through the last day of the month in which they are scheduled to expire. For example, with a `P12M` duration, points earned on July 6, 2020 expire on August 1, 2021. + ExpirationDuration string `json:"expiration_duration" url:"expiration_duration"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListCashDrawerShiftEventsRequest) GetExtraProperties() map[string]interface{} { +func (l *LoyaltyProgramExpirationPolicy) GetExtraProperties() map[string]interface{} { return l.extraProperties } -func (l *ListCashDrawerShiftEventsRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListCashDrawerShiftEventsRequest +func (l *LoyaltyProgramExpirationPolicy) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyProgramExpirationPolicy var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListCashDrawerShiftEventsRequest(value) + *l = LoyaltyProgramExpirationPolicy(value) extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { @@ -32500,7 +48422,7 @@ func (l *ListCashDrawerShiftEventsRequest) UnmarshalJSON(data []byte) error { return nil } -func (l *ListCashDrawerShiftEventsRequest) String() string { +func (l *LoyaltyProgramExpirationPolicy) String() string { if len(l._rawJSON) > 0 { if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value @@ -32512,31 +48434,52 @@ func (l *ListCashDrawerShiftEventsRequest) String() string { return fmt.Sprintf("%#v", l) } -type ListCashDrawerShiftEventsResponse struct { - // Opaque cursor for fetching the next page. Cursor is not present in - // the last page of results. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // All of the events (payments, refunds, etc.) for a cash drawer during - // the shift. - CashDrawerShiftEvents []*CashDrawerShiftEvent `json:"cash_drawer_shift_events,omitempty" url:"cash_drawer_shift_events,omitempty"` +// Provides details about the reward tier discount. DEPRECATED at version 2020-12-16. Discount details +// are now defined using a catalog pricing rule and other catalog objects. For more information, see +// [Getting discount details for a reward tier](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards#get-discount-details). +type LoyaltyProgramRewardDefinition struct { + // Indicates the scope of the reward tier. DEPRECATED at version 2020-12-16. You can find this information in the + // `product_set_data` field of the `PRODUCT_SET` catalog object referenced by the pricing rule. For `ORDER` scopes, + // `all_products` is true. For `ITEM_VARIATION` or `CATEGORY` scopes, `product_ids_any` is a list of + // catalog object IDs of the given type. + // See [LoyaltyProgramRewardDefinitionScope](#type-loyaltyprogramrewarddefinitionscope) for possible values + Scope LoyaltyProgramRewardDefinitionScope `json:"scope" url:"scope"` + // The type of discount the reward tier offers. DEPRECATED at version 2020-12-16. You can find this information + // in the `discount_data.discount_type` field of the `DISCOUNT` catalog object referenced by the pricing rule. + // See [LoyaltyProgramRewardDefinitionType](#type-loyaltyprogramrewarddefinitiontype) for possible values + DiscountType LoyaltyProgramRewardDefinitionType `json:"discount_type" url:"discount_type"` + // The fixed percentage of the discount. Present if `discount_type` is `FIXED_PERCENTAGE`. + // For example, a 7.25% off discount will be represented as "7.25". DEPRECATED at version 2020-12-16. You can find this + // information in the `discount_data.percentage` field of the `DISCOUNT` catalog object referenced by the pricing rule. + PercentageDiscount *string `json:"percentage_discount,omitempty" url:"percentage_discount,omitempty"` + // The list of catalog objects to which this reward can be applied. They are either all item-variation ids or category ids, depending on the `type` field. + // DEPRECATED at version 2020-12-16. You can find this information in the `product_set_data.product_ids_any` field + // of the `PRODUCT_SET` catalog object referenced by the pricing rule. + CatalogObjectIDs []string `json:"catalog_object_ids,omitempty" url:"catalog_object_ids,omitempty"` + // The amount of the discount. Present if `discount_type` is `FIXED_AMOUNT`. For example, $5 off. + // DEPRECATED at version 2020-12-16. You can find this information in the `discount_data.amount_money` field of the + // `DISCOUNT` catalog object referenced by the pricing rule. + FixedDiscountMoney *Money `json:"fixed_discount_money,omitempty" url:"fixed_discount_money,omitempty"` + // When `discount_type` is `FIXED_PERCENTAGE`, the maximum discount amount that can be applied. + // DEPRECATED at version 2020-12-16. You can find this information in the `discount_data.maximum_amount_money` field + // of the `DISCOUNT` catalog object referenced by the the pricing rule. + MaxDiscountMoney *Money `json:"max_discount_money,omitempty" url:"max_discount_money,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListCashDrawerShiftEventsResponse) GetExtraProperties() map[string]interface{} { +func (l *LoyaltyProgramRewardDefinition) GetExtraProperties() map[string]interface{} { return l.extraProperties } -func (l *ListCashDrawerShiftEventsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListCashDrawerShiftEventsResponse +func (l *LoyaltyProgramRewardDefinition) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyProgramRewardDefinition var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListCashDrawerShiftEventsResponse(value) + *l = LoyaltyProgramRewardDefinition(value) extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { @@ -32548,7 +48491,7 @@ func (l *ListCashDrawerShiftEventsResponse) UnmarshalJSON(data []byte) error { return nil } -func (l *ListCashDrawerShiftEventsResponse) String() string { +func (l *LoyaltyProgramRewardDefinition) String() string { if len(l._rawJSON) > 0 { if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value @@ -32560,38 +48503,100 @@ func (l *ListCashDrawerShiftEventsResponse) String() string { return fmt.Sprintf("%#v", l) } -type ListCashDrawerShiftsRequest struct { - // The ID of the location to query for a list of cash drawer shifts. - LocationID string `json:"location_id" url:"location_id"` - // The order in which cash drawer shifts are listed in the response, - // based on their opened_at field. Default value: ASC - // See [SortOrder](#type-sortorder) for possible values - SortOrder *SortOrder `json:"sort_order,omitempty" url:"sort_order,omitempty"` - // The inclusive start time of the query on opened_at, in ISO 8601 format. - BeginTime *string `json:"begin_time,omitempty" url:"begin_time,omitempty"` - // The exclusive end date of the query on opened_at, in ISO 8601 format. - EndTime *string `json:"end_time,omitempty" url:"end_time,omitempty"` - // Number of cash drawer shift events in a page of results (200 by - // default, 1000 max). - Limit *int `json:"limit,omitempty" url:"limit,omitempty"` - // Opaque cursor for fetching the next page of results. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` +// Indicates the scope of the reward tier. DEPRECATED at version 2020-12-16. Discount details +// are now defined using a catalog pricing rule and other catalog objects. For more information, see +// [Getting discount details for a reward tier](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards#get-discount-details). +type LoyaltyProgramRewardDefinitionScope string + +const ( + LoyaltyProgramRewardDefinitionScopeScopeDoNotUse LoyaltyProgramRewardDefinitionScope = "SCOPE_DO_NOT_USE" + LoyaltyProgramRewardDefinitionScopeOrder LoyaltyProgramRewardDefinitionScope = "ORDER" + LoyaltyProgramRewardDefinitionScopeItemVariation LoyaltyProgramRewardDefinitionScope = "ITEM_VARIATION" + LoyaltyProgramRewardDefinitionScopeCategory LoyaltyProgramRewardDefinitionScope = "CATEGORY" +) + +func NewLoyaltyProgramRewardDefinitionScopeFromString(s string) (LoyaltyProgramRewardDefinitionScope, error) { + switch s { + case "SCOPE_DO_NOT_USE": + return LoyaltyProgramRewardDefinitionScopeScopeDoNotUse, nil + case "ORDER": + return LoyaltyProgramRewardDefinitionScopeOrder, nil + case "ITEM_VARIATION": + return LoyaltyProgramRewardDefinitionScopeItemVariation, nil + case "CATEGORY": + return LoyaltyProgramRewardDefinitionScopeCategory, nil + } + var t LoyaltyProgramRewardDefinitionScope + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (l LoyaltyProgramRewardDefinitionScope) Ptr() *LoyaltyProgramRewardDefinitionScope { + return &l +} + +// The type of discount the reward tier offers. DEPRECATED at version 2020-12-16. Discount details +// are now defined using a catalog pricing rule and other catalog objects. For more information, see +// [Getting discount details for a reward tier](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards#get-discount-details). +type LoyaltyProgramRewardDefinitionType string + +const ( + LoyaltyProgramRewardDefinitionTypeTypeDoNotUse LoyaltyProgramRewardDefinitionType = "TYPE_DO_NOT_USE" + LoyaltyProgramRewardDefinitionTypeFixedAmount LoyaltyProgramRewardDefinitionType = "FIXED_AMOUNT" + LoyaltyProgramRewardDefinitionTypeFixedPercentage LoyaltyProgramRewardDefinitionType = "FIXED_PERCENTAGE" +) + +func NewLoyaltyProgramRewardDefinitionTypeFromString(s string) (LoyaltyProgramRewardDefinitionType, error) { + switch s { + case "TYPE_DO_NOT_USE": + return LoyaltyProgramRewardDefinitionTypeTypeDoNotUse, nil + case "FIXED_AMOUNT": + return LoyaltyProgramRewardDefinitionTypeFixedAmount, nil + case "FIXED_PERCENTAGE": + return LoyaltyProgramRewardDefinitionTypeFixedPercentage, nil + } + var t LoyaltyProgramRewardDefinitionType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (l LoyaltyProgramRewardDefinitionType) Ptr() *LoyaltyProgramRewardDefinitionType { + return &l +} + +// Represents a reward tier in a loyalty program. A reward tier defines how buyers can redeem points for a reward, such as the number of points required and the value and scope of the discount. A loyalty program can offer multiple reward tiers. +type LoyaltyProgramRewardTier struct { + // The Square-assigned ID of the reward tier. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The points exchanged for the reward tier. + Points int `json:"points" url:"points"` + // The name of the reward tier. + Name *string `json:"name,omitempty" url:"name,omitempty"` + // Provides details about the reward tier definition. + // DEPRECATED at version 2020-12-16. Replaced by the `pricing_rule_reference` field. + Definition *LoyaltyProgramRewardDefinition `json:"definition,omitempty" url:"definition,omitempty"` + // The timestamp when the reward tier was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // A reference to the specific version of a `PRICING_RULE` catalog object that contains information about the reward tier discount. + // + // Use `object_id` and `catalog_version` with the [RetrieveCatalogObject](api-endpoint:Catalog-RetrieveCatalogObject) endpoint + // to get discount details. Make sure to set `include_related_objects` to true in the request to retrieve all catalog objects + // that define the discount. For more information, see [Getting discount details for a reward tier](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards#get-discount-details). + PricingRuleReference *CatalogObjectReference `json:"pricing_rule_reference,omitempty" url:"pricing_rule_reference,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListCashDrawerShiftsRequest) GetExtraProperties() map[string]interface{} { +func (l *LoyaltyProgramRewardTier) GetExtraProperties() map[string]interface{} { return l.extraProperties } -func (l *ListCashDrawerShiftsRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListCashDrawerShiftsRequest +func (l *LoyaltyProgramRewardTier) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyProgramRewardTier var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListCashDrawerShiftsRequest(value) + *l = LoyaltyProgramRewardTier(value) extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { @@ -32603,7 +48608,7 @@ func (l *ListCashDrawerShiftsRequest) UnmarshalJSON(data []byte) error { return nil } -func (l *ListCashDrawerShiftsRequest) String() string { +func (l *LoyaltyProgramRewardTier) String() string { if len(l._rawJSON) > 0 { if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value @@ -32615,31 +48620,54 @@ func (l *ListCashDrawerShiftsRequest) String() string { return fmt.Sprintf("%#v", l) } -type ListCashDrawerShiftsResponse struct { - // Opaque cursor for fetching the next page of results. Cursor is not - // present in the last page of results. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // A collection of CashDrawerShiftSummary objects for shifts that match - // the query. - CashDrawerShifts []*CashDrawerShiftSummary `json:"cash_drawer_shifts,omitempty" url:"cash_drawer_shifts,omitempty"` +// Indicates whether the program is currently active. +type LoyaltyProgramStatus string + +const ( + LoyaltyProgramStatusStatusDoNotUse LoyaltyProgramStatus = "STATUS_DO_NOT_USE" + LoyaltyProgramStatusInactive LoyaltyProgramStatus = "INACTIVE" + LoyaltyProgramStatusActive LoyaltyProgramStatus = "ACTIVE" +) + +func NewLoyaltyProgramStatusFromString(s string) (LoyaltyProgramStatus, error) { + switch s { + case "STATUS_DO_NOT_USE": + return LoyaltyProgramStatusStatusDoNotUse, nil + case "INACTIVE": + return LoyaltyProgramStatusInactive, nil + case "ACTIVE": + return LoyaltyProgramStatusActive, nil + } + var t LoyaltyProgramStatus + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (l LoyaltyProgramStatus) Ptr() *LoyaltyProgramStatus { + return &l +} + +// Represents the naming used for loyalty points. +type LoyaltyProgramTerminology struct { + // A singular unit for a point (for example, 1 point is called 1 star). + One string `json:"one" url:"one"` + // A plural unit for point (for example, 10 points is called 10 stars). + Other string `json:"other" url:"other"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListCashDrawerShiftsResponse) GetExtraProperties() map[string]interface{} { +func (l *LoyaltyProgramTerminology) GetExtraProperties() map[string]interface{} { return l.extraProperties } -func (l *ListCashDrawerShiftsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListCashDrawerShiftsResponse +func (l *LoyaltyProgramTerminology) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyProgramTerminology var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListCashDrawerShiftsResponse(value) + *l = LoyaltyProgramTerminology(value) extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { @@ -32651,7 +48679,7 @@ func (l *ListCashDrawerShiftsResponse) UnmarshalJSON(data []byte) error { return nil } -func (l *ListCashDrawerShiftsResponse) String() string { +func (l *LoyaltyProgramTerminology) String() string { if len(l._rawJSON) > 0 { if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value @@ -32663,47 +48691,35 @@ func (l *ListCashDrawerShiftsResponse) String() string { return fmt.Sprintf("%#v", l) } -type ListCatalogRequest struct { - // The pagination cursor returned in the previous response. Leave unset for an initial request. - // The page size is currently set to be 100. - // See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // An optional case-insensitive, comma-separated list of object types to retrieve. - // - // The valid values are defined in the [CatalogObjectType](entity:CatalogObjectType) enum, for example, - // `ITEM`, `ITEM_VARIATION`, `CATEGORY`, `DISCOUNT`, `TAX`, - // `MODIFIER`, `MODIFIER_LIST`, `IMAGE`, etc. - // - // If this is unspecified, the operation returns objects of all the top level types at the version - // of the Square API used to make the request. Object types that are nested onto other object types - // are not included in the defaults. - // - // At the current API version the default object types are: - // ITEM, CATEGORY, TAX, DISCOUNT, MODIFIER_LIST, - // PRICING_RULE, PRODUCT_SET, TIME_PERIOD, MEASUREMENT_UNIT, - // SUBSCRIPTION_PLAN, ITEM_OPTION, CUSTOM_ATTRIBUTE_DEFINITION, QUICK_AMOUNT_SETTINGS. - Types *string `json:"types,omitempty" url:"types,omitempty"` - // The specific version of the catalog objects to be included in the response. - // This allows you to retrieve historical versions of objects. The specified version value is matched against - // the [CatalogObject]($m/CatalogObject)s' `version` attribute. If not included, results will be from the - // current version of the catalog. - CatalogVersion *int64 `json:"catalog_version,omitempty" url:"catalog_version,omitempty"` +// Published when a [loyalty program](entity:LoyaltyProgram) is updated. +type LoyaltyProgramUpdatedEvent struct { + // The ID of the Square seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event. For this event, the value is `loyalty.program.updated`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The unique ID for the event, which is used for + // [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *LoyaltyProgramUpdatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListCatalogRequest) GetExtraProperties() map[string]interface{} { +func (l *LoyaltyProgramUpdatedEvent) GetExtraProperties() map[string]interface{} { return l.extraProperties } -func (l *ListCatalogRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListCatalogRequest +func (l *LoyaltyProgramUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyProgramUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListCatalogRequest(value) + *l = LoyaltyProgramUpdatedEvent(value) extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { @@ -32715,7 +48731,7 @@ func (l *ListCatalogRequest) UnmarshalJSON(data []byte) error { return nil } -func (l *ListCatalogRequest) String() string { +func (l *LoyaltyProgramUpdatedEvent) String() string { if len(l._rawJSON) > 0 { if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value @@ -32727,30 +48743,30 @@ func (l *ListCatalogRequest) String() string { return fmt.Sprintf("%#v", l) } -type ListCatalogResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The pagination cursor to be used in a subsequent request. If unset, this is the final response. - // See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // The CatalogObjects returned. - Objects []*CatalogObject `json:"objects,omitempty" url:"objects,omitempty"` +// The data associated with a `loyalty.program.updated` event. +type LoyaltyProgramUpdatedEventData struct { + // The type of object affected by the event. For this event, the value is `loyalty_program`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The ID of the affected loyalty program. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object that contains the loyalty program that was updated. + Object *LoyaltyProgramUpdatedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListCatalogResponse) GetExtraProperties() map[string]interface{} { +func (l *LoyaltyProgramUpdatedEventData) GetExtraProperties() map[string]interface{} { return l.extraProperties } -func (l *ListCatalogResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListCatalogResponse +func (l *LoyaltyProgramUpdatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyProgramUpdatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListCatalogResponse(value) + *l = LoyaltyProgramUpdatedEventData(value) extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { @@ -32762,7 +48778,7 @@ func (l *ListCatalogResponse) UnmarshalJSON(data []byte) error { return nil } -func (l *ListCatalogResponse) String() string { +func (l *LoyaltyProgramUpdatedEventData) String() string { if len(l._rawJSON) > 0 { if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value @@ -32774,32 +48790,26 @@ func (l *ListCatalogResponse) String() string { return fmt.Sprintf("%#v", l) } -// Represents a [ListCustomerCustomAttributeDefinitions]($e/CustomerCustomAttributes/ListCustomerCustomAttributeDefinitions) request. -type ListCustomerCustomAttributeDefinitionsRequest struct { - // The maximum number of results to return in a single paged response. This limit is advisory. - // The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. - // The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Limit *int `json:"limit,omitempty" url:"limit,omitempty"` - // The cursor returned in the paged response from the previous call to this endpoint. - // Provide this cursor to retrieve the next page of results for your original request. - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` +// An object that contains the loyalty program associated with a `loyalty.program.updated` event. +type LoyaltyProgramUpdatedEventObject struct { + // The loyalty program that was updated. + LoyaltyProgram *LoyaltyProgram `json:"loyalty_program,omitempty" url:"loyalty_program,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListCustomerCustomAttributeDefinitionsRequest) GetExtraProperties() map[string]interface{} { +func (l *LoyaltyProgramUpdatedEventObject) GetExtraProperties() map[string]interface{} { return l.extraProperties } -func (l *ListCustomerCustomAttributeDefinitionsRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListCustomerCustomAttributeDefinitionsRequest +func (l *LoyaltyProgramUpdatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyProgramUpdatedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListCustomerCustomAttributeDefinitionsRequest(value) + *l = LoyaltyProgramUpdatedEventObject(value) extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { @@ -32811,7 +48821,7 @@ func (l *ListCustomerCustomAttributeDefinitionsRequest) UnmarshalJSON(data []byt return nil } -func (l *ListCustomerCustomAttributeDefinitionsRequest) String() string { +func (l *LoyaltyProgramUpdatedEventObject) String() string { if len(l._rawJSON) > 0 { if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value @@ -32823,35 +48833,68 @@ func (l *ListCustomerCustomAttributeDefinitionsRequest) String() string { return fmt.Sprintf("%#v", l) } -// Represents a [ListCustomerCustomAttributeDefinitions]($e/CustomerCustomAttributes/ListCustomerCustomAttributeDefinitions) response. -// Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response. -// If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`. -type ListCustomerCustomAttributeDefinitionsResponse struct { - // The retrieved custom attribute definitions. If no custom attribute definitions are found, - // Square returns an empty object (`{}`). - CustomAttributeDefinitions []*CustomAttributeDefinition `json:"custom_attribute_definitions,omitempty" url:"custom_attribute_definitions,omitempty"` - // The cursor to provide in your next call to this endpoint to retrieve the next page of - // results for your original request. This field is present only if the request succeeded and - // additional results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Represents a promotion for a [loyalty program](entity:LoyaltyProgram). Loyalty promotions enable buyers +// to earn extra points on top of those earned from the base program. +// +// A loyalty program can have a maximum of 10 loyalty promotions with an `ACTIVE` or `SCHEDULED` status. +type LoyaltyPromotion struct { + // The Square-assigned ID of the promotion. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The name of the promotion. + Name string `json:"name" url:"name"` + // The points incentive for the promotion. This field defines whether promotion points + // are earned by multiplying base program points or by adding a specified number of points. + Incentive *LoyaltyPromotionIncentive `json:"incentive,omitempty" url:"incentive,omitempty"` + // The scheduling information that defines when purchases can qualify to earn points from an `ACTIVE` promotion. + AvailableTime *LoyaltyPromotionAvailableTimeData `json:"available_time,omitempty" url:"available_time,omitempty"` + // The number of times a buyer can earn promotion points during a specified interval. + // If not specified, buyers can trigger the promotion an unlimited number of times. + TriggerLimit *LoyaltyPromotionTriggerLimit `json:"trigger_limit,omitempty" url:"trigger_limit,omitempty"` + // The current status of the promotion. + // See [LoyaltyPromotionStatus](#type-loyaltypromotionstatus) for possible values + Status *LoyaltyPromotionStatus `json:"status,omitempty" url:"status,omitempty"` + // The timestamp of when the promotion was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The timestamp of when the promotion was canceled, in RFC 3339 format. + CanceledAt *string `json:"canceled_at,omitempty" url:"canceled_at,omitempty"` + // The timestamp when the promotion was last updated, in RFC 3339 format. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // The ID of the [loyalty program](entity:LoyaltyProgram) associated with the promotion. + LoyaltyProgramID *string `json:"loyalty_program_id,omitempty" url:"loyalty_program_id,omitempty"` + // The minimum purchase amount required to earn promotion points. If specified, this amount is positive. + MinimumSpendAmountMoney *Money `json:"minimum_spend_amount_money,omitempty" url:"minimum_spend_amount_money,omitempty"` + // The IDs of any qualifying `ITEM_VARIATION` [catalog objects](entity:CatalogObject). If specified, + // the purchase must include at least one of these items to qualify for the promotion. + // + // This option is valid only if the base loyalty program uses a `VISIT` or `SPEND` accrual rule. + // With `SPEND` accrual rules, make sure that qualifying promotional items are not excluded. + // + // You can specify `qualifying_item_variation_ids` or `qualifying_category_ids` for a given promotion, but not both. + QualifyingItemVariationIDs []string `json:"qualifying_item_variation_ids,omitempty" url:"qualifying_item_variation_ids,omitempty"` + // The IDs of any qualifying `CATEGORY` [catalog objects](entity:CatalogObject). If specified, + // the purchase must include at least one item from one of these categories to qualify for the promotion. + // + // This option is valid only if the base loyalty program uses a `VISIT` or `SPEND` accrual rule. + // With `SPEND` accrual rules, make sure that qualifying promotional items are not excluded. + // + // You can specify `qualifying_category_ids` or `qualifying_item_variation_ids` for a promotion, but not both. + QualifyingCategoryIDs []string `json:"qualifying_category_ids,omitempty" url:"qualifying_category_ids,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListCustomerCustomAttributeDefinitionsResponse) GetExtraProperties() map[string]interface{} { +func (l *LoyaltyPromotion) GetExtraProperties() map[string]interface{} { return l.extraProperties } -func (l *ListCustomerCustomAttributeDefinitionsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListCustomerCustomAttributeDefinitionsResponse +func (l *LoyaltyPromotion) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyPromotion var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListCustomerCustomAttributeDefinitionsResponse(value) + *l = LoyaltyPromotion(value) extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { @@ -32863,7 +48906,7 @@ func (l *ListCustomerCustomAttributeDefinitionsResponse) UnmarshalJSON(data []by return nil } -func (l *ListCustomerCustomAttributeDefinitionsResponse) String() string { +func (l *LoyaltyPromotion) String() string { if len(l._rawJSON) > 0 { if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value @@ -32875,36 +48918,44 @@ func (l *ListCustomerCustomAttributeDefinitionsResponse) String() string { return fmt.Sprintf("%#v", l) } -// Represents a [ListCustomerCustomAttributes]($e/CustomerCustomAttributes/ListCustomerCustomAttributes) request. -type ListCustomerCustomAttributesRequest struct { - // The maximum number of results to return in a single paged response. This limit is advisory. - // The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. - // The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Limit *int `json:"limit,omitempty" url:"limit,omitempty"` - // The cursor returned in the paged response from the previous call to this endpoint. - // Provide this cursor to retrieve the next page of results for your original request. For more - // information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each - // custom attribute. Set this parameter to `true` to get the name and description of each custom - // attribute, information about the data type, or other definition details. The default value is `false`. - WithDefinitions *bool `json:"with_definitions,omitempty" url:"with_definitions,omitempty"` +// Represents scheduling information that determines when purchases can qualify to earn points +// from a [loyalty promotion](entity:LoyaltyPromotion). +type LoyaltyPromotionAvailableTimeData struct { + // The date that the promotion starts, in `YYYY-MM-DD` format. Square populates this field + // based on the provided `time_periods`. + StartDate *string `json:"start_date,omitempty" url:"start_date,omitempty"` + // The date that the promotion ends, in `YYYY-MM-DD` format. Square populates this field + // based on the provided `time_periods`. If an end date is not specified, an `ACTIVE` promotion + // remains available until it is canceled. + EndDate *string `json:"end_date,omitempty" url:"end_date,omitempty"` + // A list of [iCalendar (RFC 5545) events](https://tools.ietf.org/html/rfc5545#section-3.6.1) + // (`VEVENT`). Each event represents an available time period per day or days of the week. + // A day can have a maximum of one available time period. + // + // Only `DTSTART`, `DURATION`, and `RRULE` are supported. `DTSTART` and `DURATION` are required and + // timestamps must be in local (unzoned) time format. Include `RRULE` to specify recurring promotions, + // an end date (using the `UNTIL` keyword), or both. For more information, see + // [Available time](https://developer.squareup.com/docs/loyalty-api/loyalty-promotions#available-time). + // + // Note that `BEGIN:VEVENT` and `END:VEVENT` are optional in a `CreateLoyaltyPromotion` request + // but are always included in the response. + TimePeriods []string `json:"time_periods,omitempty" url:"time_periods,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListCustomerCustomAttributesRequest) GetExtraProperties() map[string]interface{} { +func (l *LoyaltyPromotionAvailableTimeData) GetExtraProperties() map[string]interface{} { return l.extraProperties } -func (l *ListCustomerCustomAttributesRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListCustomerCustomAttributesRequest +func (l *LoyaltyPromotionAvailableTimeData) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyPromotionAvailableTimeData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListCustomerCustomAttributesRequest(value) + *l = LoyaltyPromotionAvailableTimeData(value) extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { @@ -32916,7 +48967,7 @@ func (l *ListCustomerCustomAttributesRequest) UnmarshalJSON(data []byte) error { return nil } -func (l *ListCustomerCustomAttributesRequest) String() string { +func (l *LoyaltyPromotionAvailableTimeData) String() string { if len(l._rawJSON) > 0 { if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value @@ -32928,37 +48979,35 @@ func (l *ListCustomerCustomAttributesRequest) String() string { return fmt.Sprintf("%#v", l) } -// Represents a [ListCustomerCustomAttributes]($e/CustomerCustomAttributes/ListCustomerCustomAttributes) response. -// Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional -// results are available, the `cursor` field is also present along with `custom_attributes`. -type ListCustomerCustomAttributesResponse struct { - // The retrieved custom attributes. If `with_definitions` was set to `true` in the request, - // the custom attribute definition is returned in the `definition` field of each custom attribute. - // - // If no custom attributes are found, Square returns an empty object (`{}`). - CustomAttributes []*CustomAttribute `json:"custom_attributes,omitempty" url:"custom_attributes,omitempty"` - // The cursor to use in your next call to this endpoint to retrieve the next page of results - // for your original request. This field is present only if the request succeeded and additional - // results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Published when a [loyalty promotion](entity:LoyaltyPromotion) is created. +type LoyaltyPromotionCreatedEvent struct { + // The ID of the Square seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event. For this event, the value is `loyalty.promotion.created`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The unique ID for the event, which is used for + // [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *LoyaltyPromotionCreatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListCustomerCustomAttributesResponse) GetExtraProperties() map[string]interface{} { +func (l *LoyaltyPromotionCreatedEvent) GetExtraProperties() map[string]interface{} { return l.extraProperties } -func (l *ListCustomerCustomAttributesResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListCustomerCustomAttributesResponse +func (l *LoyaltyPromotionCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyPromotionCreatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListCustomerCustomAttributesResponse(value) + *l = LoyaltyPromotionCreatedEvent(value) extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { @@ -32970,7 +49019,7 @@ func (l *ListCustomerCustomAttributesResponse) UnmarshalJSON(data []byte) error return nil } -func (l *ListCustomerCustomAttributesResponse) String() string { +func (l *LoyaltyPromotionCreatedEvent) String() string { if len(l._rawJSON) > 0 { if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value @@ -32982,35 +49031,30 @@ func (l *ListCustomerCustomAttributesResponse) String() string { return fmt.Sprintf("%#v", l) } -// Defines the query parameters that can be included in a request to the -// [ListCustomerGroups]($e/CustomerGroups/ListCustomerGroups) endpoint. -type ListCustomerGroupsRequest struct { - // A pagination cursor returned by a previous call to this endpoint. - // Provide this cursor to retrieve the next set of results for your original query. - // - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results. - // If the limit is less than 1 or greater than 50, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 50. - // - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Limit *int `json:"limit,omitempty" url:"limit,omitempty"` +// The data associated with a `loyalty.promotion.created` event. +type LoyaltyPromotionCreatedEventData struct { + // The type of object affected by the event. For this event, the value is `loyalty_promotion`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The ID of the affected loyalty promotion. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object that contains the loyalty promotion that was created. + Object *LoyaltyPromotionCreatedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListCustomerGroupsRequest) GetExtraProperties() map[string]interface{} { +func (l *LoyaltyPromotionCreatedEventData) GetExtraProperties() map[string]interface{} { return l.extraProperties } -func (l *ListCustomerGroupsRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListCustomerGroupsRequest +func (l *LoyaltyPromotionCreatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyPromotionCreatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListCustomerGroupsRequest(value) + *l = LoyaltyPromotionCreatedEventData(value) extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { @@ -33022,7 +49066,7 @@ func (l *ListCustomerGroupsRequest) UnmarshalJSON(data []byte) error { return nil } -func (l *ListCustomerGroupsRequest) String() string { +func (l *LoyaltyPromotionCreatedEventData) String() string { if len(l._rawJSON) > 0 { if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value @@ -33034,37 +49078,26 @@ func (l *ListCustomerGroupsRequest) String() string { return fmt.Sprintf("%#v", l) } -// Defines the fields that are included in the response body of -// a request to the [ListCustomerGroups]($e/CustomerGroups/ListCustomerGroups) endpoint. -// -// Either `errors` or `groups` is present in a given response (never both). -type ListCustomerGroupsResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // A list of customer groups belonging to the current seller. - Groups []*CustomerGroup `json:"groups,omitempty" url:"groups,omitempty"` - // A pagination cursor to retrieve the next set of results for your - // original query to the endpoint. This value is present only if the request - // succeeded and additional results are available. - // - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` +// An object that contains the loyalty promotion associated with a `loyalty.promotion.created` event. +type LoyaltyPromotionCreatedEventObject struct { + // The loyalty promotion that was created. + LoyaltyPromotion *LoyaltyPromotion `json:"loyalty_promotion,omitempty" url:"loyalty_promotion,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListCustomerGroupsResponse) GetExtraProperties() map[string]interface{} { +func (l *LoyaltyPromotionCreatedEventObject) GetExtraProperties() map[string]interface{} { return l.extraProperties } -func (l *ListCustomerGroupsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListCustomerGroupsResponse +func (l *LoyaltyPromotionCreatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyPromotionCreatedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListCustomerGroupsResponse(value) + *l = LoyaltyPromotionCreatedEventObject(value) extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { @@ -33076,7 +49109,7 @@ func (l *ListCustomerGroupsResponse) UnmarshalJSON(data []byte) error { return nil } -func (l *ListCustomerGroupsResponse) String() string { +func (l *LoyaltyPromotionCreatedEventObject) String() string { if len(l._rawJSON) > 0 { if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value @@ -33088,34 +49121,33 @@ func (l *ListCustomerGroupsResponse) String() string { return fmt.Sprintf("%#v", l) } -// Defines the valid parameters for requests to the `ListCustomerSegments` endpoint. -type ListCustomerSegmentsRequest struct { - // A pagination cursor returned by previous calls to `ListCustomerSegments`. - // This cursor is used to retrieve the next set of query results. - // - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results. - // If the specified limit is less than 1 or greater than 50, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 50. - // - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Limit *int `json:"limit,omitempty" url:"limit,omitempty"` +// Represents how points for a [loyalty promotion](entity:LoyaltyPromotion) are calculated, +// either by multiplying the points earned from the base program or by adding a specified number +// of points to the points earned from the base program. +type LoyaltyPromotionIncentive struct { + // The type of points incentive. + // See [LoyaltyPromotionIncentiveType](#type-loyaltypromotionincentivetype) for possible values + Type LoyaltyPromotionIncentiveType `json:"type" url:"type"` + // Additional data for a `POINTS_MULTIPLIER` incentive type. + PointsMultiplierData *LoyaltyPromotionIncentivePointsMultiplierData `json:"points_multiplier_data,omitempty" url:"points_multiplier_data,omitempty"` + // Additional data for a `POINTS_ADDITION` incentive type. + PointsAdditionData *LoyaltyPromotionIncentivePointsAdditionData `json:"points_addition_data,omitempty" url:"points_addition_data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListCustomerSegmentsRequest) GetExtraProperties() map[string]interface{} { +func (l *LoyaltyPromotionIncentive) GetExtraProperties() map[string]interface{} { return l.extraProperties } -func (l *ListCustomerSegmentsRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListCustomerSegmentsRequest +func (l *LoyaltyPromotionIncentive) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyPromotionIncentive var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListCustomerSegmentsRequest(value) + *l = LoyaltyPromotionIncentive(value) extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { @@ -33127,7 +49159,7 @@ func (l *ListCustomerSegmentsRequest) UnmarshalJSON(data []byte) error { return nil } -func (l *ListCustomerSegmentsRequest) String() string { +func (l *LoyaltyPromotionIncentive) String() string { if len(l._rawJSON) > 0 { if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value @@ -33139,36 +49171,29 @@ func (l *ListCustomerSegmentsRequest) String() string { return fmt.Sprintf("%#v", l) } -// Defines the fields that are included in the response body for requests to the `ListCustomerSegments` endpoint. -// -// Either `errors` or `segments` is present in a given response (never both). -type ListCustomerSegmentsResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The list of customer segments belonging to the associated Square account. - Segments []*CustomerSegment `json:"segments,omitempty" url:"segments,omitempty"` - // A pagination cursor to be used in subsequent calls to `ListCustomerSegments` - // to retrieve the next set of query results. The cursor is only present if the request succeeded and - // additional results are available. - // - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` +// Represents the metadata for a `POINTS_ADDITION` type of [loyalty promotion incentive](entity:LoyaltyPromotionIncentive). +type LoyaltyPromotionIncentivePointsAdditionData struct { + // The number of additional points to earn each time the promotion is triggered. For example, + // suppose a purchase qualifies for 5 points from the base loyalty program. If the purchase also + // qualifies for a `POINTS_ADDITION` promotion incentive with a `points_addition` of 3, the buyer + // earns a total of 8 points (5 program points + 3 promotion points = 8 points). + PointsAddition int `json:"points_addition" url:"points_addition"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListCustomerSegmentsResponse) GetExtraProperties() map[string]interface{} { +func (l *LoyaltyPromotionIncentivePointsAdditionData) GetExtraProperties() map[string]interface{} { return l.extraProperties } -func (l *ListCustomerSegmentsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListCustomerSegmentsResponse +func (l *LoyaltyPromotionIncentivePointsAdditionData) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyPromotionIncentivePointsAdditionData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListCustomerSegmentsResponse(value) + *l = LoyaltyPromotionIncentivePointsAdditionData(value) extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { @@ -33180,7 +49205,7 @@ func (l *ListCustomerSegmentsResponse) UnmarshalJSON(data []byte) error { return nil } -func (l *ListCustomerSegmentsResponse) String() string { +func (l *LoyaltyPromotionIncentivePointsAdditionData) String() string { if len(l._rawJSON) > 0 { if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value @@ -33192,50 +49217,50 @@ func (l *ListCustomerSegmentsResponse) String() string { return fmt.Sprintf("%#v", l) } -// Defines the query parameters that can be included in a request to the -// `ListCustomers` endpoint. -type ListCustomersRequest struct { - // A pagination cursor returned by a previous call to this endpoint. - // Provide this cursor to retrieve the next set of results for your original query. +// Represents the metadata for a `POINTS_MULTIPLIER` type of [loyalty promotion incentive](entity:LoyaltyPromotionIncentive). +type LoyaltyPromotionIncentivePointsMultiplierData struct { + // The multiplier used to calculate the number of points earned each time the promotion + // is triggered. For example, suppose a purchase qualifies for 5 points from the base loyalty program. + // If the purchase also qualifies for a `POINTS_MULTIPLIER` promotion incentive with a `points_multiplier` + // of 3, the buyer earns a total of 15 points (5 program points x 3 promotion multiplier = 15 points). // - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results. - // If the specified limit is less than 1 or greater than 100, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 100. + // DEPRECATED at version 2023-08-16. Replaced by the `multiplier` field. // - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Limit *int `json:"limit,omitempty" url:"limit,omitempty"` - // Indicates how customers should be sorted. + // One of the following is required when specifying a points multiplier: // - // The default value is `DEFAULT`. - // See [CustomerSortField](#type-customersortfield) for possible values - SortField *CustomerSortField `json:"sort_field,omitempty" url:"sort_field,omitempty"` - // Indicates whether customers should be sorted in ascending (`ASC`) or - // descending (`DESC`) order. + // - (Recommended) The `multiplier` field. + // - This deprecated `points_multiplier` field. If provided in the request, Square also returns `multiplier` + // with the equivalent value. + PointsMultiplier *int `json:"points_multiplier,omitempty" url:"points_multiplier,omitempty"` + // The multiplier used to calculate the number of points earned each time the promotion is triggered, + // specified as a string representation of a decimal. Square supports multipliers up to 10x, with three + // point precision for decimal multipliers. For example, suppose a purchase qualifies for 4 points from the + // base loyalty program. If the purchase also qualifies for a `POINTS_MULTIPLIER` promotion incentive with a + // `multiplier` of "1.5", the buyer earns a total of 6 points (4 program points x 1.5 promotion multiplier = 6 points). + // Fractional points are dropped. // - // The default value is `ASC`. - // See [SortOrder](#type-sortorder) for possible values - SortOrder *SortOrder `json:"sort_order,omitempty" url:"sort_order,omitempty"` - // Indicates whether to return the total count of customers in the `count` field of the response. + // One of the following is required when specifying a points multiplier: // - // The default value is `false`. - Count *bool `json:"count,omitempty" url:"count,omitempty"` + // - (Recommended) This `multiplier` field. + // - The deprecated `points_multiplier` field. If provided in the request, Square also returns `multiplier` + // with the equivalent value. + Multiplier *string `json:"multiplier,omitempty" url:"multiplier,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListCustomersRequest) GetExtraProperties() map[string]interface{} { +func (l *LoyaltyPromotionIncentivePointsMultiplierData) GetExtraProperties() map[string]interface{} { return l.extraProperties } -func (l *ListCustomersRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListCustomersRequest +func (l *LoyaltyPromotionIncentivePointsMultiplierData) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyPromotionIncentivePointsMultiplierData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListCustomersRequest(value) + *l = LoyaltyPromotionIncentivePointsMultiplierData(value) extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { @@ -33247,7 +49272,7 @@ func (l *ListCustomersRequest) UnmarshalJSON(data []byte) error { return nil } -func (l *ListCustomersRequest) String() string { +func (l *LoyaltyPromotionIncentivePointsMultiplierData) String() string { if len(l._rawJSON) > 0 { if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value @@ -33259,43 +49284,95 @@ func (l *ListCustomersRequest) String() string { return fmt.Sprintf("%#v", l) } -// Defines the fields that are included in the response body of -// a request to the `ListCustomers` endpoint. +// Indicates the type of points incentive for a [loyalty promotion](entity:LoyaltyPromotion), +// which is used to determine how buyers can earn points from the promotion. +type LoyaltyPromotionIncentiveType string + +const ( + LoyaltyPromotionIncentiveTypeTypeDoNotUse LoyaltyPromotionIncentiveType = "TYPE_DO_NOT_USE" + LoyaltyPromotionIncentiveTypePointsMultiplier LoyaltyPromotionIncentiveType = "POINTS_MULTIPLIER" + LoyaltyPromotionIncentiveTypePointsAddition LoyaltyPromotionIncentiveType = "POINTS_ADDITION" +) + +func NewLoyaltyPromotionIncentiveTypeFromString(s string) (LoyaltyPromotionIncentiveType, error) { + switch s { + case "TYPE_DO_NOT_USE": + return LoyaltyPromotionIncentiveTypeTypeDoNotUse, nil + case "POINTS_MULTIPLIER": + return LoyaltyPromotionIncentiveTypePointsMultiplier, nil + case "POINTS_ADDITION": + return LoyaltyPromotionIncentiveTypePointsAddition, nil + } + var t LoyaltyPromotionIncentiveType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (l LoyaltyPromotionIncentiveType) Ptr() *LoyaltyPromotionIncentiveType { + return &l +} + +// Indicates the status of a [loyalty promotion](entity:LoyaltyPromotion). +type LoyaltyPromotionStatus string + +const ( + LoyaltyPromotionStatusTypeDoNotUse LoyaltyPromotionStatus = "TYPE_DO_NOT_USE" + LoyaltyPromotionStatusUpcoming LoyaltyPromotionStatus = "UPCOMING" + LoyaltyPromotionStatusActive LoyaltyPromotionStatus = "ACTIVE" + LoyaltyPromotionStatusEnded LoyaltyPromotionStatus = "ENDED" + LoyaltyPromotionStatusCanceled LoyaltyPromotionStatus = "CANCELED" + LoyaltyPromotionStatusScheduled LoyaltyPromotionStatus = "SCHEDULED" +) + +func NewLoyaltyPromotionStatusFromString(s string) (LoyaltyPromotionStatus, error) { + switch s { + case "TYPE_DO_NOT_USE": + return LoyaltyPromotionStatusTypeDoNotUse, nil + case "UPCOMING": + return LoyaltyPromotionStatusUpcoming, nil + case "ACTIVE": + return LoyaltyPromotionStatusActive, nil + case "ENDED": + return LoyaltyPromotionStatusEnded, nil + case "CANCELED": + return LoyaltyPromotionStatusCanceled, nil + case "SCHEDULED": + return LoyaltyPromotionStatusScheduled, nil + } + var t LoyaltyPromotionStatus + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (l LoyaltyPromotionStatus) Ptr() *LoyaltyPromotionStatus { + return &l +} + +// Represents the number of times a buyer can earn points during a [loyalty promotion](entity:LoyaltyPromotion). +// If this field is not set, buyers can trigger the promotion an unlimited number of times to earn points during +// the time that the promotion is available. // -// Either `errors` or `customers` is present in a given response (never both). -type ListCustomersResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The customer profiles associated with the Square account or an empty object (`{}`) if none are found. - // Only customer profiles with public information (`given_name`, `family_name`, `company_name`, `email_address`, or - // `phone_number`) are included in the response. - Customers []*Customer `json:"customers,omitempty" url:"customers,omitempty"` - // A pagination cursor to retrieve the next set of results for the - // original query. A cursor is only present if the request succeeded and additional results - // are available. - // - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // The total count of customers associated with the Square account. Only customer profiles with public information - // (`given_name`, `family_name`, `company_name`, `email_address`, or `phone_number`) are counted. This field is present - // only if `count` is set to `true` in the request. - Count *int64 `json:"count,omitempty" url:"count,omitempty"` +// A purchase that is disqualified from earning points because of this limit might qualify for another active promotion. +type LoyaltyPromotionTriggerLimit struct { + // The maximum number of times a buyer can trigger the promotion during the specified `interval`. + Times int `json:"times" url:"times"` + // The time period the limit applies to. + // See [LoyaltyPromotionTriggerLimitInterval](#type-loyaltypromotiontriggerlimitinterval) for possible values + Interval *LoyaltyPromotionTriggerLimitInterval `json:"interval,omitempty" url:"interval,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListCustomersResponse) GetExtraProperties() map[string]interface{} { +func (l *LoyaltyPromotionTriggerLimit) GetExtraProperties() map[string]interface{} { return l.extraProperties } -func (l *ListCustomersResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListCustomersResponse +func (l *LoyaltyPromotionTriggerLimit) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyPromotionTriggerLimit var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListCustomersResponse(value) + *l = LoyaltyPromotionTriggerLimit(value) extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { @@ -33307,7 +49384,7 @@ func (l *ListCustomersResponse) UnmarshalJSON(data []byte) error { return nil } -func (l *ListCustomersResponse) String() string { +func (l *LoyaltyPromotionTriggerLimit) String() string { if len(l._rawJSON) > 0 { if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value @@ -33319,38 +49396,63 @@ func (l *ListCustomersResponse) String() string { return fmt.Sprintf("%#v", l) } -type ListDeviceCodesRequest struct { - // A pagination cursor returned by a previous call to this endpoint. - // Provide this to retrieve the next set of results for your original query. - // - // See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // If specified, only returns DeviceCodes of the specified location. - // Returns DeviceCodes of all locations if empty. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` - // If specified, only returns DeviceCodes targeting the specified product type. - // Returns DeviceCodes of all product types if empty. - ProductType *ProductType `json:"product_type,omitempty" url:"product_type,omitempty"` - // If specified, returns DeviceCodes with the specified statuses. - // Returns DeviceCodes of status `PAIRED` and `UNPAIRED` if empty. - // See [DeviceCodeStatus](#type-devicecodestatus) for possible values - Status []DeviceCodeStatus `json:"status,omitempty" url:"status,omitempty"` +// Indicates the time period that the [trigger limit](entity:LoyaltyPromotionTriggerLimit) applies to, +// which is used to determine the number of times a buyer can earn points for a [loyalty promotion](entity:LoyaltyPromotion). +type LoyaltyPromotionTriggerLimitInterval string + +const ( + LoyaltyPromotionTriggerLimitIntervalTypeDoNotUse LoyaltyPromotionTriggerLimitInterval = "TYPE_DO_NOT_USE" + LoyaltyPromotionTriggerLimitIntervalAllTime LoyaltyPromotionTriggerLimitInterval = "ALL_TIME" + LoyaltyPromotionTriggerLimitIntervalDay LoyaltyPromotionTriggerLimitInterval = "DAY" +) + +func NewLoyaltyPromotionTriggerLimitIntervalFromString(s string) (LoyaltyPromotionTriggerLimitInterval, error) { + switch s { + case "TYPE_DO_NOT_USE": + return LoyaltyPromotionTriggerLimitIntervalTypeDoNotUse, nil + case "ALL_TIME": + return LoyaltyPromotionTriggerLimitIntervalAllTime, nil + case "DAY": + return LoyaltyPromotionTriggerLimitIntervalDay, nil + } + var t LoyaltyPromotionTriggerLimitInterval + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (l LoyaltyPromotionTriggerLimitInterval) Ptr() *LoyaltyPromotionTriggerLimitInterval { + return &l +} + +// Published when a [loyalty promotion](entity:LoyaltyPromotion) is updated. This event is +// invoked only when a loyalty promotion is canceled. +type LoyaltyPromotionUpdatedEvent struct { + // The ID of the Square seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event. For this event, the value is `loyalty.promotion.updated`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The unique ID for the event, which is used for + // [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *LoyaltyPromotionUpdatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListDeviceCodesRequest) GetExtraProperties() map[string]interface{} { +func (l *LoyaltyPromotionUpdatedEvent) GetExtraProperties() map[string]interface{} { return l.extraProperties } -func (l *ListDeviceCodesRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListDeviceCodesRequest +func (l *LoyaltyPromotionUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyPromotionUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListDeviceCodesRequest(value) + *l = LoyaltyPromotionUpdatedEvent(value) extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { @@ -33362,7 +49464,7 @@ func (l *ListDeviceCodesRequest) UnmarshalJSON(data []byte) error { return nil } -func (l *ListDeviceCodesRequest) String() string { +func (l *LoyaltyPromotionUpdatedEvent) String() string { if len(l._rawJSON) > 0 { if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value @@ -33374,33 +49476,30 @@ func (l *ListDeviceCodesRequest) String() string { return fmt.Sprintf("%#v", l) } -type ListDeviceCodesResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The queried DeviceCode. - DeviceCodes []*DeviceCode `json:"device_codes,omitempty" url:"device_codes,omitempty"` - // A pagination cursor to retrieve the next set of results for your - // original query to the endpoint. This value is present only if the request - // succeeded and additional results are available. - // - // See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` +// The data associated with a `loyalty.promotion.updated` event. +type LoyaltyPromotionUpdatedEventData struct { + // The type of object affected by the event. For this event, the value is `loyalty_promotion`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The ID of the affected loyalty promotion. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object that contains the loyalty promotion that was updated. + Object *LoyaltyPromotionUpdatedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListDeviceCodesResponse) GetExtraProperties() map[string]interface{} { +func (l *LoyaltyPromotionUpdatedEventData) GetExtraProperties() map[string]interface{} { return l.extraProperties } -func (l *ListDeviceCodesResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListDeviceCodesResponse +func (l *LoyaltyPromotionUpdatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyPromotionUpdatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListDeviceCodesResponse(value) + *l = LoyaltyPromotionUpdatedEventData(value) extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { @@ -33412,7 +49511,7 @@ func (l *ListDeviceCodesResponse) UnmarshalJSON(data []byte) error { return nil } -func (l *ListDeviceCodesResponse) String() string { +func (l *LoyaltyPromotionUpdatedEventData) String() string { if len(l._rawJSON) > 0 { if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value @@ -33424,37 +49523,26 @@ func (l *ListDeviceCodesResponse) String() string { return fmt.Sprintf("%#v", l) } -type ListDevicesRequest struct { - // A pagination cursor returned by a previous call to this endpoint. - // Provide this cursor to retrieve the next set of results for the original query. - // See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // The order in which results are listed. - // - // - `ASC` - Oldest to newest. - // - `DESC` - Newest to oldest (default). - // See [SortOrder](#type-sortorder) for possible values - SortOrder *SortOrder `json:"sort_order,omitempty" url:"sort_order,omitempty"` - // The number of results to return in a single page. - Limit *int `json:"limit,omitempty" url:"limit,omitempty"` - // If present, only returns devices at the target location. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` +// An object that contains the loyalty promotion associated with a `loyalty.promotion.updated` event. +type LoyaltyPromotionUpdatedEventObject struct { + // The loyalty promotion that was updated. + LoyaltyPromotion *LoyaltyPromotion `json:"loyalty_promotion,omitempty" url:"loyalty_promotion,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListDevicesRequest) GetExtraProperties() map[string]interface{} { +func (l *LoyaltyPromotionUpdatedEventObject) GetExtraProperties() map[string]interface{} { return l.extraProperties } -func (l *ListDevicesRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListDevicesRequest +func (l *LoyaltyPromotionUpdatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyPromotionUpdatedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListDevicesRequest(value) + *l = LoyaltyPromotionUpdatedEventObject(value) extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { @@ -33466,7 +49554,7 @@ func (l *ListDevicesRequest) UnmarshalJSON(data []byte) error { return nil } -func (l *ListDevicesRequest) String() string { +func (l *LoyaltyPromotionUpdatedEventObject) String() string { if len(l._rawJSON) > 0 { if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value @@ -33478,31 +49566,44 @@ func (l *ListDevicesRequest) String() string { return fmt.Sprintf("%#v", l) } -type ListDevicesResponse struct { - // Information about errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The requested list of `Device` objects. - Devices []*Device `json:"devices,omitempty" url:"devices,omitempty"` - // The pagination cursor to be used in a subsequent request. If empty, - // this is the final response. - // See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` +// Represents a contract to redeem loyalty points for a [reward tier](entity:LoyaltyProgramRewardTier) discount. Loyalty rewards can be in an ISSUED, REDEEMED, or DELETED state. +// For more information, see [Manage loyalty rewards](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards). +type LoyaltyReward struct { + // The Square-assigned ID of the loyalty reward. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The status of a loyalty reward. + // See [LoyaltyRewardStatus](#type-loyaltyrewardstatus) for possible values + Status *LoyaltyRewardStatus `json:"status,omitempty" url:"status,omitempty"` + // The Square-assigned ID of the [loyalty account](entity:LoyaltyAccount) to which the reward belongs. + LoyaltyAccountID string `json:"loyalty_account_id" url:"loyalty_account_id"` + // The Square-assigned ID of the [reward tier](entity:LoyaltyProgramRewardTier) used to create the reward. + RewardTierID string `json:"reward_tier_id" url:"reward_tier_id"` + // The number of loyalty points used for the reward. + Points *int `json:"points,omitempty" url:"points,omitempty"` + // The Square-assigned ID of the [order](entity:Order) to which the reward is attached. + OrderID *string `json:"order_id,omitempty" url:"order_id,omitempty"` + // The timestamp when the reward was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The timestamp when the reward was last updated, in RFC 3339 format. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // The timestamp when the reward was redeemed, in RFC 3339 format. + RedeemedAt *string `json:"redeemed_at,omitempty" url:"redeemed_at,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListDevicesResponse) GetExtraProperties() map[string]interface{} { +func (l *LoyaltyReward) GetExtraProperties() map[string]interface{} { return l.extraProperties } -func (l *ListDevicesResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListDevicesResponse +func (l *LoyaltyReward) UnmarshalJSON(data []byte) error { + type unmarshaler LoyaltyReward var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListDevicesResponse(value) + *l = LoyaltyReward(value) extraProperties, err := core.ExtractExtraProperties(data, *l) if err != nil { @@ -33514,7 +49615,7 @@ func (l *ListDevicesResponse) UnmarshalJSON(data []byte) error { return nil } -func (l *ListDevicesResponse) String() string { +func (l *LoyaltyReward) String() string { if len(l._rawJSON) > 0 { if value, err := core.StringifyJSON(l._rawJSON); err == nil { return value @@ -33526,13400 +49627,14028 @@ func (l *ListDevicesResponse) String() string { return fmt.Sprintf("%#v", l) } -// Defines the parameters for a `ListDisputeEvidence` request. -type ListDisputeEvidenceRequest struct { - // A pagination cursor returned by a previous call to this endpoint. - // Provide this cursor to retrieve the next set of results for the original query. - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` +// The status of the loyalty reward. +type LoyaltyRewardStatus string + +const ( + LoyaltyRewardStatusStatusDoNotUse LoyaltyRewardStatus = "STATUS_DO_NOT_USE" + LoyaltyRewardStatusIssued LoyaltyRewardStatus = "ISSUED" + LoyaltyRewardStatusRedeemed LoyaltyRewardStatus = "REDEEMED" + LoyaltyRewardStatusDeleted LoyaltyRewardStatus = "DELETED" +) + +func NewLoyaltyRewardStatusFromString(s string) (LoyaltyRewardStatus, error) { + switch s { + case "STATUS_DO_NOT_USE": + return LoyaltyRewardStatusStatusDoNotUse, nil + case "ISSUED": + return LoyaltyRewardStatusIssued, nil + case "REDEEMED": + return LoyaltyRewardStatusRedeemed, nil + case "DELETED": + return LoyaltyRewardStatusDeleted, nil + } + var t LoyaltyRewardStatus + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (l LoyaltyRewardStatus) Ptr() *LoyaltyRewardStatus { + return &l +} + +// Represents a unit of measurement to use with a quantity, such as ounces +// or inches. Exactly one of the following fields are required: `custom_unit`, +// `area_unit`, `length_unit`, `volume_unit`, and `weight_unit`. +type MeasurementUnit struct { + // A custom unit of measurement defined by the seller using the Point of Sale + // app or ad-hoc as an order line item. + CustomUnit *MeasurementUnitCustom `json:"custom_unit,omitempty" url:"custom_unit,omitempty"` + // Represents a standard area unit. + // See [MeasurementUnitArea](#type-measurementunitarea) for possible values + AreaUnit *MeasurementUnitArea `json:"area_unit,omitempty" url:"area_unit,omitempty"` + // Represents a standard length unit. + // See [MeasurementUnitLength](#type-measurementunitlength) for possible values + LengthUnit *MeasurementUnitLength `json:"length_unit,omitempty" url:"length_unit,omitempty"` + // Represents a standard volume unit. + // See [MeasurementUnitVolume](#type-measurementunitvolume) for possible values + VolumeUnit *MeasurementUnitVolume `json:"volume_unit,omitempty" url:"volume_unit,omitempty"` + // Represents a standard unit of weight or mass. + // See [MeasurementUnitWeight](#type-measurementunitweight) for possible values + WeightUnit *MeasurementUnitWeight `json:"weight_unit,omitempty" url:"weight_unit,omitempty"` + // Reserved for API integrations that lack the ability to specify a real measurement unit + // See [MeasurementUnitGeneric](#type-measurementunitgeneric) for possible values + GenericUnit *MeasurementUnitGeneric `json:"generic_unit,omitempty" url:"generic_unit,omitempty"` + // Represents a standard unit of time. + // See [MeasurementUnitTime](#type-measurementunittime) for possible values + TimeUnit *MeasurementUnitTime `json:"time_unit,omitempty" url:"time_unit,omitempty"` + // Represents the type of the measurement unit. + // See [MeasurementUnitUnitType](#type-measurementunitunittype) for possible values + Type *MeasurementUnitUnitType `json:"type,omitempty" url:"type,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListDisputeEvidenceRequest) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (m *MeasurementUnit) GetExtraProperties() map[string]interface{} { + return m.extraProperties } -func (l *ListDisputeEvidenceRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListDisputeEvidenceRequest +func (m *MeasurementUnit) UnmarshalJSON(data []byte) error { + type unmarshaler MeasurementUnit var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListDisputeEvidenceRequest(value) + *m = MeasurementUnit(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *m) if err != nil { return err } - l.extraProperties = extraProperties + m.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + m._rawJSON = json.RawMessage(data) return nil } -func (l *ListDisputeEvidenceRequest) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (m *MeasurementUnit) String() string { + if len(m._rawJSON) > 0 { + if value, err := core.StringifyJSON(m._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(m); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", m) } -// Defines the fields in a `ListDisputeEvidence` response. -type ListDisputeEvidenceResponse struct { - // The list of evidence previously uploaded to the specified dispute. - Evidence []*DisputeEvidence `json:"evidence,omitempty" url:"evidence,omitempty"` - // Information about errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The pagination cursor to be used in a subsequent request. - // If unset, this is the final response. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` +// Unit of area used to measure a quantity. +type MeasurementUnitArea string + +const ( + MeasurementUnitAreaInvalidArea MeasurementUnitArea = "INVALID_AREA" + MeasurementUnitAreaImperialAcre MeasurementUnitArea = "IMPERIAL_ACRE" + MeasurementUnitAreaImperialSquareInch MeasurementUnitArea = "IMPERIAL_SQUARE_INCH" + MeasurementUnitAreaImperialSquareFoot MeasurementUnitArea = "IMPERIAL_SQUARE_FOOT" + MeasurementUnitAreaImperialSquareYard MeasurementUnitArea = "IMPERIAL_SQUARE_YARD" + MeasurementUnitAreaImperialSquareMile MeasurementUnitArea = "IMPERIAL_SQUARE_MILE" + MeasurementUnitAreaMetricSquareCentimeter MeasurementUnitArea = "METRIC_SQUARE_CENTIMETER" + MeasurementUnitAreaMetricSquareMeter MeasurementUnitArea = "METRIC_SQUARE_METER" + MeasurementUnitAreaMetricSquareKilometer MeasurementUnitArea = "METRIC_SQUARE_KILOMETER" +) + +func NewMeasurementUnitAreaFromString(s string) (MeasurementUnitArea, error) { + switch s { + case "INVALID_AREA": + return MeasurementUnitAreaInvalidArea, nil + case "IMPERIAL_ACRE": + return MeasurementUnitAreaImperialAcre, nil + case "IMPERIAL_SQUARE_INCH": + return MeasurementUnitAreaImperialSquareInch, nil + case "IMPERIAL_SQUARE_FOOT": + return MeasurementUnitAreaImperialSquareFoot, nil + case "IMPERIAL_SQUARE_YARD": + return MeasurementUnitAreaImperialSquareYard, nil + case "IMPERIAL_SQUARE_MILE": + return MeasurementUnitAreaImperialSquareMile, nil + case "METRIC_SQUARE_CENTIMETER": + return MeasurementUnitAreaMetricSquareCentimeter, nil + case "METRIC_SQUARE_METER": + return MeasurementUnitAreaMetricSquareMeter, nil + case "METRIC_SQUARE_KILOMETER": + return MeasurementUnitAreaMetricSquareKilometer, nil + } + var t MeasurementUnitArea + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (m MeasurementUnitArea) Ptr() *MeasurementUnitArea { + return &m +} + +// The information needed to define a custom unit, provided by the seller. +type MeasurementUnitCustom struct { + // The name of the custom unit, for example "bushel". + Name string `json:"name" url:"name"` + // The abbreviation of the custom unit, such as "bsh" (bushel). This appears + // in the cart for the Point of Sale app, and in reports. + Abbreviation string `json:"abbreviation" url:"abbreviation"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListDisputeEvidenceResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (m *MeasurementUnitCustom) GetExtraProperties() map[string]interface{} { + return m.extraProperties } -func (l *ListDisputeEvidenceResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListDisputeEvidenceResponse +func (m *MeasurementUnitCustom) UnmarshalJSON(data []byte) error { + type unmarshaler MeasurementUnitCustom var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListDisputeEvidenceResponse(value) + *m = MeasurementUnitCustom(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *m) if err != nil { return err } - l.extraProperties = extraProperties - - l._rawJSON = json.RawMessage(data) - return nil + m.extraProperties = extraProperties + + m._rawJSON = json.RawMessage(data) + return nil +} + +func (m *MeasurementUnitCustom) String() string { + if len(m._rawJSON) > 0 { + if value, err := core.StringifyJSON(m._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(m); err == nil { + return value + } + return fmt.Sprintf("%#v", m) +} + +type MeasurementUnitGeneric string + +const ( + MeasurementUnitGenericInvalidGenericUnit MeasurementUnitGeneric = "INVALID_GENERIC_UNIT" + MeasurementUnitGenericUnit MeasurementUnitGeneric = "UNIT" +) + +func NewMeasurementUnitGenericFromString(s string) (MeasurementUnitGeneric, error) { + switch s { + case "INVALID_GENERIC_UNIT": + return MeasurementUnitGenericInvalidGenericUnit, nil + case "UNIT": + return MeasurementUnitGenericUnit, nil + } + var t MeasurementUnitGeneric + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (m MeasurementUnitGeneric) Ptr() *MeasurementUnitGeneric { + return &m +} + +// The unit of length used to measure a quantity. +type MeasurementUnitLength string + +const ( + MeasurementUnitLengthInvalidLength MeasurementUnitLength = "INVALID_LENGTH" + MeasurementUnitLengthImperialInch MeasurementUnitLength = "IMPERIAL_INCH" + MeasurementUnitLengthImperialFoot MeasurementUnitLength = "IMPERIAL_FOOT" + MeasurementUnitLengthImperialYard MeasurementUnitLength = "IMPERIAL_YARD" + MeasurementUnitLengthImperialMile MeasurementUnitLength = "IMPERIAL_MILE" + MeasurementUnitLengthMetricMillimeter MeasurementUnitLength = "METRIC_MILLIMETER" + MeasurementUnitLengthMetricCentimeter MeasurementUnitLength = "METRIC_CENTIMETER" + MeasurementUnitLengthMetricMeter MeasurementUnitLength = "METRIC_METER" + MeasurementUnitLengthMetricKilometer MeasurementUnitLength = "METRIC_KILOMETER" +) + +func NewMeasurementUnitLengthFromString(s string) (MeasurementUnitLength, error) { + switch s { + case "INVALID_LENGTH": + return MeasurementUnitLengthInvalidLength, nil + case "IMPERIAL_INCH": + return MeasurementUnitLengthImperialInch, nil + case "IMPERIAL_FOOT": + return MeasurementUnitLengthImperialFoot, nil + case "IMPERIAL_YARD": + return MeasurementUnitLengthImperialYard, nil + case "IMPERIAL_MILE": + return MeasurementUnitLengthImperialMile, nil + case "METRIC_MILLIMETER": + return MeasurementUnitLengthMetricMillimeter, nil + case "METRIC_CENTIMETER": + return MeasurementUnitLengthMetricCentimeter, nil + case "METRIC_METER": + return MeasurementUnitLengthMetricMeter, nil + case "METRIC_KILOMETER": + return MeasurementUnitLengthMetricKilometer, nil + } + var t MeasurementUnitLength + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (m MeasurementUnitLength) Ptr() *MeasurementUnitLength { + return &m +} + +// Unit of time used to measure a quantity (a duration). +type MeasurementUnitTime string + +const ( + MeasurementUnitTimeInvalidTime MeasurementUnitTime = "INVALID_TIME" + MeasurementUnitTimeGenericMillisecond MeasurementUnitTime = "GENERIC_MILLISECOND" + MeasurementUnitTimeGenericSecond MeasurementUnitTime = "GENERIC_SECOND" + MeasurementUnitTimeGenericMinute MeasurementUnitTime = "GENERIC_MINUTE" + MeasurementUnitTimeGenericHour MeasurementUnitTime = "GENERIC_HOUR" + MeasurementUnitTimeGenericDay MeasurementUnitTime = "GENERIC_DAY" +) + +func NewMeasurementUnitTimeFromString(s string) (MeasurementUnitTime, error) { + switch s { + case "INVALID_TIME": + return MeasurementUnitTimeInvalidTime, nil + case "GENERIC_MILLISECOND": + return MeasurementUnitTimeGenericMillisecond, nil + case "GENERIC_SECOND": + return MeasurementUnitTimeGenericSecond, nil + case "GENERIC_MINUTE": + return MeasurementUnitTimeGenericMinute, nil + case "GENERIC_HOUR": + return MeasurementUnitTimeGenericHour, nil + case "GENERIC_DAY": + return MeasurementUnitTimeGenericDay, nil + } + var t MeasurementUnitTime + return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (l *ListDisputeEvidenceResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(l); err == nil { - return value - } - return fmt.Sprintf("%#v", l) +func (m MeasurementUnitTime) Ptr() *MeasurementUnitTime { + return &m } -// Defines the request parameters for the `ListDisputes` endpoint. -type ListDisputesRequest struct { - // A pagination cursor returned by a previous call to this endpoint. - // Provide this cursor to retrieve the next set of results for the original query. - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // The dispute states used to filter the result. If not specified, the endpoint returns all disputes. - // See [DisputeState](#type-disputestate) for possible values - States []DisputeState `json:"states,omitempty" url:"states,omitempty"` - // The ID of the location for which to return a list of disputes. - // If not specified, the endpoint returns disputes associated with all locations. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` +// Describes the type of this unit and indicates which field contains the unit information. This is an ‘open’ enum. +type MeasurementUnitUnitType string - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} +const ( + MeasurementUnitUnitTypeInvalidType MeasurementUnitUnitType = "INVALID_TYPE" + MeasurementUnitUnitTypeTypeCustom MeasurementUnitUnitType = "TYPE_CUSTOM" + MeasurementUnitUnitTypeTypeArea MeasurementUnitUnitType = "TYPE_AREA" + MeasurementUnitUnitTypeTypeLength MeasurementUnitUnitType = "TYPE_LENGTH" + MeasurementUnitUnitTypeTypeVolume MeasurementUnitUnitType = "TYPE_VOLUME" + MeasurementUnitUnitTypeTypeWeight MeasurementUnitUnitType = "TYPE_WEIGHT" + MeasurementUnitUnitTypeTypeTime MeasurementUnitUnitType = "TYPE_TIME" + MeasurementUnitUnitTypeTypeGeneric MeasurementUnitUnitType = "TYPE_GENERIC" +) -func (l *ListDisputesRequest) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func NewMeasurementUnitUnitTypeFromString(s string) (MeasurementUnitUnitType, error) { + switch s { + case "INVALID_TYPE": + return MeasurementUnitUnitTypeInvalidType, nil + case "TYPE_CUSTOM": + return MeasurementUnitUnitTypeTypeCustom, nil + case "TYPE_AREA": + return MeasurementUnitUnitTypeTypeArea, nil + case "TYPE_LENGTH": + return MeasurementUnitUnitTypeTypeLength, nil + case "TYPE_VOLUME": + return MeasurementUnitUnitTypeTypeVolume, nil + case "TYPE_WEIGHT": + return MeasurementUnitUnitTypeTypeWeight, nil + case "TYPE_TIME": + return MeasurementUnitUnitTypeTypeTime, nil + case "TYPE_GENERIC": + return MeasurementUnitUnitTypeTypeGeneric, nil + } + var t MeasurementUnitUnitType + return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (l *ListDisputesRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListDisputesRequest - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *l = ListDisputesRequest(value) +func (m MeasurementUnitUnitType) Ptr() *MeasurementUnitUnitType { + return &m +} - extraProperties, err := core.ExtractExtraProperties(data, *l) - if err != nil { - return err - } - l.extraProperties = extraProperties +// The unit of volume used to measure a quantity. +type MeasurementUnitVolume string - l._rawJSON = json.RawMessage(data) - return nil -} +const ( + MeasurementUnitVolumeInvalidVolume MeasurementUnitVolume = "INVALID_VOLUME" + MeasurementUnitVolumeGenericFluidOunce MeasurementUnitVolume = "GENERIC_FLUID_OUNCE" + MeasurementUnitVolumeGenericShot MeasurementUnitVolume = "GENERIC_SHOT" + MeasurementUnitVolumeGenericCup MeasurementUnitVolume = "GENERIC_CUP" + MeasurementUnitVolumeGenericPint MeasurementUnitVolume = "GENERIC_PINT" + MeasurementUnitVolumeGenericQuart MeasurementUnitVolume = "GENERIC_QUART" + MeasurementUnitVolumeGenericGallon MeasurementUnitVolume = "GENERIC_GALLON" + MeasurementUnitVolumeImperialCubicInch MeasurementUnitVolume = "IMPERIAL_CUBIC_INCH" + MeasurementUnitVolumeImperialCubicFoot MeasurementUnitVolume = "IMPERIAL_CUBIC_FOOT" + MeasurementUnitVolumeImperialCubicYard MeasurementUnitVolume = "IMPERIAL_CUBIC_YARD" + MeasurementUnitVolumeMetricMilliliter MeasurementUnitVolume = "METRIC_MILLILITER" + MeasurementUnitVolumeMetricLiter MeasurementUnitVolume = "METRIC_LITER" +) -func (l *ListDisputesRequest) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(l); err == nil { - return value +func NewMeasurementUnitVolumeFromString(s string) (MeasurementUnitVolume, error) { + switch s { + case "INVALID_VOLUME": + return MeasurementUnitVolumeInvalidVolume, nil + case "GENERIC_FLUID_OUNCE": + return MeasurementUnitVolumeGenericFluidOunce, nil + case "GENERIC_SHOT": + return MeasurementUnitVolumeGenericShot, nil + case "GENERIC_CUP": + return MeasurementUnitVolumeGenericCup, nil + case "GENERIC_PINT": + return MeasurementUnitVolumeGenericPint, nil + case "GENERIC_QUART": + return MeasurementUnitVolumeGenericQuart, nil + case "GENERIC_GALLON": + return MeasurementUnitVolumeGenericGallon, nil + case "IMPERIAL_CUBIC_INCH": + return MeasurementUnitVolumeImperialCubicInch, nil + case "IMPERIAL_CUBIC_FOOT": + return MeasurementUnitVolumeImperialCubicFoot, nil + case "IMPERIAL_CUBIC_YARD": + return MeasurementUnitVolumeImperialCubicYard, nil + case "METRIC_MILLILITER": + return MeasurementUnitVolumeMetricMilliliter, nil + case "METRIC_LITER": + return MeasurementUnitVolumeMetricLiter, nil } - return fmt.Sprintf("%#v", l) + var t MeasurementUnitVolume + return "", fmt.Errorf("%s is not a valid %T", s, t) } -// Defines fields in a `ListDisputes` response. -type ListDisputesResponse struct { - // Information about errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The list of disputes. - Disputes []*Dispute `json:"disputes,omitempty" url:"disputes,omitempty"` - // The pagination cursor to be used in a subsequent request. - // If unset, this is the final response. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (m MeasurementUnitVolume) Ptr() *MeasurementUnitVolume { + return &m } -func (l *ListDisputesResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties -} +// Unit of weight used to measure a quantity. +type MeasurementUnitWeight string -func (l *ListDisputesResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListDisputesResponse - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *l = ListDisputesResponse(value) +const ( + MeasurementUnitWeightInvalidWeight MeasurementUnitWeight = "INVALID_WEIGHT" + MeasurementUnitWeightImperialWeightOunce MeasurementUnitWeight = "IMPERIAL_WEIGHT_OUNCE" + MeasurementUnitWeightImperialPound MeasurementUnitWeight = "IMPERIAL_POUND" + MeasurementUnitWeightImperialStone MeasurementUnitWeight = "IMPERIAL_STONE" + MeasurementUnitWeightMetricMilligram MeasurementUnitWeight = "METRIC_MILLIGRAM" + MeasurementUnitWeightMetricGram MeasurementUnitWeight = "METRIC_GRAM" + MeasurementUnitWeightMetricKilogram MeasurementUnitWeight = "METRIC_KILOGRAM" +) - extraProperties, err := core.ExtractExtraProperties(data, *l) - if err != nil { - return err +func NewMeasurementUnitWeightFromString(s string) (MeasurementUnitWeight, error) { + switch s { + case "INVALID_WEIGHT": + return MeasurementUnitWeightInvalidWeight, nil + case "IMPERIAL_WEIGHT_OUNCE": + return MeasurementUnitWeightImperialWeightOunce, nil + case "IMPERIAL_POUND": + return MeasurementUnitWeightImperialPound, nil + case "IMPERIAL_STONE": + return MeasurementUnitWeightImperialStone, nil + case "METRIC_MILLIGRAM": + return MeasurementUnitWeightMetricMilligram, nil + case "METRIC_GRAM": + return MeasurementUnitWeightMetricGram, nil + case "METRIC_KILOGRAM": + return MeasurementUnitWeightMetricKilogram, nil } - l.extraProperties = extraProperties - - l._rawJSON = json.RawMessage(data) - return nil + var t MeasurementUnitWeight + return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (l *ListDisputesResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(l); err == nil { - return value - } - return fmt.Sprintf("%#v", l) +func (m MeasurementUnitWeight) Ptr() *MeasurementUnitWeight { + return &m } -// A request for a set of `EmployeeWage` objects. -type ListEmployeeWagesRequest struct { - // Filter the returned wages to only those that are associated with the specified employee. - EmployeeID *string `json:"employee_id,omitempty" url:"employee_id,omitempty"` - // The maximum number of `EmployeeWage` results to return per page. The number can range between - // 1 and 200. The default is 200. - Limit *int `json:"limit,omitempty" url:"limit,omitempty"` - // A pointer to the next page of `EmployeeWage` results to fetch. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` +// Represents a business that sells with Square. +type Merchant struct { + // The Square-issued ID of the merchant. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The name of the merchant's overall business. + BusinessName *string `json:"business_name,omitempty" url:"business_name,omitempty"` + // The country code associated with the merchant, in the two-letter format of ISO 3166. For example, `US` or `JP`. + // See [Country](#type-country) for possible values + Country Country `json:"country" url:"country"` + // The code indicating the [language preferences](https://developer.squareup.com/docs/build-basics/general-considerations/language-preferences) of the merchant, in [BCP 47 format](https://tools.ietf.org/html/bcp47#appendix-A). For example, `en-US` or `fr-CA`. + LanguageCode *string `json:"language_code,omitempty" url:"language_code,omitempty"` + // The currency associated with the merchant, in ISO 4217 format. For example, the currency code for US dollars is `USD`. + // See [Currency](#type-currency) for possible values + Currency *Currency `json:"currency,omitempty" url:"currency,omitempty"` + // The merchant's status. + // See [MerchantStatus](#type-merchantstatus) for possible values + Status *MerchantStatus `json:"status,omitempty" url:"status,omitempty"` + // The ID of the [main `Location`](https://developer.squareup.com/docs/locations-api#about-the-main-location) for this merchant. + MainLocationID *string `json:"main_location_id,omitempty" url:"main_location_id,omitempty"` + // The time when the merchant was created, in RFC 3339 format. + // For more information, see [Working with Dates](https://developer.squareup.com/docs/build-basics/working-with-dates). + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListEmployeeWagesRequest) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (m *Merchant) GetExtraProperties() map[string]interface{} { + return m.extraProperties } -func (l *ListEmployeeWagesRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListEmployeeWagesRequest +func (m *Merchant) UnmarshalJSON(data []byte) error { + type unmarshaler Merchant var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListEmployeeWagesRequest(value) + *m = Merchant(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *m) if err != nil { return err } - l.extraProperties = extraProperties + m.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + m._rawJSON = json.RawMessage(data) return nil } -func (l *ListEmployeeWagesRequest) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (m *Merchant) String() string { + if len(m._rawJSON) > 0 { + if value, err := core.StringifyJSON(m._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(m); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", m) } -// The response to a request for a set of `EmployeeWage` objects. The response contains -// a set of `EmployeeWage` objects. -type ListEmployeeWagesResponse struct { - // A page of `EmployeeWage` results. - EmployeeWages []*EmployeeWage `json:"employee_wages,omitempty" url:"employee_wages,omitempty"` - // The value supplied in the subsequent request to fetch the next page - // of `EmployeeWage` results. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Published when a merchant [custom attribute definition](entity:CustomAttributeDefinition) +// is created by the subscribing application. Subscribe to this event to be notified +// when your application creates a merchant custom attribute definition. +type MerchantCustomAttributeDefinitionOwnedCreatedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"merchant.custom_attribute_definition.owned.created"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListEmployeeWagesResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (m *MerchantCustomAttributeDefinitionOwnedCreatedEvent) GetExtraProperties() map[string]interface{} { + return m.extraProperties } -func (l *ListEmployeeWagesResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListEmployeeWagesResponse +func (m *MerchantCustomAttributeDefinitionOwnedCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler MerchantCustomAttributeDefinitionOwnedCreatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListEmployeeWagesResponse(value) + *m = MerchantCustomAttributeDefinitionOwnedCreatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *m) if err != nil { return err } - l.extraProperties = extraProperties + m.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + m._rawJSON = json.RawMessage(data) return nil } -func (l *ListEmployeeWagesResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (m *MerchantCustomAttributeDefinitionOwnedCreatedEvent) String() string { + if len(m._rawJSON) > 0 { + if value, err := core.StringifyJSON(m._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(m); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", m) } -type ListEmployeesRequest struct { - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` - // Specifies the EmployeeStatus to filter the employee by. - // See [EmployeeStatus](#type-employeestatus) for possible values - Status *EmployeeStatus `json:"status,omitempty" url:"status,omitempty"` - // The number of employees to be returned on each page. - Limit *int `json:"limit,omitempty" url:"limit,omitempty"` - // The token required to retrieve the specified page of results. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` +// Published when a merchant [custom attribute definition](entity:CustomAttributeDefinition) +// is deleted by the subscribing application. Subscribe to this event to be notified +// when your application deletes a merchant custom attribute definition. +type MerchantCustomAttributeDefinitionOwnedDeletedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"merchant.custom_attribute_definition.owned.deleted"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListEmployeesRequest) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (m *MerchantCustomAttributeDefinitionOwnedDeletedEvent) GetExtraProperties() map[string]interface{} { + return m.extraProperties } -func (l *ListEmployeesRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListEmployeesRequest +func (m *MerchantCustomAttributeDefinitionOwnedDeletedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler MerchantCustomAttributeDefinitionOwnedDeletedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListEmployeesRequest(value) + *m = MerchantCustomAttributeDefinitionOwnedDeletedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *m) if err != nil { return err } - l.extraProperties = extraProperties + m.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + m._rawJSON = json.RawMessage(data) return nil } -func (l *ListEmployeesRequest) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (m *MerchantCustomAttributeDefinitionOwnedDeletedEvent) String() string { + if len(m._rawJSON) > 0 { + if value, err := core.StringifyJSON(m._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(m); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", m) } -type ListEmployeesResponse struct { - Employees []*Employee `json:"employees,omitempty" url:"employees,omitempty"` - // The token to be used to retrieve the next page of results. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Published when a merchant [custom attribute definition](entity:CustomAttributeDefinition) +// is updated by the subscribing application. Subscribe to this event to be notified +// when your application updates a merchant custom attribute definition. +type MerchantCustomAttributeDefinitionOwnedUpdatedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"merchant.custom_attribute_definition.owned.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListEmployeesResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (m *MerchantCustomAttributeDefinitionOwnedUpdatedEvent) GetExtraProperties() map[string]interface{} { + return m.extraProperties } -func (l *ListEmployeesResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListEmployeesResponse +func (m *MerchantCustomAttributeDefinitionOwnedUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler MerchantCustomAttributeDefinitionOwnedUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListEmployeesResponse(value) + *m = MerchantCustomAttributeDefinitionOwnedUpdatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *m) if err != nil { return err } - l.extraProperties = extraProperties + m.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + m._rawJSON = json.RawMessage(data) return nil } -func (l *ListEmployeesResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (m *MerchantCustomAttributeDefinitionOwnedUpdatedEvent) String() string { + if len(m._rawJSON) > 0 { + if value, err := core.StringifyJSON(m._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(m); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", m) } -// Defines the fields that are included in the response body of -// a request to the [ListEventTypes]($e/Events/ListEventTypes) endpoint. -// -// Note: if there are errors processing the request, the event types field will not be -// present. -type ListEventTypesResponse struct { - // Information on errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The list of event types. - EventTypes []string `json:"event_types,omitempty" url:"event_types,omitempty"` - // Contains the metadata of an event type. For more information, see [EventTypeMetadata](entity:EventTypeMetadata). - Metadata []*EventTypeMetadata `json:"metadata,omitempty" url:"metadata,omitempty"` +// Published when a merchant [custom attribute definition](entity:CustomAttributeDefinition) +// that is visible to the subscribing application is created. A notification is sent when your application +// creates a custom attribute definition or another application creates a custom attribute definition whose +// `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. +type MerchantCustomAttributeDefinitionVisibleCreatedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"merchant.custom_attribute_definition.visible.created"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListEventTypesResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (m *MerchantCustomAttributeDefinitionVisibleCreatedEvent) GetExtraProperties() map[string]interface{} { + return m.extraProperties } -func (l *ListEventTypesResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListEventTypesResponse +func (m *MerchantCustomAttributeDefinitionVisibleCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler MerchantCustomAttributeDefinitionVisibleCreatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListEventTypesResponse(value) + *m = MerchantCustomAttributeDefinitionVisibleCreatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *m) if err != nil { return err } - l.extraProperties = extraProperties + m.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + m._rawJSON = json.RawMessage(data) return nil } -func (l *ListEventTypesResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (m *MerchantCustomAttributeDefinitionVisibleCreatedEvent) String() string { + if len(m._rawJSON) > 0 { + if value, err := core.StringifyJSON(m._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(m); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", m) } -// Returns a list of gift card activities. You can optionally specify a filter to retrieve a -// subset of activites. -type ListGiftCardActivitiesRequest struct { - // If a gift card ID is provided, the endpoint returns activities related - // to the specified gift card. Otherwise, the endpoint returns all gift card activities for - // the seller. - GiftCardID *string `json:"gift_card_id,omitempty" url:"gift_card_id,omitempty"` - // If a [type](entity:GiftCardActivityType) is provided, the endpoint returns gift card activities of the specified type. - // Otherwise, the endpoint returns all types of gift card activities. +// Published when a merchant [custom attribute definition](entity:CustomAttributeDefinition) +// that is visible to the subscribing application is deleted. A notification is sent when your application +// deletes a custom attribute definition or another application deletes a custom attribute definition whose +// `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. +type MerchantCustomAttributeDefinitionVisibleDeletedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"merchant.custom_attribute_definition.visible.deleted"`. Type *string `json:"type,omitempty" url:"type,omitempty"` - // If a location ID is provided, the endpoint returns gift card activities for the specified location. - // Otherwise, the endpoint returns gift card activities for all locations. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` - // The timestamp for the beginning of the reporting period, in RFC 3339 format. - // This start time is inclusive. The default value is the current time minus one year. - BeginTime *string `json:"begin_time,omitempty" url:"begin_time,omitempty"` - // The timestamp for the end of the reporting period, in RFC 3339 format. - // This end time is inclusive. The default value is the current time. - EndTime *string `json:"end_time,omitempty" url:"end_time,omitempty"` - // If a limit is provided, the endpoint returns the specified number - // of results (or fewer) per page. The maximum value is 100. The default value is 50. - // For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). - Limit *int `json:"limit,omitempty" url:"limit,omitempty"` - // A pagination cursor returned by a previous call to this endpoint. - // Provide this cursor to retrieve the next set of results for the original query. - // If a cursor is not provided, the endpoint returns the first page of the results. - // For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // The order in which the endpoint returns the activities, based on `created_at`. - // - // - `ASC` - Oldest to newest. - // - `DESC` - Newest to oldest (default). - SortOrder *string `json:"sort_order,omitempty" url:"sort_order,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListGiftCardActivitiesRequest) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (m *MerchantCustomAttributeDefinitionVisibleDeletedEvent) GetExtraProperties() map[string]interface{} { + return m.extraProperties } -func (l *ListGiftCardActivitiesRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListGiftCardActivitiesRequest +func (m *MerchantCustomAttributeDefinitionVisibleDeletedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler MerchantCustomAttributeDefinitionVisibleDeletedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListGiftCardActivitiesRequest(value) + *m = MerchantCustomAttributeDefinitionVisibleDeletedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *m) if err != nil { return err } - l.extraProperties = extraProperties + m.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + m._rawJSON = json.RawMessage(data) return nil } -func (l *ListGiftCardActivitiesRequest) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (m *MerchantCustomAttributeDefinitionVisibleDeletedEvent) String() string { + if len(m._rawJSON) > 0 { + if value, err := core.StringifyJSON(m._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(m); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", m) } -// A response that contains a list of `GiftCardActivity` objects. If the request resulted in errors, -// the response contains a set of `Error` objects. -type ListGiftCardActivitiesResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The requested gift card activities or an empty object if none are found. - GiftCardActivities []*GiftCardActivity `json:"gift_card_activities,omitempty" url:"gift_card_activities,omitempty"` - // When a response is truncated, it includes a cursor that you can use in a - // subsequent request to retrieve the next set of activities. If a cursor is not present, this is - // the final response. - // For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` +// Published when a merchant [custom attribute definition](entity:CustomAttributeDefinition) +// that is visible to the subscribing application is updated. A notification is sent when your application +// updates a custom attribute definition or another application updates a custom attribute definition whose +// `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. +type MerchantCustomAttributeDefinitionVisibleUpdatedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"merchant.custom_attribute_definition.visible.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListGiftCardActivitiesResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (m *MerchantCustomAttributeDefinitionVisibleUpdatedEvent) GetExtraProperties() map[string]interface{} { + return m.extraProperties } -func (l *ListGiftCardActivitiesResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListGiftCardActivitiesResponse +func (m *MerchantCustomAttributeDefinitionVisibleUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler MerchantCustomAttributeDefinitionVisibleUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListGiftCardActivitiesResponse(value) + *m = MerchantCustomAttributeDefinitionVisibleUpdatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *m) if err != nil { return err } - l.extraProperties = extraProperties + m.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + m._rawJSON = json.RawMessage(data) return nil } -func (l *ListGiftCardActivitiesResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (m *MerchantCustomAttributeDefinitionVisibleUpdatedEvent) String() string { + if len(m._rawJSON) > 0 { + if value, err := core.StringifyJSON(m._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { - return value - } - return fmt.Sprintf("%#v", l) -} - -// A request to list gift cards. You can optionally specify a filter to retrieve a subset of -// gift cards. -type ListGiftCardsRequest struct { - // If a [type](entity:GiftCardType) is provided, the endpoint returns gift cards of the specified type. - // Otherwise, the endpoint returns gift cards of all types. - Type *string `json:"type,omitempty" url:"type,omitempty"` - // If a [state](entity:GiftCardStatus) is provided, the endpoint returns the gift cards in the specified state. - // Otherwise, the endpoint returns the gift cards of all states. - State *string `json:"state,omitempty" url:"state,omitempty"` - // If a limit is provided, the endpoint returns only the specified number of results per page. - // The maximum value is 200. The default value is 30. - // For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). - Limit *int `json:"limit,omitempty" url:"limit,omitempty"` - // A pagination cursor returned by a previous call to this endpoint. - // Provide this cursor to retrieve the next set of results for the original query. - // If a cursor is not provided, the endpoint returns the first page of the results. - // For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // If a customer ID is provided, the endpoint returns only the gift cards linked to the specified customer. - CustomerID *string `json:"customer_id,omitempty" url:"customer_id,omitempty"` + if value, err := core.StringifyJSON(m); err == nil { + return value + } + return fmt.Sprintf("%#v", m) +} + +// Published when a merchant [custom attribute](entity:CustomAttribute) +// associated with a [custom attribute definition](entity:CustomAttributeDefinition) that is +// owned by the subscribing application is deleted. Subscribe to this event to be notified +// when your application deletes a merchant custom attribute. +type MerchantCustomAttributeOwnedDeletedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"merchant.custom_attribute.owned.deleted"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListGiftCardsRequest) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (m *MerchantCustomAttributeOwnedDeletedEvent) GetExtraProperties() map[string]interface{} { + return m.extraProperties } -func (l *ListGiftCardsRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListGiftCardsRequest +func (m *MerchantCustomAttributeOwnedDeletedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler MerchantCustomAttributeOwnedDeletedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListGiftCardsRequest(value) + *m = MerchantCustomAttributeOwnedDeletedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *m) if err != nil { return err } - l.extraProperties = extraProperties + m.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + m._rawJSON = json.RawMessage(data) return nil } -func (l *ListGiftCardsRequest) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (m *MerchantCustomAttributeOwnedDeletedEvent) String() string { + if len(m._rawJSON) > 0 { + if value, err := core.StringifyJSON(m._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(m); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", m) } -// A response that contains a list of `GiftCard` objects. If the request resulted in errors, -// the response contains a set of `Error` objects. -type ListGiftCardsResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The requested gift cards or an empty object if none are found. - GiftCards []*GiftCard `json:"gift_cards,omitempty" url:"gift_cards,omitempty"` - // When a response is truncated, it includes a cursor that you can use in a - // subsequent request to retrieve the next set of gift cards. If a cursor is not present, this is - // the final response. - // For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` +// Published when a merchant [custom attribute](entity:CustomAttribute) +// associated with a [custom attribute definition](entity:CustomAttributeDefinition) that is +// owned by the subscribing application is updated. Subscribe to this event to be notified +// when your application updates a merchant custom attribute. +type MerchantCustomAttributeOwnedUpdatedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"merchant.custom_attribute.owned.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListGiftCardsResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (m *MerchantCustomAttributeOwnedUpdatedEvent) GetExtraProperties() map[string]interface{} { + return m.extraProperties } -func (l *ListGiftCardsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListGiftCardsResponse +func (m *MerchantCustomAttributeOwnedUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler MerchantCustomAttributeOwnedUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListGiftCardsResponse(value) + *m = MerchantCustomAttributeOwnedUpdatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *m) if err != nil { return err } - l.extraProperties = extraProperties + m.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + m._rawJSON = json.RawMessage(data) return nil } -func (l *ListGiftCardsResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (m *MerchantCustomAttributeOwnedUpdatedEvent) String() string { + if len(m._rawJSON) > 0 { + if value, err := core.StringifyJSON(m._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(m); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", m) } -// Describes a `ListInvoice` request. -type ListInvoicesRequest struct { - // The ID of the location for which to list invoices. - LocationID string `json:"location_id" url:"location_id"` - // A pagination cursor returned by a previous call to this endpoint. - // Provide this cursor to retrieve the next set of results for your original query. - // - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // The maximum number of invoices to return (200 is the maximum `limit`). - // If not provided, the server uses a default limit of 100 invoices. - Limit *int `json:"limit,omitempty" url:"limit,omitempty"` +// Published when a merchant [custom attribute](entity:CustomAttribute) with +// the `visibility` field set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES` is deleted. +// An application that subscribes to this event is notified when a merchant custom attribute is deleted +// by any application for which the subscribing application has read access to the merchant custom attribute. +type MerchantCustomAttributeVisibleDeletedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"merchant.custom_attribute.visible.deleted"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListInvoicesRequest) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (m *MerchantCustomAttributeVisibleDeletedEvent) GetExtraProperties() map[string]interface{} { + return m.extraProperties } -func (l *ListInvoicesRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListInvoicesRequest +func (m *MerchantCustomAttributeVisibleDeletedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler MerchantCustomAttributeVisibleDeletedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListInvoicesRequest(value) + *m = MerchantCustomAttributeVisibleDeletedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *m) if err != nil { return err } - l.extraProperties = extraProperties + m.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + m._rawJSON = json.RawMessage(data) return nil } -func (l *ListInvoicesRequest) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (m *MerchantCustomAttributeVisibleDeletedEvent) String() string { + if len(m._rawJSON) > 0 { + if value, err := core.StringifyJSON(m._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(m); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", m) } -// Describes a `ListInvoice` response. -type ListInvoicesResponse struct { - // The invoices retrieved. - Invoices []*Invoice `json:"invoices,omitempty" url:"invoices,omitempty"` - // When a response is truncated, it includes a cursor that you can use in a - // subsequent request to retrieve the next set of invoices. If empty, this is the final - // response. - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // Information about errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Published when a merchant [custom attribute](entity:CustomAttribute) with +// the `visibility` field set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES` is updated. +// An application that subscribes to this event is notified when a merchant custom attribute is updated +// by any application for which the subscribing application has read access to the merchant custom attribute. +type MerchantCustomAttributeVisibleUpdatedEvent struct { + // The ID of the seller associated with the event that triggered the event notification. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"merchant.custom_attribute.visible.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event notification. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp that indicates when the event notification was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event that triggered the event notification. + Data *CustomAttributeEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListInvoicesResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (m *MerchantCustomAttributeVisibleUpdatedEvent) GetExtraProperties() map[string]interface{} { + return m.extraProperties } -func (l *ListInvoicesResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListInvoicesResponse +func (m *MerchantCustomAttributeVisibleUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler MerchantCustomAttributeVisibleUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListInvoicesResponse(value) + *m = MerchantCustomAttributeVisibleUpdatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *m) if err != nil { return err } - l.extraProperties = extraProperties + m.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + m._rawJSON = json.RawMessage(data) return nil } -func (l *ListInvoicesResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (m *MerchantCustomAttributeVisibleUpdatedEvent) String() string { + if len(m._rawJSON) > 0 { + if value, err := core.StringifyJSON(m._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(m); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", m) } -type ListLocationBookingProfilesResponse struct { - // The list of a seller's location booking profiles. - LocationBookingProfiles []*LocationBookingProfile `json:"location_booking_profiles,omitempty" url:"location_booking_profiles,omitempty"` - // The pagination cursor to be used in the subsequent request to get the next page of the results. Stop retrieving the next page of the results when the cursor is not set. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // Errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Published when online checkout merchant settings are updated +type MerchantSettingsUpdatedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents, `"online_checkout.merchant_settings.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // RFC 3339 timestamp of when the event was created. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *MerchantSettingsUpdatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListLocationBookingProfilesResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (m *MerchantSettingsUpdatedEvent) GetExtraProperties() map[string]interface{} { + return m.extraProperties } -func (l *ListLocationBookingProfilesResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListLocationBookingProfilesResponse +func (m *MerchantSettingsUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler MerchantSettingsUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListLocationBookingProfilesResponse(value) + *m = MerchantSettingsUpdatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *m) if err != nil { return err } - l.extraProperties = extraProperties + m.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + m._rawJSON = json.RawMessage(data) return nil } -func (l *ListLocationBookingProfilesResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (m *MerchantSettingsUpdatedEvent) String() string { + if len(m._rawJSON) > 0 { + if value, err := core.StringifyJSON(m._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(m); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", m) } -// Represents a [ListLocationCustomAttributeDefinitions]($e/LocationCustomAttributes/ListLocationCustomAttributeDefinitions) response. -// Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response. -// If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`. -type ListLocationCustomAttributeDefinitionsResponse struct { - // The retrieved custom attribute definitions. If no custom attribute definitions are found, - // Square returns an empty object (`{}`). - CustomAttributeDefinitions []*CustomAttributeDefinition `json:"custom_attribute_definitions,omitempty" url:"custom_attribute_definitions,omitempty"` - // The cursor to provide in your next call to this endpoint to retrieve the next page of - // results for your original request. This field is present only if the request succeeded and - // additional results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +type MerchantSettingsUpdatedEventData struct { + // Name of the updated object’s type, `"online_checkout.merchant_settings"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the updated merchant settings. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the updated merchant settings. + Object *MerchantSettingsUpdatedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListLocationCustomAttributeDefinitionsResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (m *MerchantSettingsUpdatedEventData) GetExtraProperties() map[string]interface{} { + return m.extraProperties } -func (l *ListLocationCustomAttributeDefinitionsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListLocationCustomAttributeDefinitionsResponse +func (m *MerchantSettingsUpdatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler MerchantSettingsUpdatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListLocationCustomAttributeDefinitionsResponse(value) + *m = MerchantSettingsUpdatedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *m) if err != nil { return err } - l.extraProperties = extraProperties + m.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + m._rawJSON = json.RawMessage(data) return nil } -func (l *ListLocationCustomAttributeDefinitionsResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (m *MerchantSettingsUpdatedEventData) String() string { + if len(m._rawJSON) > 0 { + if value, err := core.StringifyJSON(m._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(m); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", m) } -// Represents a [ListLocationCustomAttributes]($e/LocationCustomAttributes/ListLocationCustomAttributes) response. -// Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional -// results are available, the `cursor` field is also present along with `custom_attributes`. -type ListLocationCustomAttributesResponse struct { - // The retrieved custom attributes. If `with_definitions` was set to `true` in the request, - // the custom attribute definition is returned in the `definition` field of each custom attribute. - // If no custom attributes are found, Square returns an empty object (`{}`). - CustomAttributes []*CustomAttribute `json:"custom_attributes,omitempty" url:"custom_attributes,omitempty"` - // The cursor to use in your next call to this endpoint to retrieve the next page of results - // for your original request. This field is present only if the request succeeded and additional - // results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +type MerchantSettingsUpdatedEventObject struct { + // The updated merchant settings. + MerchantSettings *CheckoutMerchantSettings `json:"merchant_settings,omitempty" url:"merchant_settings,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListLocationCustomAttributesResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (m *MerchantSettingsUpdatedEventObject) GetExtraProperties() map[string]interface{} { + return m.extraProperties } -func (l *ListLocationCustomAttributesResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListLocationCustomAttributesResponse +func (m *MerchantSettingsUpdatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler MerchantSettingsUpdatedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListLocationCustomAttributesResponse(value) + *m = MerchantSettingsUpdatedEventObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *m) if err != nil { return err } - l.extraProperties = extraProperties + m.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + m._rawJSON = json.RawMessage(data) return nil } -func (l *ListLocationCustomAttributesResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (m *MerchantSettingsUpdatedEventObject) String() string { + if len(m._rawJSON) > 0 { + if value, err := core.StringifyJSON(m._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(m); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", m) } -// Defines the fields that are included in requests to the -// [ListLocations]($e/Locations/ListLocations) endpoint. -type ListLocationsRequest struct { +type MerchantStatus string + +const ( + MerchantStatusActive MerchantStatus = "ACTIVE" + MerchantStatusInactive MerchantStatus = "INACTIVE" +) + +func NewMerchantStatusFromString(s string) (MerchantStatus, error) { + switch s { + case "ACTIVE": + return MerchantStatusActive, nil + case "INACTIVE": + return MerchantStatusInactive, nil + } + var t MerchantStatus + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (m MerchantStatus) Ptr() *MerchantStatus { + return &m +} + +// Location-specific overrides for specified properties of a `CatalogModifier` object. +type ModifierLocationOverrides struct { + // The ID of the `Location` object representing the location. This can include a deactivated location. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The overridden price at the specified location. If this is unspecified, the modifier price is not overridden. + // The modifier becomes free of charge at the specified location, when this `price_money` field is set to 0. + PriceMoney *Money `json:"price_money,omitempty" url:"price_money,omitempty"` + // Indicates whether the modifier is sold out at the specified location or not. As an example, for cheese (modifier) burger (item), when the modifier is sold out, it is the cheese, but not the burger, that is sold out. + // The seller can manually set this sold out status. Attempts by an application to set this attribute are ignored. + SoldOut *bool `json:"sold_out,omitempty" url:"sold_out,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListLocationsRequest) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (m *ModifierLocationOverrides) GetExtraProperties() map[string]interface{} { + return m.extraProperties } -func (l *ListLocationsRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListLocationsRequest +func (m *ModifierLocationOverrides) UnmarshalJSON(data []byte) error { + type unmarshaler ModifierLocationOverrides var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListLocationsRequest(value) + *m = ModifierLocationOverrides(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *m) if err != nil { return err } - l.extraProperties = extraProperties + m.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + m._rawJSON = json.RawMessage(data) return nil } -func (l *ListLocationsRequest) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (m *ModifierLocationOverrides) String() string { + if len(m._rawJSON) > 0 { + if value, err := core.StringifyJSON(m._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(m); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", m) } -// Defines the fields that are included in the response body of a request -// to the [ListLocations]($e/Locations/ListLocations) endpoint. -// -// Either `errors` or `locations` is present in a given response (never both). -type ListLocationsResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The business locations. - Locations []*Location `json:"locations,omitempty" url:"locations,omitempty"` +// Represents an amount of money. `Money` fields can be signed or unsigned. +// Fields that do not explicitly define whether they are signed or unsigned are +// considered unsigned and can only hold positive amounts. For signed fields, the +// sign of the value indicates the purpose of the money transfer. See +// [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts) +// for more information. +type Money struct { + // The amount of money, in the smallest denomination of the currency + // indicated by `currency`. For example, when `currency` is `USD`, `amount` is + // in cents. Monetary amounts can be positive or negative. See the specific + // field description to determine the meaning of the sign in a particular case. + Amount *int64 `json:"amount,omitempty" url:"amount,omitempty"` + // The type of currency, in **ISO 4217 format**. For example, the currency + // code for US dollars is `USD`. + // + // See [Currency](entity:Currency) for possible values. + // See [Currency](#type-currency) for possible values + Currency *Currency `json:"currency,omitempty" url:"currency,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListLocationsResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (m *Money) GetExtraProperties() map[string]interface{} { + return m.extraProperties } -func (l *ListLocationsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListLocationsResponse +func (m *Money) UnmarshalJSON(data []byte) error { + type unmarshaler Money var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListLocationsResponse(value) + *m = Money(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *m) if err != nil { return err } - l.extraProperties = extraProperties + m.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + m._rawJSON = json.RawMessage(data) return nil } -func (l *ListLocationsResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (m *Money) String() string { + if len(m._rawJSON) > 0 { + if value, err := core.StringifyJSON(m._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(m); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", m) } -// A request to list `LoyaltyProgram`. -type ListLoyaltyProgramsRequest struct { +// When you direct your user to the permissions form, you specify the +// scope of the permissions your application will have. Personal access tokens +// have all available permissions (at the time the application was created) by default. +// +// **Important:** Never request more than the minimum permissions required for your application +// to function properly. +type OAuthPermission string + +const ( + OAuthPermissionBankAccountsRead OAuthPermission = "BANK_ACCOUNTS_READ" + OAuthPermissionCashDrawerRead OAuthPermission = "CASH_DRAWER_READ" + OAuthPermissionCustomersRead OAuthPermission = "CUSTOMERS_READ" + OAuthPermissionCustomersWrite OAuthPermission = "CUSTOMERS_WRITE" + OAuthPermissionDeviceCredentialManagement OAuthPermission = "DEVICE_CREDENTIAL_MANAGEMENT" + OAuthPermissionEmployeesRead OAuthPermission = "EMPLOYEES_READ" + OAuthPermissionEmployeesWrite OAuthPermission = "EMPLOYEES_WRITE" + OAuthPermissionInventoryRead OAuthPermission = "INVENTORY_READ" + OAuthPermissionInventoryWrite OAuthPermission = "INVENTORY_WRITE" + OAuthPermissionItemsRead OAuthPermission = "ITEMS_READ" + OAuthPermissionItemsWrite OAuthPermission = "ITEMS_WRITE" + OAuthPermissionLoyaltyRead OAuthPermission = "LOYALTY_READ" + OAuthPermissionLoyaltyWrite OAuthPermission = "LOYALTY_WRITE" + OAuthPermissionMerchantProfileRead OAuthPermission = "MERCHANT_PROFILE_READ" + OAuthPermissionOrdersRead OAuthPermission = "ORDERS_READ" + OAuthPermissionOrdersWrite OAuthPermission = "ORDERS_WRITE" + OAuthPermissionPaymentsRead OAuthPermission = "PAYMENTS_READ" + OAuthPermissionPaymentsWrite OAuthPermission = "PAYMENTS_WRITE" + OAuthPermissionPaymentsWriteAdditionalRecipients OAuthPermission = "PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS" + OAuthPermissionPaymentsWriteInPerson OAuthPermission = "PAYMENTS_WRITE_IN_PERSON" + OAuthPermissionSettlementsRead OAuthPermission = "SETTLEMENTS_READ" + OAuthPermissionTimecardsRead OAuthPermission = "TIMECARDS_READ" + OAuthPermissionTimecardsWrite OAuthPermission = "TIMECARDS_WRITE" + OAuthPermissionTimecardsSettingsRead OAuthPermission = "TIMECARDS_SETTINGS_READ" + OAuthPermissionTimecardsSettingsWrite OAuthPermission = "TIMECARDS_SETTINGS_WRITE" + OAuthPermissionAppointmentsRead OAuthPermission = "APPOINTMENTS_READ" + OAuthPermissionAppointmentsWrite OAuthPermission = "APPOINTMENTS_WRITE" + OAuthPermissionAppointmentsBusinessSettingsRead OAuthPermission = "APPOINTMENTS_BUSINESS_SETTINGS_READ" + OAuthPermissionInvoicesRead OAuthPermission = "INVOICES_READ" + OAuthPermissionInvoicesWrite OAuthPermission = "INVOICES_WRITE" + OAuthPermissionSubscriptionsRead OAuthPermission = "SUBSCRIPTIONS_READ" + OAuthPermissionSubscriptionsWrite OAuthPermission = "SUBSCRIPTIONS_WRITE" + OAuthPermissionDisputesRead OAuthPermission = "DISPUTES_READ" + OAuthPermissionDisputesWrite OAuthPermission = "DISPUTES_WRITE" + OAuthPermissionGiftcardsRead OAuthPermission = "GIFTCARDS_READ" + OAuthPermissionGiftcardsWrite OAuthPermission = "GIFTCARDS_WRITE" + OAuthPermissionOnlineStoreSnippetsWrite OAuthPermission = "ONLINE_STORE_SNIPPETS_WRITE" + OAuthPermissionOnlineStoreSnippetsRead OAuthPermission = "ONLINE_STORE_SNIPPETS_READ" + OAuthPermissionOnlineStoreSiteRead OAuthPermission = "ONLINE_STORE_SITE_READ" + OAuthPermissionPaymentsWriteSharedOnfile OAuthPermission = "PAYMENTS_WRITE_SHARED_ONFILE" + OAuthPermissionAppointmentsAllRead OAuthPermission = "APPOINTMENTS_ALL_READ" + OAuthPermissionAppointmentsAllWrite OAuthPermission = "APPOINTMENTS_ALL_WRITE" + OAuthPermissionMerchantProfileWrite OAuthPermission = "MERCHANT_PROFILE_WRITE" + OAuthPermissionVendorRead OAuthPermission = "VENDOR_READ" + OAuthPermissionVendorWrite OAuthPermission = "VENDOR_WRITE" + OAuthPermissionPayoutsRead OAuthPermission = "PAYOUTS_READ" + OAuthPermissionReservationsRead OAuthPermission = "RESERVATIONS_READ" + OAuthPermissionReservationsWrite OAuthPermission = "RESERVATIONS_WRITE" + OAuthPermissionRestaurantChecksRead OAuthPermission = "RESTAURANT_CHECKS_READ" + OAuthPermissionDevicesRead OAuthPermission = "DEVICES_READ" + OAuthPermissionChannelsRead OAuthPermission = "CHANNELS_READ" + OAuthPermissionChannelsCreate OAuthPermission = "CHANNELS_CREATE" + OAuthPermissionChannelsUpdate OAuthPermission = "CHANNELS_UPDATE" + OAuthPermissionAddonConfigurationsRead OAuthPermission = "ADDON_CONFIGURATIONS_READ" + OAuthPermissionAddonConfigurationsWrite OAuthPermission = "ADDON_CONFIGURATIONS_WRITE" + OAuthPermissionPermissionSetsRead OAuthPermission = "PERMISSION_SETS_READ" + OAuthPermissionPermissionSetsWrite OAuthPermission = "PERMISSION_SETS_WRITE" +) + +func NewOAuthPermissionFromString(s string) (OAuthPermission, error) { + switch s { + case "BANK_ACCOUNTS_READ": + return OAuthPermissionBankAccountsRead, nil + case "CASH_DRAWER_READ": + return OAuthPermissionCashDrawerRead, nil + case "CUSTOMERS_READ": + return OAuthPermissionCustomersRead, nil + case "CUSTOMERS_WRITE": + return OAuthPermissionCustomersWrite, nil + case "DEVICE_CREDENTIAL_MANAGEMENT": + return OAuthPermissionDeviceCredentialManagement, nil + case "EMPLOYEES_READ": + return OAuthPermissionEmployeesRead, nil + case "EMPLOYEES_WRITE": + return OAuthPermissionEmployeesWrite, nil + case "INVENTORY_READ": + return OAuthPermissionInventoryRead, nil + case "INVENTORY_WRITE": + return OAuthPermissionInventoryWrite, nil + case "ITEMS_READ": + return OAuthPermissionItemsRead, nil + case "ITEMS_WRITE": + return OAuthPermissionItemsWrite, nil + case "LOYALTY_READ": + return OAuthPermissionLoyaltyRead, nil + case "LOYALTY_WRITE": + return OAuthPermissionLoyaltyWrite, nil + case "MERCHANT_PROFILE_READ": + return OAuthPermissionMerchantProfileRead, nil + case "ORDERS_READ": + return OAuthPermissionOrdersRead, nil + case "ORDERS_WRITE": + return OAuthPermissionOrdersWrite, nil + case "PAYMENTS_READ": + return OAuthPermissionPaymentsRead, nil + case "PAYMENTS_WRITE": + return OAuthPermissionPaymentsWrite, nil + case "PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS": + return OAuthPermissionPaymentsWriteAdditionalRecipients, nil + case "PAYMENTS_WRITE_IN_PERSON": + return OAuthPermissionPaymentsWriteInPerson, nil + case "SETTLEMENTS_READ": + return OAuthPermissionSettlementsRead, nil + case "TIMECARDS_READ": + return OAuthPermissionTimecardsRead, nil + case "TIMECARDS_WRITE": + return OAuthPermissionTimecardsWrite, nil + case "TIMECARDS_SETTINGS_READ": + return OAuthPermissionTimecardsSettingsRead, nil + case "TIMECARDS_SETTINGS_WRITE": + return OAuthPermissionTimecardsSettingsWrite, nil + case "APPOINTMENTS_READ": + return OAuthPermissionAppointmentsRead, nil + case "APPOINTMENTS_WRITE": + return OAuthPermissionAppointmentsWrite, nil + case "APPOINTMENTS_BUSINESS_SETTINGS_READ": + return OAuthPermissionAppointmentsBusinessSettingsRead, nil + case "INVOICES_READ": + return OAuthPermissionInvoicesRead, nil + case "INVOICES_WRITE": + return OAuthPermissionInvoicesWrite, nil + case "SUBSCRIPTIONS_READ": + return OAuthPermissionSubscriptionsRead, nil + case "SUBSCRIPTIONS_WRITE": + return OAuthPermissionSubscriptionsWrite, nil + case "DISPUTES_READ": + return OAuthPermissionDisputesRead, nil + case "DISPUTES_WRITE": + return OAuthPermissionDisputesWrite, nil + case "GIFTCARDS_READ": + return OAuthPermissionGiftcardsRead, nil + case "GIFTCARDS_WRITE": + return OAuthPermissionGiftcardsWrite, nil + case "ONLINE_STORE_SNIPPETS_WRITE": + return OAuthPermissionOnlineStoreSnippetsWrite, nil + case "ONLINE_STORE_SNIPPETS_READ": + return OAuthPermissionOnlineStoreSnippetsRead, nil + case "ONLINE_STORE_SITE_READ": + return OAuthPermissionOnlineStoreSiteRead, nil + case "PAYMENTS_WRITE_SHARED_ONFILE": + return OAuthPermissionPaymentsWriteSharedOnfile, nil + case "APPOINTMENTS_ALL_READ": + return OAuthPermissionAppointmentsAllRead, nil + case "APPOINTMENTS_ALL_WRITE": + return OAuthPermissionAppointmentsAllWrite, nil + case "MERCHANT_PROFILE_WRITE": + return OAuthPermissionMerchantProfileWrite, nil + case "VENDOR_READ": + return OAuthPermissionVendorRead, nil + case "VENDOR_WRITE": + return OAuthPermissionVendorWrite, nil + case "PAYOUTS_READ": + return OAuthPermissionPayoutsRead, nil + case "RESERVATIONS_READ": + return OAuthPermissionReservationsRead, nil + case "RESERVATIONS_WRITE": + return OAuthPermissionReservationsWrite, nil + case "RESTAURANT_CHECKS_READ": + return OAuthPermissionRestaurantChecksRead, nil + case "DEVICES_READ": + return OAuthPermissionDevicesRead, nil + case "CHANNELS_READ": + return OAuthPermissionChannelsRead, nil + case "CHANNELS_CREATE": + return OAuthPermissionChannelsCreate, nil + case "CHANNELS_UPDATE": + return OAuthPermissionChannelsUpdate, nil + case "ADDON_CONFIGURATIONS_READ": + return OAuthPermissionAddonConfigurationsRead, nil + case "ADDON_CONFIGURATIONS_WRITE": + return OAuthPermissionAddonConfigurationsWrite, nil + case "PERMISSION_SETS_READ": + return OAuthPermissionPermissionSetsRead, nil + case "PERMISSION_SETS_WRITE": + return OAuthPermissionPermissionSetsWrite, nil + } + var t OAuthPermission + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (o OAuthPermission) Ptr() *OAuthPermission { + return &o +} + +// Published when a merchant/application revokes all access tokens and refresh tokens granted to an application. +type OauthAuthorizationRevokedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents, `"oauth.authorization.revoked"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *OauthAuthorizationRevokedEventData `json:"data,omitempty" url:"data,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListLoyaltyProgramsRequest) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OauthAuthorizationRevokedEvent) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListLoyaltyProgramsRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListLoyaltyProgramsRequest +func (o *OauthAuthorizationRevokedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler OauthAuthorizationRevokedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListLoyaltyProgramsRequest(value) + *o = OauthAuthorizationRevokedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListLoyaltyProgramsRequest) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OauthAuthorizationRevokedEvent) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// A response that contains all loyalty programs. -type ListLoyaltyProgramsResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // A list of `LoyaltyProgram` for the merchant. - Programs []*LoyaltyProgram `json:"programs,omitempty" url:"programs,omitempty"` +type OauthAuthorizationRevokedEventData struct { + // Name of the affected object’s type, `"revocation"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // Not applicable, revocation is not an object + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing information about revocation event. + Object *OauthAuthorizationRevokedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListLoyaltyProgramsResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OauthAuthorizationRevokedEventData) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListLoyaltyProgramsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListLoyaltyProgramsResponse +func (o *OauthAuthorizationRevokedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler OauthAuthorizationRevokedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListLoyaltyProgramsResponse(value) + *o = OauthAuthorizationRevokedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListLoyaltyProgramsResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OauthAuthorizationRevokedEventData) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Represents a [ListLoyaltyPromotions]($e/Loyalty/ListLoyaltyPromotions) request. -type ListLoyaltyPromotionsRequest struct { - // The status to filter the results by. If a status is provided, only loyalty promotions - // with the specified status are returned. Otherwise, all loyalty promotions associated with - // the loyalty program are returned. - // See [LoyaltyPromotionStatus](#type-loyaltypromotionstatus) for possible values - Status *LoyaltyPromotionStatus `json:"status,omitempty" url:"status,omitempty"` - // The cursor returned in the paged response from the previous call to this endpoint. - // Provide this cursor to retrieve the next page of results for your original request. - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // The maximum number of results to return in a single paged response. - // The minimum value is 1 and the maximum value is 30. The default value is 30. - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Limit *int `json:"limit,omitempty" url:"limit,omitempty"` +type OauthAuthorizationRevokedEventObject struct { + // The revocation event. + Revocation *OauthAuthorizationRevokedEventRevocationObject `json:"revocation,omitempty" url:"revocation,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListLoyaltyPromotionsRequest) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OauthAuthorizationRevokedEventObject) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListLoyaltyPromotionsRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListLoyaltyPromotionsRequest +func (o *OauthAuthorizationRevokedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler OauthAuthorizationRevokedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListLoyaltyPromotionsRequest(value) + *o = OauthAuthorizationRevokedEventObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListLoyaltyPromotionsRequest) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OauthAuthorizationRevokedEventObject) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Represents a [ListLoyaltyPromotions]($e/Loyalty/ListLoyaltyPromotions) response. -// One of `loyalty_promotions`, an empty object, or `errors` is present in the response. -// If additional results are available, the `cursor` field is also present along with `loyalty_promotions`. -type ListLoyaltyPromotionsResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The retrieved loyalty promotions. - LoyaltyPromotions []*LoyaltyPromotion `json:"loyalty_promotions,omitempty" url:"loyalty_promotions,omitempty"` - // The cursor to use in your next call to this endpoint to retrieve the next page of results - // for your original request. This field is present only if the request succeeded and additional - // results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` +type OauthAuthorizationRevokedEventRevocationObject struct { + // Timestamp of when the revocation event occurred, in RFC 3339 format. + RevokedAt *string `json:"revoked_at,omitempty" url:"revoked_at,omitempty"` + // Type of client that performed the revocation, either APPLICATION, MERCHANT, or SQUARE. + // See [OauthAuthorizationRevokedEventRevokerType](#type-oauthauthorizationrevokedeventrevokertype) for possible values + RevokerType *OauthAuthorizationRevokedEventRevokerType `json:"revoker_type,omitempty" url:"revoker_type,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListLoyaltyPromotionsResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OauthAuthorizationRevokedEventRevocationObject) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListLoyaltyPromotionsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListLoyaltyPromotionsResponse +func (o *OauthAuthorizationRevokedEventRevocationObject) UnmarshalJSON(data []byte) error { + type unmarshaler OauthAuthorizationRevokedEventRevocationObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListLoyaltyPromotionsResponse(value) + *o = OauthAuthorizationRevokedEventRevocationObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListLoyaltyPromotionsResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OauthAuthorizationRevokedEventRevocationObject) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) +} + +// Defines the possible types for the revoking client. +type OauthAuthorizationRevokedEventRevokerType string + +const ( + OauthAuthorizationRevokedEventRevokerTypeApplication OauthAuthorizationRevokedEventRevokerType = "APPLICATION" + OauthAuthorizationRevokedEventRevokerTypeMerchant OauthAuthorizationRevokedEventRevokerType = "MERCHANT" + OauthAuthorizationRevokedEventRevokerTypeSquare OauthAuthorizationRevokedEventRevokerType = "SQUARE" +) + +func NewOauthAuthorizationRevokedEventRevokerTypeFromString(s string) (OauthAuthorizationRevokedEventRevokerType, error) { + switch s { + case "APPLICATION": + return OauthAuthorizationRevokedEventRevokerTypeApplication, nil + case "MERCHANT": + return OauthAuthorizationRevokedEventRevokerTypeMerchant, nil + case "SQUARE": + return OauthAuthorizationRevokedEventRevokerTypeSquare, nil + } + var t OauthAuthorizationRevokedEventRevokerType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (o OauthAuthorizationRevokedEventRevokerType) Ptr() *OauthAuthorizationRevokedEventRevokerType { + return &o } -// Represents a [ListMerchantCustomAttributeDefinitions]($e/MerchantCustomAttributes/ListMerchantCustomAttributeDefinitions) response. -// Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response. -// If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`. -type ListMerchantCustomAttributeDefinitionsResponse struct { - // The retrieved custom attribute definitions. If no custom attribute definitions are found, - // Square returns an empty object (`{}`). - CustomAttributeDefinitions []*CustomAttributeDefinition `json:"custom_attribute_definitions,omitempty" url:"custom_attribute_definitions,omitempty"` - // The cursor to provide in your next call to this endpoint to retrieve the next page of - // results for your original request. This field is present only if the request succeeded and - // additional results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` +type ObtainTokenResponse struct { + // A valid OAuth access token. + // Provide the access token in a header with every request to Connect API + // endpoints. For more information, see [OAuth API: Walkthrough](https://developer.squareup.com/docs/oauth-api/walkthrough). + AccessToken *string `json:"access_token,omitempty" url:"access_token,omitempty"` + // This value is always _bearer_. + TokenType *string `json:"token_type,omitempty" url:"token_type,omitempty"` + // The date when the `access_token` expires, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm) format. + ExpiresAt *string `json:"expires_at,omitempty" url:"expires_at,omitempty"` + // The ID of the authorizing merchant's business. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // **LEGACY FIELD**. The ID of a subscription plan the merchant signed up + // for. The ID is only present if the merchant signed up for a subscription plan during authorization. + SubscriptionID *string `json:"subscription_id,omitempty" url:"subscription_id,omitempty"` + // **LEGACY FIELD**. The ID of the subscription plan the merchant signed + // up for. The ID is only present if the merchant signed up for a subscription plan during + // authorization. + PlanID *string `json:"plan_id,omitempty" url:"plan_id,omitempty"` + // The OpenID token belonging to this person. This token is only present if the + // OPENID scope is included in the authorization request. + IDToken *string `json:"id_token,omitempty" url:"id_token,omitempty"` + // A refresh token. + // For more information, see [Refresh, Revoke, and Limit the Scope of OAuth Tokens](https://developer.squareup.com/docs/oauth-api/refresh-revoke-limit-scope). + RefreshToken *string `json:"refresh_token,omitempty" url:"refresh_token,omitempty"` + // A Boolean indicating that the access token is a short-lived access token. + // The short-lived access token returned in the response expires in 24 hours. + ShortLived *bool `json:"short_lived,omitempty" url:"short_lived,omitempty"` // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The date when the `refresh_token` expires, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm) format. + RefreshTokenExpiresAt *string `json:"refresh_token_expires_at,omitempty" url:"refresh_token_expires_at,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListMerchantCustomAttributeDefinitionsResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *ObtainTokenResponse) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListMerchantCustomAttributeDefinitionsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListMerchantCustomAttributeDefinitionsResponse +func (o *ObtainTokenResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ObtainTokenResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListMerchantCustomAttributeDefinitionsResponse(value) + *o = ObtainTokenResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListMerchantCustomAttributeDefinitionsResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *ObtainTokenResponse) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Represents a [ListMerchantCustomAttributes]($e/MerchantCustomAttributes/ListMerchantCustomAttributes) response. -// Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional -// results are available, the `cursor` field is also present along with `custom_attributes`. -type ListMerchantCustomAttributesResponse struct { - // The retrieved custom attributes. If `with_definitions` was set to `true` in the request, - // the custom attribute definition is returned in the `definition` field of each custom attribute. - // If no custom attributes are found, Square returns an empty object (`{}`). - CustomAttributes []*CustomAttribute `json:"custom_attributes,omitempty" url:"custom_attributes,omitempty"` - // The cursor to use in your next call to this endpoint to retrieve the next page of results - // for your original request. This field is present only if the request succeeded and additional - // results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Details specific to offline payments. +type OfflinePaymentDetails struct { + // The client-side timestamp of when the offline payment was created, in RFC 3339 format. + ClientCreatedAt *string `json:"client_created_at,omitempty" url:"client_created_at,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListMerchantCustomAttributesResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OfflinePaymentDetails) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListMerchantCustomAttributesResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListMerchantCustomAttributesResponse +func (o *OfflinePaymentDetails) UnmarshalJSON(data []byte) error { + type unmarshaler OfflinePaymentDetails var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListMerchantCustomAttributesResponse(value) + *o = OfflinePaymentDetails(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListMerchantCustomAttributesResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OfflinePaymentDetails) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Request object for the [ListMerchant]($e/Merchants/ListMerchants) endpoint. -type ListMerchantsRequest struct { - // The cursor generated by the previous response. - Cursor *int `json:"cursor,omitempty" url:"cursor,omitempty"` +// Contains all information related to a single order to process with Square, +// including line items that specify the products to purchase. `Order` objects also +// include information about any associated tenders, refunds, and returns. +// +// All Connect V2 Transactions have all been converted to Orders including all associated +// itemization data. +type Order struct { + // The order's unique ID. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The ID of the seller location that this order is associated with. + LocationID string `json:"location_id" url:"location_id"` + // A client-specified ID to associate an entity in another system + // with this order. + ReferenceID *string `json:"reference_id,omitempty" url:"reference_id,omitempty"` + // The origination details of the order. + Source *OrderSource `json:"source,omitempty" url:"source,omitempty"` + // The ID of the [customer](entity:Customer) associated with the order. + // + // You should specify a `customer_id` on the order (or the payment) to ensure that transactions + // are reliably linked to customers. Omitting this field might result in the creation of new + // [instant profiles](https://developer.squareup.com/docs/customers-api/what-it-does#instant-profiles). + CustomerID *string `json:"customer_id,omitempty" url:"customer_id,omitempty"` + // The line items included in the order. + LineItems []*OrderLineItem `json:"line_items,omitempty" url:"line_items,omitempty"` + // The list of all taxes associated with the order. + // + // Taxes can be scoped to either `ORDER` or `LINE_ITEM`. For taxes with `LINE_ITEM` scope, an + // `OrderLineItemAppliedTax` must be added to each line item that the tax applies to. For taxes + // with `ORDER` scope, the server generates an `OrderLineItemAppliedTax` for every line item. + // + // On reads, each tax in the list includes the total amount of that tax applied to the order. + // + // **IMPORTANT**: If `LINE_ITEM` scope is set on any taxes in this field, using the deprecated + // `line_items.taxes` field results in an error. Use `line_items.applied_taxes` + // instead. + Taxes []*OrderLineItemTax `json:"taxes,omitempty" url:"taxes,omitempty"` + // The list of all discounts associated with the order. + // + // Discounts can be scoped to either `ORDER` or `LINE_ITEM`. For discounts scoped to `LINE_ITEM`, + // an `OrderLineItemAppliedDiscount` must be added to each line item that the discount applies to. + // For discounts with `ORDER` scope, the server generates an `OrderLineItemAppliedDiscount` + // for every line item. + // + // **IMPORTANT**: If `LINE_ITEM` scope is set on any discounts in this field, using the deprecated + // `line_items.discounts` field results in an error. Use `line_items.applied_discounts` + // instead. + Discounts []*OrderLineItemDiscount `json:"discounts,omitempty" url:"discounts,omitempty"` + // A list of service charges applied to the order. + ServiceCharges []*OrderServiceCharge `json:"service_charges,omitempty" url:"service_charges,omitempty"` + // Details about order fulfillment. + // + // Orders can only be created with at most one fulfillment. However, orders returned + // by the API might contain multiple fulfillments. + Fulfillments []*Fulfillment `json:"fulfillments,omitempty" url:"fulfillments,omitempty"` + // A collection of items from sale orders being returned in this one. Normally part of an + // itemized return or exchange. There is exactly one `Return` object per sale `Order` being + // referenced. + Returns []*OrderReturn `json:"returns,omitempty" url:"returns,omitempty"` + // The rollup of the returned money amounts. + ReturnAmounts *OrderMoneyAmounts `json:"return_amounts,omitempty" url:"return_amounts,omitempty"` + // The net money amounts (sale money - return money). + NetAmounts *OrderMoneyAmounts `json:"net_amounts,omitempty" url:"net_amounts,omitempty"` + // A positive rounding adjustment to the total of the order. This adjustment is commonly + // used to apply cash rounding when the minimum unit of account is smaller than the lowest physical + // denomination of the currency. + RoundingAdjustment *OrderRoundingAdjustment `json:"rounding_adjustment,omitempty" url:"rounding_adjustment,omitempty"` + // The tenders that were used to pay for the order. + Tenders []*Tender `json:"tenders,omitempty" url:"tenders,omitempty"` + // The refunds that are part of this order. + Refunds []*Refund `json:"refunds,omitempty" url:"refunds,omitempty"` + // Application-defined data attached to this order. Metadata fields are intended + // to store descriptive references or associations with an entity in another system or store brief + // information about the object. Square does not process this field; it only stores and returns it + // in relevant API calls. Do not use metadata to store any sensitive information (such as personally + // identifiable information or card details). + // + // Keys written by applications must be 60 characters or less and must be in the character set + // `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed + // with a namespace, separated from the key with a ':' character. + // + // Values have a maximum length of 255 characters. + // + // An application can have up to 10 entries per metadata field. + // + // Entries written by applications are private and can only be read or modified by the same + // application. + // + // For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). + Metadata map[string]*string `json:"metadata,omitempty" url:"metadata,omitempty"` + // The timestamp for when the order was created, at server side, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The timestamp for when the order was last updated, at server side, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // The timestamp for when the order reached a terminal [state](entity:OrderState), in RFC 3339 format (for example "2016-09-04T23:59:33.123Z"). + ClosedAt *string `json:"closed_at,omitempty" url:"closed_at,omitempty"` + // The current state of the order. + // See [OrderState](#type-orderstate) for possible values + State *OrderState `json:"state,omitempty" url:"state,omitempty"` + // The version number, which is incremented each time an update is committed to the order. + // Orders not created through the API do not include a version number and + // therefore cannot be updated. + // + // [Read more about working with versions](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders). + Version *int `json:"version,omitempty" url:"version,omitempty"` + // The total amount of money to collect for the order. + TotalMoney *Money `json:"total_money,omitempty" url:"total_money,omitempty"` + // The total amount of tax money to collect for the order. + TotalTaxMoney *Money `json:"total_tax_money,omitempty" url:"total_tax_money,omitempty"` + // The total amount of discount money to collect for the order. + TotalDiscountMoney *Money `json:"total_discount_money,omitempty" url:"total_discount_money,omitempty"` + // The total amount of tip money to collect for the order. + TotalTipMoney *Money `json:"total_tip_money,omitempty" url:"total_tip_money,omitempty"` + // The total amount of money collected in service charges for the order. + // + // Note: `total_service_charge_money` is the sum of `applied_money` fields for each individual + // service charge. Therefore, `total_service_charge_money` only includes inclusive tax amounts, + // not additive tax amounts. + TotalServiceChargeMoney *Money `json:"total_service_charge_money,omitempty" url:"total_service_charge_money,omitempty"` + // A short-term identifier for the order (such as a customer first name, + // table number, or auto-generated order number that resets daily). + TicketName *string `json:"ticket_name,omitempty" url:"ticket_name,omitempty"` + // Pricing options for an order. The options affect how the order's price is calculated. + // They can be used, for example, to apply automatic price adjustments that are based on + // preconfigured [pricing rules](entity:CatalogPricingRule). + PricingOptions *OrderPricingOptions `json:"pricing_options,omitempty" url:"pricing_options,omitempty"` + // A set-like list of Rewards that have been added to the Order. + Rewards []*OrderReward `json:"rewards,omitempty" url:"rewards,omitempty"` + // The net amount of money due on the order. + NetAmountDueMoney *Money `json:"net_amount_due_money,omitempty" url:"net_amount_due_money,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListMerchantsRequest) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *Order) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListMerchantsRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListMerchantsRequest +func (o *Order) UnmarshalJSON(data []byte) error { + type unmarshaler Order var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListMerchantsRequest(value) + *o = Order(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListMerchantsRequest) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *Order) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// The response object returned by the [ListMerchant]($e/Merchants/ListMerchants) endpoint. -type ListMerchantsResponse struct { - // Information on errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The requested `Merchant` entities. - Merchant []*Merchant `json:"merchant,omitempty" url:"merchant,omitempty"` - // If the response is truncated, the cursor to use in next request to fetch next set of objects. - Cursor *int `json:"cursor,omitempty" url:"cursor,omitempty"` +type OrderCreated struct { + // The order's unique ID. + OrderID *string `json:"order_id,omitempty" url:"order_id,omitempty"` + // The version number, which is incremented each time an update is committed to the order. + // Orders that were not created through the API do not include a version number and + // therefore cannot be updated. + // + // [Read more about working with versions.](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders) + Version *int `json:"version,omitempty" url:"version,omitempty"` + // The ID of the seller location that this order is associated with. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The state of the order. + // See [OrderState](#type-orderstate) for possible values + State *OrderState `json:"state,omitempty" url:"state,omitempty"` + // The timestamp for when the order was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListMerchantsResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderCreated) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListMerchantsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListMerchantsResponse +func (o *OrderCreated) UnmarshalJSON(data []byte) error { + type unmarshaler OrderCreated var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListMerchantsResponse(value) + *o = OrderCreated(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListMerchantsResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderCreated) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Represents a response from listing order custom attribute definitions. -type ListOrderCustomAttributeDefinitionsResponse struct { - // The retrieved custom attribute definitions. If no custom attribute definitions are found, Square returns an empty object (`{}`). - CustomAttributeDefinitions []*CustomAttributeDefinition `json:"custom_attribute_definitions,omitempty" url:"custom_attribute_definitions,omitempty"` - // The cursor to provide in your next call to this endpoint to retrieve the next page of results for your original request. - // This field is present only if the request succeeded and additional results are available. - // For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Published when an [Order](entity:Order) is created. This event is +// triggered only by the [CreateOrder](api-endpoint:Orders-CreateOrder) endpoint call. +// +// Creating an order in the Point of Sale app will **not** publish this event. +type OrderCreatedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents, `"order.created"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *OrderCreatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListOrderCustomAttributeDefinitionsResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderCreatedEvent) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListOrderCustomAttributeDefinitionsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListOrderCustomAttributeDefinitionsResponse +func (o *OrderCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler OrderCreatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListOrderCustomAttributeDefinitionsResponse(value) + *o = OrderCreatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListOrderCustomAttributeDefinitionsResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderCreatedEvent) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Represents a response from listing order custom attributes. -type ListOrderCustomAttributesResponse struct { - // The retrieved custom attributes. If no custom attribute are found, Square returns an empty object (`{}`). - CustomAttributes []*CustomAttribute `json:"custom_attributes,omitempty" url:"custom_attributes,omitempty"` - // The cursor to provide in your next call to this endpoint to retrieve the next page of results for your original request. - // This field is present only if the request succeeded and additional results are available. - // For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +type OrderCreatedEventData struct { + // Name of the affected object’s type, `"order_created"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the affected order. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing information about the created Order. + Object *OrderCreatedObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListOrderCustomAttributesResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderCreatedEventData) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListOrderCustomAttributesResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListOrderCustomAttributesResponse +func (o *OrderCreatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler OrderCreatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListOrderCustomAttributesResponse(value) + *o = OrderCreatedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListOrderCustomAttributesResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderCreatedEventData) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -type ListPaymentLinksRequest struct { - // A pagination cursor returned by a previous call to this endpoint. - // Provide this cursor to retrieve the next set of results for the original query. - // If a cursor is not provided, the endpoint returns the first page of the results. - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // A limit on the number of results to return per page. The limit is advisory and - // the implementation might return more or less results. If the supplied limit is negative, zero, or - // greater than the maximum limit of 1000, it is ignored. - // - // Default value: `100` - Limit *int `json:"limit,omitempty" url:"limit,omitempty"` +type OrderCreatedObject struct { + // Information about the created order. + OrderCreated *OrderCreated `json:"order_created,omitempty" url:"order_created,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListPaymentLinksRequest) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderCreatedObject) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListPaymentLinksRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListPaymentLinksRequest +func (o *OrderCreatedObject) UnmarshalJSON(data []byte) error { + type unmarshaler OrderCreatedObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListPaymentLinksRequest(value) + *o = OrderCreatedObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListPaymentLinksRequest) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderCreatedObject) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -type ListPaymentLinksResponse struct { - // Errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The list of payment links. - PaymentLinks []*PaymentLink `json:"payment_links,omitempty" url:"payment_links,omitempty"` - // When a response is truncated, it includes a cursor that you can use in a subsequent request - // to retrieve the next set of gift cards. If a cursor is not present, this is the final response. - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` +// Published when an order [custom attribute definition](entity:CustomAttributeDefinition) that is owned by the subscribing app is created. +type OrderCustomAttributeDefinitionOwnedCreatedEvent struct { + // The ID of the target seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"order.custom_attribute_definition.owned.created"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListPaymentLinksResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderCustomAttributeDefinitionOwnedCreatedEvent) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListPaymentLinksResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListPaymentLinksResponse +func (o *OrderCustomAttributeDefinitionOwnedCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler OrderCustomAttributeDefinitionOwnedCreatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListPaymentLinksResponse(value) + *o = OrderCustomAttributeDefinitionOwnedCreatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListPaymentLinksResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderCustomAttributeDefinitionOwnedCreatedEvent) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value - } - return fmt.Sprintf("%#v", l) -} - -// Describes a request to list refunds using -// [ListPaymentRefunds]($e/Refunds/ListPaymentRefunds). -// -// The maximum results per page is 100. -type ListPaymentRefundsRequest struct { - // Indicates the start of the time range to retrieve each `PaymentRefund` for, in RFC 3339 - // format. The range is determined using the `created_at` field for each `PaymentRefund`. - // - // Default: The current time minus one year. - BeginTime *string `json:"begin_time,omitempty" url:"begin_time,omitempty"` - // Indicates the end of the time range to retrieve each `PaymentRefund` for, in RFC 3339 - // format. The range is determined using the `created_at` field for each `PaymentRefund`. - // - // Default: The current time. - EndTime *string `json:"end_time,omitempty" url:"end_time,omitempty"` - // The order in which results are listed by `PaymentRefund.created_at`: - // - // - `ASC` - Oldest to newest. - // - `DESC` - Newest to oldest (default). - SortOrder *string `json:"sort_order,omitempty" url:"sort_order,omitempty"` - // A pagination cursor returned by a previous call to this endpoint. - // Provide this cursor to retrieve the next set of results for the original query. - // - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // Limit results to the location supplied. By default, results are returned - // for all locations associated with the seller. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` - // If provided, only refunds with the given status are returned. - // For a list of refund status values, see [PaymentRefund](entity:PaymentRefund). - // - // Default: If omitted, refunds are returned regardless of their status. - Status *string `json:"status,omitempty" url:"status,omitempty"` - // If provided, only returns refunds whose payments have the indicated source type. - // Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `CASH`, and `EXTERNAL`. - // For information about these payment source types, see - // [Take Payments](https://developer.squareup.com/docs/payments-api/take-payments). - // - // Default: If omitted, refunds are returned regardless of the source type. - SourceType *string `json:"source_type,omitempty" url:"source_type,omitempty"` - // The maximum number of results to be returned in a single page. - // - // It is possible to receive fewer results than the specified limit on a given page. - // - // If the supplied value is greater than 100, no more than 100 results are returned. - // - // Default: 100 - Limit *int `json:"limit,omitempty" url:"limit,omitempty"` + } + return fmt.Sprintf("%#v", o) +} + +// Published when an order [custom attribute definition](entity:CustomAttributeDefinition) that is owned by the subscribing app is deleted. +type OrderCustomAttributeDefinitionOwnedDeletedEvent struct { + // The ID of the target seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"order.custom_attribute_definition.owned.deleted"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListPaymentRefundsRequest) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderCustomAttributeDefinitionOwnedDeletedEvent) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListPaymentRefundsRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListPaymentRefundsRequest +func (o *OrderCustomAttributeDefinitionOwnedDeletedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler OrderCustomAttributeDefinitionOwnedDeletedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListPaymentRefundsRequest(value) + *o = OrderCustomAttributeDefinitionOwnedDeletedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListPaymentRefundsRequest) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderCustomAttributeDefinitionOwnedDeletedEvent) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Defines the response returned by [ListPaymentRefunds]($e/Refunds/ListPaymentRefunds). -// -// Either `errors` or `refunds` is present in a given response (never both). -type ListPaymentRefundsResponse struct { - // Information about errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The list of requested refunds. - Refunds []*PaymentRefund `json:"refunds,omitempty" url:"refunds,omitempty"` - // The pagination cursor to be used in a subsequent request. If empty, - // this is the final response. - // - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` +// Published when an order [custom attribute definition](entity:CustomAttributeDefinition) that is owned by the subscribing app is updated. +type OrderCustomAttributeDefinitionOwnedUpdatedEvent struct { + // The ID of the target seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"order.custom_attribute_definition.owned.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListPaymentRefundsResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderCustomAttributeDefinitionOwnedUpdatedEvent) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListPaymentRefundsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListPaymentRefundsResponse +func (o *OrderCustomAttributeDefinitionOwnedUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler OrderCustomAttributeDefinitionOwnedUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListPaymentRefundsResponse(value) + *o = OrderCustomAttributeDefinitionOwnedUpdatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListPaymentRefundsResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderCustomAttributeDefinitionOwnedUpdatedEvent) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Describes a request to list payments using -// [ListPayments]($e/Payments/ListPayments). -// -// The maximum results per page is 100. -type ListPaymentsRequest struct { - // Indicates the start of the time range to retrieve payments for, in RFC 3339 format. - // The range is determined using the `created_at` field for each Payment. - // Inclusive. Default: The current time minus one year. - BeginTime *string `json:"begin_time,omitempty" url:"begin_time,omitempty"` - // Indicates the end of the time range to retrieve payments for, in RFC 3339 format. The - // range is determined using the `created_at` field for each Payment. - // - // Default: The current time. - EndTime *string `json:"end_time,omitempty" url:"end_time,omitempty"` - // The order in which results are listed by `Payment.created_at`: - // - // - `ASC` - Oldest to newest. - // - `DESC` - Newest to oldest (default). - SortOrder *string `json:"sort_order,omitempty" url:"sort_order,omitempty"` - // A pagination cursor returned by a previous call to this endpoint. - // Provide this cursor to retrieve the next set of results for the original query. - // - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // Limit results to the location supplied. By default, results are returned - // for the default (main) location associated with the seller. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` - // The exact amount in the `total_money` for a payment. - Total *int64 `json:"total,omitempty" url:"total,omitempty"` - // The last four digits of a payment card. - Last4 *string `json:"last_4,omitempty" url:"last_4,omitempty"` - // The brand of the payment card (for example, VISA). - CardBrand *string `json:"card_brand,omitempty" url:"card_brand,omitempty"` - // The maximum number of results to be returned in a single page. - // It is possible to receive fewer results than the specified limit on a given page. - // - // The default value of 100 is also the maximum allowed value. If the provided value is - // greater than 100, it is ignored and the default value is used instead. - // - // Default: `100` - Limit *int `json:"limit,omitempty" url:"limit,omitempty"` - // Whether the payment was taken offline or not. - IsOfflinePayment *bool `json:"is_offline_payment,omitempty" url:"is_offline_payment,omitempty"` - // Indicates the start of the time range for which to retrieve offline payments, in RFC 3339 - // format for timestamps. The range is determined using the - // `offline_payment_details.client_created_at` field for each Payment. If set, payments without a - // value set in `offline_payment_details.client_created_at` will not be returned. - // - // Default: The current time. - OfflineBeginTime *string `json:"offline_begin_time,omitempty" url:"offline_begin_time,omitempty"` - // Indicates the end of the time range for which to retrieve offline payments, in RFC 3339 - // format for timestamps. The range is determined using the - // `offline_payment_details.client_created_at` field for each Payment. If set, payments without a - // value set in `offline_payment_details.client_created_at` will not be returned. - // - // Default: The current time. - OfflineEndTime *string `json:"offline_end_time,omitempty" url:"offline_end_time,omitempty"` +// Published when an order [custom attribute definition](entity:CustomAttributeDefinition) that is visible to the subscribing app is created. +type OrderCustomAttributeDefinitionVisibleCreatedEvent struct { + // The ID of the target seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"order.custom_attribute_definition.visible.created"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListPaymentsRequest) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderCustomAttributeDefinitionVisibleCreatedEvent) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListPaymentsRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListPaymentsRequest +func (o *OrderCustomAttributeDefinitionVisibleCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler OrderCustomAttributeDefinitionVisibleCreatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListPaymentsRequest(value) + *o = OrderCustomAttributeDefinitionVisibleCreatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListPaymentsRequest) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderCustomAttributeDefinitionVisibleCreatedEvent) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Defines the response returned by [ListPayments]($e/Payments/ListPayments). -type ListPaymentsResponse struct { - // Information about errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The requested list of payments. - Payments []*Payment `json:"payments,omitempty" url:"payments,omitempty"` - // The pagination cursor to be used in a subsequent request. If empty, - // this is the final response. - // - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` +// Published when an order [custom attribute definition](entity:CustomAttributeDefinition) that is visible to the subscribing app is deleted. +type OrderCustomAttributeDefinitionVisibleDeletedEvent struct { + // The ID of the target seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"order.custom_attribute_definition.visible.deleted"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListPaymentsResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderCustomAttributeDefinitionVisibleDeletedEvent) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListPaymentsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListPaymentsResponse +func (o *OrderCustomAttributeDefinitionVisibleDeletedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler OrderCustomAttributeDefinitionVisibleDeletedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListPaymentsResponse(value) + *o = OrderCustomAttributeDefinitionVisibleDeletedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListPaymentsResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderCustomAttributeDefinitionVisibleDeletedEvent) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -type ListPayoutEntriesRequest struct { - // The order in which payout entries are listed. - // See [SortOrder](#type-sortorder) for possible values - SortOrder *SortOrder `json:"sort_order,omitempty" url:"sort_order,omitempty"` - // A pagination cursor returned by a previous call to this endpoint. - // Provide this cursor to retrieve the next set of results for the original query. - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - // If request parameters change between requests, subsequent results may contain duplicates or missing records. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // The maximum number of results to be returned in a single page. - // It is possible to receive fewer results than the specified limit on a given page. - // The default value of 100 is also the maximum allowed value. If the provided value is - // greater than 100, it is ignored and the default value is used instead. - // Default: `100` - Limit *int `json:"limit,omitempty" url:"limit,omitempty"` +// Published when an order [custom attribute definition](entity:CustomAttributeDefinition) that is visible to the subscribing app is updated. +type OrderCustomAttributeDefinitionVisibleUpdatedEvent struct { + // The ID of the target seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"order.custom_attribute_definition.visible.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *CustomAttributeDefinitionEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListPayoutEntriesRequest) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderCustomAttributeDefinitionVisibleUpdatedEvent) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListPayoutEntriesRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListPayoutEntriesRequest +func (o *OrderCustomAttributeDefinitionVisibleUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler OrderCustomAttributeDefinitionVisibleUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListPayoutEntriesRequest(value) + *o = OrderCustomAttributeDefinitionVisibleUpdatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListPayoutEntriesRequest) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderCustomAttributeDefinitionVisibleUpdatedEvent) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// The response to retrieve payout records entries. -type ListPayoutEntriesResponse struct { - // The requested list of payout entries, ordered with the given or default sort order. - PayoutEntries []*PayoutEntry `json:"payout_entries,omitempty" url:"payout_entries,omitempty"` - // The pagination cursor to be used in a subsequent request. If empty, this is the final response. - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // Information about errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Published when an order [custom attribute](entity:CustomAttribute) associated with a [custom attribute definition](entity:CustomAttributeDefinition) that is owned by the subscribing app is deleted. +type OrderCustomAttributeOwnedDeletedEvent struct { + // The ID of the target seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"order.custom_attribute.owned.deleted"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *CustomAttributeEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListPayoutEntriesResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderCustomAttributeOwnedDeletedEvent) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListPayoutEntriesResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListPayoutEntriesResponse +func (o *OrderCustomAttributeOwnedDeletedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler OrderCustomAttributeOwnedDeletedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListPayoutEntriesResponse(value) + *o = OrderCustomAttributeOwnedDeletedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListPayoutEntriesResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderCustomAttributeOwnedDeletedEvent) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// A request to retrieve payout records. -type ListPayoutsRequest struct { - // The ID of the location for which to list the payouts. - // By default, payouts are returned for the default (main) location associated with the seller. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` - // If provided, only payouts with the given status are returned. - Status *PayoutStatus `json:"status,omitempty" url:"status,omitempty"` - // The timestamp for the beginning of the payout creation time, in RFC 3339 format. - // Inclusive. Default: The current time minus one year. - BeginTime *string `json:"begin_time,omitempty" url:"begin_time,omitempty"` - // The timestamp for the end of the payout creation time, in RFC 3339 format. - // Default: The current time. - EndTime *string `json:"end_time,omitempty" url:"end_time,omitempty"` - // The order in which payouts are listed. - // See [SortOrder](#type-sortorder) for possible values - SortOrder *SortOrder `json:"sort_order,omitempty" url:"sort_order,omitempty"` - // A pagination cursor returned by a previous call to this endpoint. - // Provide this cursor to retrieve the next set of results for the original query. - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - // If request parameters change between requests, subsequent results may contain duplicates or missing records. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // The maximum number of results to be returned in a single page. - // It is possible to receive fewer results than the specified limit on a given page. - // The default value of 100 is also the maximum allowed value. If the provided value is - // greater than 100, it is ignored and the default value is used instead. - // Default: `100` - Limit *int `json:"limit,omitempty" url:"limit,omitempty"` +// Published when an order [custom attribute](entity:CustomAttribute) associated with a [custom attribute definition](entity:CustomAttributeDefinition) that is owned by the subscribing app is updated. +type OrderCustomAttributeOwnedUpdatedEvent struct { + // The ID of the target seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"order.custom_attribute.owned.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *CustomAttributeEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListPayoutsRequest) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderCustomAttributeOwnedUpdatedEvent) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListPayoutsRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListPayoutsRequest +func (o *OrderCustomAttributeOwnedUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler OrderCustomAttributeOwnedUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListPayoutsRequest(value) + *o = OrderCustomAttributeOwnedUpdatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListPayoutsRequest) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderCustomAttributeOwnedUpdatedEvent) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// The response to retrieve payout records entries. -type ListPayoutsResponse struct { - // The requested list of payouts. - Payouts []*Payout `json:"payouts,omitempty" url:"payouts,omitempty"` - // The pagination cursor to be used in a subsequent request. If empty, this is the final response. - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // Information about errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Published when an order [custom attribute](entity:CustomAttribute) that is visible to the subscribing app is deleted. +type OrderCustomAttributeVisibleDeletedEvent struct { + // The ID of the target seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"order.custom_attribute.visible.deleted"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *CustomAttributeEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListPayoutsResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderCustomAttributeVisibleDeletedEvent) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListPayoutsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListPayoutsResponse +func (o *OrderCustomAttributeVisibleDeletedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler OrderCustomAttributeVisibleDeletedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListPayoutsResponse(value) + *o = OrderCustomAttributeVisibleDeletedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListPayoutsResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderCustomAttributeVisibleDeletedEvent) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Defines the query parameters that can be included in -// a request to the [ListRefunds](api-endpoint:Transactions-ListRefunds) endpoint. -// -// Deprecated - recommend using [SearchOrders](api-endpoint:Orders-SearchOrders) -type ListRefundsRequest struct { - // The beginning of the requested reporting period, in RFC 3339 format. - // - // See [Date ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for details on date inclusivity/exclusivity. - // - // Default value: The current time minus one year. - BeginTime *string `json:"begin_time,omitempty" url:"begin_time,omitempty"` - // The end of the requested reporting period, in RFC 3339 format. - // - // See [Date ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for details on date inclusivity/exclusivity. - // - // Default value: The current time. - EndTime *string `json:"end_time,omitempty" url:"end_time,omitempty"` - // The order in which results are listed in the response (`ASC` for - // oldest first, `DESC` for newest first). - // - // Default value: `DESC` - // See [SortOrder](#type-sortorder) for possible values - SortOrder *SortOrder `json:"sort_order,omitempty" url:"sort_order,omitempty"` - // A pagination cursor returned by a previous call to this endpoint. - // Provide this to retrieve the next set of results for your original query. - // - // See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` +// Published when an order [custom attribute](entity:CustomAttribute) that is visible to the subscribing app is updated. +type OrderCustomAttributeVisibleUpdatedEvent struct { + // The ID of the target seller associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of this event. The value is `"order.custom_attribute.visible.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with the event. + Data *CustomAttributeEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListRefundsRequest) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderCustomAttributeVisibleUpdatedEvent) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListRefundsRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListRefundsRequest +func (o *OrderCustomAttributeVisibleUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler OrderCustomAttributeVisibleUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListRefundsRequest(value) + *o = OrderCustomAttributeVisibleUpdatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListRefundsRequest) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderCustomAttributeVisibleUpdatedEvent) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Defines the fields that are included in the response body of -// a request to the [ListRefunds](api-endpoint:Transactions-ListRefunds) endpoint. -// -// One of `errors` or `refunds` is present in a given response (never both). -type ListRefundsResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // An array of refunds that match your query. - Refunds []*Refund `json:"refunds,omitempty" url:"refunds,omitempty"` - // A pagination cursor for retrieving the next set of results, - // if any remain. Provide this value as the `cursor` parameter in a subsequent - // request to this endpoint. +// A lightweight description of an [order](entity:Order) that is returned when +// `returned_entries` is `true` on a [SearchOrdersRequest](api-endpoint:Orders-SearchOrders). +type OrderEntry struct { + // The ID of the order. + OrderID *string `json:"order_id,omitempty" url:"order_id,omitempty"` + // The version number, which is incremented each time an update is committed to the order. + // Orders that were not created through the API do not include a version number and + // therefore cannot be updated. // - // See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // [Read more about working with versions.](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders) + Version *int `json:"version,omitempty" url:"version,omitempty"` + // The location ID the order belongs to. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListRefundsResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderEntry) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListRefundsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListRefundsResponse +func (o *OrderEntry) UnmarshalJSON(data []byte) error { + type unmarshaler OrderEntry var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListRefundsResponse(value) + *o = OrderEntry(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListRefundsResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderEntry) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Represents a `ListSites` request. -type ListSitesRequest struct { +// Contains details about how to fulfill this order. +// Orders can only be created with at most one fulfillment using the API. +// However, orders returned by the Orders API might contain multiple fulfillments because sellers can create multiple fulfillments using Square products such as Square Online. +type OrderFulfillment struct { + // A unique ID that identifies the fulfillment only within this order. + UID *string `json:"uid,omitempty" url:"uid,omitempty"` + // The type of the fulfillment. + // See [OrderFulfillmentType](#type-orderfulfillmenttype) for possible values + Type *OrderFulfillmentType `json:"type,omitempty" url:"type,omitempty"` + // The state of the fulfillment. + // See [OrderFulfillmentState](#type-orderfulfillmentstate) for possible values + State *OrderFulfillmentState `json:"state,omitempty" url:"state,omitempty"` + // Describes what order line items this fulfillment applies to. + // It can be `ALL` or `ENTRY_LIST` with a supplied list of fulfillment entries. + // See [OrderFulfillmentFulfillmentLineItemApplication](#type-orderfulfillmentfulfillmentlineitemapplication) for possible values + LineItemApplication *OrderFulfillmentFulfillmentLineItemApplication `json:"line_item_application,omitempty" url:"line_item_application,omitempty"` + // A list of entries pertaining to the fulfillment of an order. Each entry must reference + // a valid `uid` for an order line item in the `line_item_uid` field, as well as a `quantity` to + // fulfill. + // Multiple entries can reference the same line item `uid`, as long as the total quantity among + // all fulfillment entries referencing a single line item does not exceed the quantity of the + // order's line item itself. + // An order cannot be marked as `COMPLETED` before all fulfillments are `COMPLETED`, + // `CANCELED`, or `FAILED`. Fulfillments can be created and completed independently + // before order completion. + Entries []*OrderFulfillmentFulfillmentEntry `json:"entries,omitempty" url:"entries,omitempty"` + // Application-defined data attached to this fulfillment. Metadata fields are intended + // to store descriptive references or associations with an entity in another system or store brief + // information about the object. Square does not process this field; it only stores and returns it + // in relevant API calls. Do not use metadata to store any sensitive information (such as personally + // identifiable information or card details). + // Keys written by applications must be 60 characters or less and must be in the character set + // `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed + // with a namespace, separated from the key with a ':' character. + // Values have a maximum length of 255 characters. + // An application can have up to 10 entries per metadata field. + // Entries written by applications are private and can only be read or modified by the same + // application. + // For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). + Metadata map[string]*string `json:"metadata,omitempty" url:"metadata,omitempty"` + // Contains details for a pickup fulfillment. These details are required when the fulfillment + // type is `PICKUP`. + PickupDetails *OrderFulfillmentPickupDetails `json:"pickup_details,omitempty" url:"pickup_details,omitempty"` + // Contains details for a shipment fulfillment. These details are required when the fulfillment type + // is `SHIPMENT`. + // A shipment fulfillment's relationship to fulfillment `state`: + // `PROPOSED`: A shipment is requested. + // `RESERVED`: Fulfillment in progress. Shipment processing. + // `PREPARED`: Shipment packaged. Shipping label created. + // `COMPLETED`: Package has been shipped. + // `CANCELED`: Shipment has been canceled. + // `FAILED`: Shipment has failed. + ShipmentDetails *OrderFulfillmentShipmentDetails `json:"shipment_details,omitempty" url:"shipment_details,omitempty"` + // Describes delivery details of an order fulfillment. + DeliveryDetails *OrderFulfillmentDeliveryDetails `json:"delivery_details,omitempty" url:"delivery_details,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListSitesRequest) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderFulfillment) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListSitesRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListSitesRequest +func (o *OrderFulfillment) UnmarshalJSON(data []byte) error { + type unmarshaler OrderFulfillment var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListSitesRequest(value) + *o = OrderFulfillment(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListSitesRequest) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderFulfillment) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Represents a `ListSites` response. The response can include either `sites` or `errors`. -type ListSitesResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The sites that belong to the seller. - Sites []*Site `json:"sites,omitempty" url:"sites,omitempty"` +// Describes delivery details of an order fulfillment. +type OrderFulfillmentDeliveryDetails struct { + // The contact information for the person to receive the fulfillment. + Recipient *OrderFulfillmentRecipient `json:"recipient,omitempty" url:"recipient,omitempty"` + // Indicates the fulfillment delivery schedule type. If `SCHEDULED`, then + // `deliver_at` is required. If `ASAP`, then `prep_time_duration` is required. The default is `SCHEDULED`. + // See [OrderFulfillmentDeliveryDetailsScheduleType](#type-orderfulfillmentdeliverydetailsscheduletype) for possible values + ScheduleType *OrderFulfillmentDeliveryDetailsScheduleType `json:"schedule_type,omitempty" url:"schedule_type,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when the fulfillment was placed. + // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + // Must be in RFC 3339 timestamp format, e.g., "2016-09-04T23:59:33.123Z". + PlacedAt *string `json:"placed_at,omitempty" url:"placed_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // that represents the start of the delivery period. + // When the fulfillment `schedule_type` is `ASAP`, the field is automatically + // set to the current time plus the `prep_time_duration`. + // Otherwise, the application can set this field while the fulfillment `state` is + // `PROPOSED`, `RESERVED`, or `PREPARED` (any time before the + // terminal state such as `COMPLETED`, `CANCELED`, and `FAILED`). + // + // The timestamp must be in RFC 3339 format + // (for example, "2016-09-04T23:59:33.123Z"). + DeliverAt *string `json:"deliver_at,omitempty" url:"deliver_at,omitempty"` + // The duration of time it takes to prepare and deliver this fulfillment. + // The duration must be in RFC 3339 format (for example, "P1W3D"). + PrepTimeDuration *string `json:"prep_time_duration,omitempty" url:"prep_time_duration,omitempty"` + // The time period after `deliver_at` in which to deliver the order. + // Applications can set this field when the fulfillment `state` is + // `PROPOSED`, `RESERVED`, or `PREPARED` (any time before the terminal state + // such as `COMPLETED`, `CANCELED`, and `FAILED`). + // The duration must be in RFC 3339 format (for example, "P1W3D"). + DeliveryWindowDuration *string `json:"delivery_window_duration,omitempty" url:"delivery_window_duration,omitempty"` + // Provides additional instructions about the delivery fulfillment. + // It is displayed in the Square Point of Sale application and set by the API. + Note *string `json:"note,omitempty" url:"note,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicates when the seller completed the fulfillment. + // This field is automatically set when fulfillment `state` changes to `COMPLETED`. + // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + CompletedAt *string `json:"completed_at,omitempty" url:"completed_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicates when the seller started processing the fulfillment. + // This field is automatically set when the fulfillment `state` changes to `RESERVED`. + // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + InProgressAt *string `json:"in_progress_at,omitempty" url:"in_progress_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when the fulfillment was rejected. This field is + // automatically set when the fulfillment `state` changes to `FAILED`. + // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + RejectedAt *string `json:"rejected_at,omitempty" url:"rejected_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when the seller marked the fulfillment as ready for + // courier pickup. This field is automatically set when the fulfillment `state` changes + // to PREPARED. + // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + ReadyAt *string `json:"ready_at,omitempty" url:"ready_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when the fulfillment was delivered to the recipient. + // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + DeliveredAt *string `json:"delivered_at,omitempty" url:"delivered_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when the fulfillment was canceled. This field is automatically + // set when the fulfillment `state` changes to `CANCELED`. + // + // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + CanceledAt *string `json:"canceled_at,omitempty" url:"canceled_at,omitempty"` + // The delivery cancellation reason. Max length: 100 characters. + CancelReason *string `json:"cancel_reason,omitempty" url:"cancel_reason,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when an order can be picked up by the courier for delivery. + // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + CourierPickupAt *string `json:"courier_pickup_at,omitempty" url:"courier_pickup_at,omitempty"` + // The time period after `courier_pickup_at` in which the courier should pick up the order. + // The duration must be in RFC 3339 format (for example, "P1W3D"). + CourierPickupWindowDuration *string `json:"courier_pickup_window_duration,omitempty" url:"courier_pickup_window_duration,omitempty"` + // Whether the delivery is preferred to be no contact. + IsNoContactDelivery *bool `json:"is_no_contact_delivery,omitempty" url:"is_no_contact_delivery,omitempty"` + // A note to provide additional instructions about how to deliver the order. + DropoffNotes *string `json:"dropoff_notes,omitempty" url:"dropoff_notes,omitempty"` + // The name of the courier provider. + CourierProviderName *string `json:"courier_provider_name,omitempty" url:"courier_provider_name,omitempty"` + // The support phone number of the courier. + CourierSupportPhoneNumber *string `json:"courier_support_phone_number,omitempty" url:"courier_support_phone_number,omitempty"` + // The identifier for the delivery created by Square. + SquareDeliveryID *string `json:"square_delivery_id,omitempty" url:"square_delivery_id,omitempty"` + // The identifier for the delivery created by the third-party courier service. + ExternalDeliveryID *string `json:"external_delivery_id,omitempty" url:"external_delivery_id,omitempty"` + // The flag to indicate the delivery is managed by a third party (ie DoorDash), which means + // we may not receive all recipient information for PII purposes. + ManagedDelivery *bool `json:"managed_delivery,omitempty" url:"managed_delivery,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListSitesResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderFulfillmentDeliveryDetails) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListSitesResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListSitesResponse +func (o *OrderFulfillmentDeliveryDetails) UnmarshalJSON(data []byte) error { + type unmarshaler OrderFulfillmentDeliveryDetails var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListSitesResponse(value) + *o = OrderFulfillmentDeliveryDetails(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListSitesResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderFulfillmentDeliveryDetails) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Defines input parameters in a request to the -// [ListSubscriptionEvents]($e/Subscriptions/ListSubscriptionEvents) -// endpoint. -type ListSubscriptionEventsRequest struct { - // When the total number of resulting subscription events exceeds the limit of a paged response, - // specify the cursor returned from a preceding response here to fetch the next set of results. - // If the cursor is unset, the response contains the last page of the results. - // - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // The upper limit on the number of subscription events to return - // in a paged response. - Limit *int `json:"limit,omitempty" url:"limit,omitempty"` +// The schedule type of the delivery fulfillment. +type OrderFulfillmentDeliveryDetailsScheduleType string + +const ( + OrderFulfillmentDeliveryDetailsScheduleTypeFulfillmentDeliveryDetailsScheduleTypeDoNotUse OrderFulfillmentDeliveryDetailsScheduleType = "FULFILLMENT_DELIVERY_DETAILS_SCHEDULE_TYPE_DO_NOT_USE" + OrderFulfillmentDeliveryDetailsScheduleTypeScheduled OrderFulfillmentDeliveryDetailsScheduleType = "SCHEDULED" + OrderFulfillmentDeliveryDetailsScheduleTypeAsap OrderFulfillmentDeliveryDetailsScheduleType = "ASAP" +) + +func NewOrderFulfillmentDeliveryDetailsScheduleTypeFromString(s string) (OrderFulfillmentDeliveryDetailsScheduleType, error) { + switch s { + case "FULFILLMENT_DELIVERY_DETAILS_SCHEDULE_TYPE_DO_NOT_USE": + return OrderFulfillmentDeliveryDetailsScheduleTypeFulfillmentDeliveryDetailsScheduleTypeDoNotUse, nil + case "SCHEDULED": + return OrderFulfillmentDeliveryDetailsScheduleTypeScheduled, nil + case "ASAP": + return OrderFulfillmentDeliveryDetailsScheduleTypeAsap, nil + } + var t OrderFulfillmentDeliveryDetailsScheduleType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (o OrderFulfillmentDeliveryDetailsScheduleType) Ptr() *OrderFulfillmentDeliveryDetailsScheduleType { + return &o +} + +// Links an order line item to a fulfillment. Each entry must reference +// a valid `uid` for an order line item in the `line_item_uid` field, as well as a `quantity` to +// fulfill. +type OrderFulfillmentFulfillmentEntry struct { + // A unique ID that identifies the fulfillment entry only within this order. + UID *string `json:"uid,omitempty" url:"uid,omitempty"` + // The `uid` from the order line item. + LineItemUID string `json:"line_item_uid" url:"line_item_uid"` + // The quantity of the line item being fulfilled, formatted as a decimal number. + // For example, `"3"`. + // Fulfillments for line items with a `quantity_unit` can have non-integer quantities. + // For example, `"1.70000"`. + Quantity string `json:"quantity" url:"quantity"` + // Application-defined data attached to this fulfillment entry. Metadata fields are intended + // to store descriptive references or associations with an entity in another system or store brief + // information about the object. Square does not process this field; it only stores and returns it + // in relevant API calls. Do not use metadata to store any sensitive information (such as personally + // identifiable information or card details). + // Keys written by applications must be 60 characters or less and must be in the character set + // `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed + // with a namespace, separated from the key with a ':' character. + // Values have a maximum length of 255 characters. + // An application can have up to 10 entries per metadata field. + // Entries written by applications are private and can only be read or modified by the same + // application. + // For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). + Metadata map[string]*string `json:"metadata,omitempty" url:"metadata,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListSubscriptionEventsRequest) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderFulfillmentFulfillmentEntry) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListSubscriptionEventsRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListSubscriptionEventsRequest +func (o *OrderFulfillmentFulfillmentEntry) UnmarshalJSON(data []byte) error { + type unmarshaler OrderFulfillmentFulfillmentEntry var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListSubscriptionEventsRequest(value) + *o = OrderFulfillmentFulfillmentEntry(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListSubscriptionEventsRequest) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderFulfillmentFulfillmentEntry) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Defines output parameters in a response from the -// [ListSubscriptionEvents]($e/Subscriptions/ListSubscriptionEvents). -type ListSubscriptionEventsResponse struct { - // Errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The retrieved subscription events. - SubscriptionEvents []*SubscriptionEvent `json:"subscription_events,omitempty" url:"subscription_events,omitempty"` - // When the total number of resulting subscription events exceeds the limit of a paged response, - // the response includes a cursor for you to use in a subsequent request to fetch the next set of events. - // If the cursor is unset, the response contains the last page of the results. +// The `line_item_application` describes what order line items this fulfillment applies +// to. It can be `ALL` or `ENTRY_LIST` with a supplied list of fulfillment entries. +type OrderFulfillmentFulfillmentLineItemApplication string + +const ( + OrderFulfillmentFulfillmentLineItemApplicationUnknownApplication OrderFulfillmentFulfillmentLineItemApplication = "UNKNOWN_APPLICATION" + OrderFulfillmentFulfillmentLineItemApplicationAll OrderFulfillmentFulfillmentLineItemApplication = "ALL" + OrderFulfillmentFulfillmentLineItemApplicationEntryList OrderFulfillmentFulfillmentLineItemApplication = "ENTRY_LIST" +) + +func NewOrderFulfillmentFulfillmentLineItemApplicationFromString(s string) (OrderFulfillmentFulfillmentLineItemApplication, error) { + switch s { + case "UNKNOWN_APPLICATION": + return OrderFulfillmentFulfillmentLineItemApplicationUnknownApplication, nil + case "ALL": + return OrderFulfillmentFulfillmentLineItemApplicationAll, nil + case "ENTRY_LIST": + return OrderFulfillmentFulfillmentLineItemApplicationEntryList, nil + } + var t OrderFulfillmentFulfillmentLineItemApplication + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (o OrderFulfillmentFulfillmentLineItemApplication) Ptr() *OrderFulfillmentFulfillmentLineItemApplication { + return &o +} + +// Contains details necessary to fulfill a pickup order. +type OrderFulfillmentPickupDetails struct { + // Information about the person to pick up this fulfillment from a physical + // location. + Recipient *OrderFulfillmentRecipient `json:"recipient,omitempty" url:"recipient,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when this fulfillment expires if it is not marked in progress. The timestamp must be + // in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). The expiration time can only be set + // up to 7 days in the future. If `expires_at` is not set, any new payments attached to the order + // are automatically completed. + ExpiresAt *string `json:"expires_at,omitempty" url:"expires_at,omitempty"` + // The duration of time after which an in progress pickup fulfillment is automatically moved + // to the `COMPLETED` state. The duration must be in RFC 3339 format (for example, "P1W3D"). // - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // If not set, this pickup fulfillment remains in progress until it is canceled or completed. + AutoCompleteDuration *string `json:"auto_complete_duration,omitempty" url:"auto_complete_duration,omitempty"` + // The schedule type of the pickup fulfillment. Defaults to `SCHEDULED`. + // See [OrderFulfillmentPickupDetailsScheduleType](#type-orderfulfillmentpickupdetailsscheduletype) for possible values + ScheduleType *OrderFulfillmentPickupDetailsScheduleType `json:"schedule_type,omitempty" url:"schedule_type,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // that represents the start of the pickup window. Must be in RFC 3339 timestamp format, e.g., + // "2016-09-04T23:59:33.123Z". + // For fulfillments with the schedule type `ASAP`, this is automatically set + // to the current time plus the expected duration to prepare the fulfillment. + PickupAt *string `json:"pickup_at,omitempty" url:"pickup_at,omitempty"` + // The window of time in which the order should be picked up after the `pickup_at` timestamp. + // Must be in RFC 3339 duration format, e.g., "P1W3D". Can be used as an + // informational guideline for merchants. + PickupWindowDuration *string `json:"pickup_window_duration,omitempty" url:"pickup_window_duration,omitempty"` + // The duration of time it takes to prepare this fulfillment. + // The duration must be in RFC 3339 format (for example, "P1W3D"). + PrepTimeDuration *string `json:"prep_time_duration,omitempty" url:"prep_time_duration,omitempty"` + // A note to provide additional instructions about the pickup + // fulfillment displayed in the Square Point of Sale application and set by the API. + Note *string `json:"note,omitempty" url:"note,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when the fulfillment was placed. The timestamp must be in RFC 3339 format + // (for example, "2016-09-04T23:59:33.123Z"). + PlacedAt *string `json:"placed_at,omitempty" url:"placed_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when the fulfillment was marked in progress. The timestamp must be in RFC 3339 format + // (for example, "2016-09-04T23:59:33.123Z"). + AcceptedAt *string `json:"accepted_at,omitempty" url:"accepted_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when the fulfillment was rejected. The timestamp must be in RFC 3339 format + // (for example, "2016-09-04T23:59:33.123Z"). + RejectedAt *string `json:"rejected_at,omitempty" url:"rejected_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when the fulfillment is marked as ready for pickup. The timestamp must be in RFC 3339 format + // (for example, "2016-09-04T23:59:33.123Z"). + ReadyAt *string `json:"ready_at,omitempty" url:"ready_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when the fulfillment expired. The timestamp must be in RFC 3339 format + // (for example, "2016-09-04T23:59:33.123Z"). + ExpiredAt *string `json:"expired_at,omitempty" url:"expired_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when the fulfillment was picked up by the recipient. The timestamp must be in RFC 3339 format + // (for example, "2016-09-04T23:59:33.123Z"). + PickedUpAt *string `json:"picked_up_at,omitempty" url:"picked_up_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when the fulfillment was canceled. The timestamp must be in RFC 3339 format + // (for example, "2016-09-04T23:59:33.123Z"). + CanceledAt *string `json:"canceled_at,omitempty" url:"canceled_at,omitempty"` + // A description of why the pickup was canceled. The maximum length: 100 characters. + CancelReason *string `json:"cancel_reason,omitempty" url:"cancel_reason,omitempty"` + // If set to `true`, indicates that this pickup order is for curbside pickup, not in-store pickup. + IsCurbsidePickup *bool `json:"is_curbside_pickup,omitempty" url:"is_curbside_pickup,omitempty"` + // Specific details for curbside pickup. These details can only be populated if `is_curbside_pickup` is set to `true`. + CurbsidePickupDetails *OrderFulfillmentPickupDetailsCurbsidePickupDetails `json:"curbside_pickup_details,omitempty" url:"curbside_pickup_details,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListSubscriptionEventsResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderFulfillmentPickupDetails) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListSubscriptionEventsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListSubscriptionEventsResponse +func (o *OrderFulfillmentPickupDetails) UnmarshalJSON(data []byte) error { + type unmarshaler OrderFulfillmentPickupDetails var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListSubscriptionEventsResponse(value) + *o = OrderFulfillmentPickupDetails(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListSubscriptionEventsResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderFulfillmentPickupDetails) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -type ListTeamMemberBookingProfilesRequest struct { - // Indicates whether to include only bookable team members in the returned result (`true`) or not (`false`). - BookableOnly *bool `json:"bookable_only,omitempty" url:"bookable_only,omitempty"` - // The maximum number of results to return in a paged response. - Limit *int `json:"limit,omitempty" 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:"cursor,omitempty" url:"cursor,omitempty"` - // Indicates whether to include only team members enabled at the given location in the returned result. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` +// Specific details for curbside pickup. +type OrderFulfillmentPickupDetailsCurbsidePickupDetails struct { + // Specific details for curbside pickup, such as parking number and vehicle model. + CurbsideDetails *string `json:"curbside_details,omitempty" url:"curbside_details,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when the buyer arrived and is waiting for pickup. The timestamp must be in RFC 3339 format + // (for example, "2016-09-04T23:59:33.123Z"). + BuyerArrivedAt *string `json:"buyer_arrived_at,omitempty" url:"buyer_arrived_at,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListTeamMemberBookingProfilesRequest) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderFulfillmentPickupDetailsCurbsidePickupDetails) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListTeamMemberBookingProfilesRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListTeamMemberBookingProfilesRequest +func (o *OrderFulfillmentPickupDetailsCurbsidePickupDetails) UnmarshalJSON(data []byte) error { + type unmarshaler OrderFulfillmentPickupDetailsCurbsidePickupDetails var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListTeamMemberBookingProfilesRequest(value) + *o = OrderFulfillmentPickupDetailsCurbsidePickupDetails(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListTeamMemberBookingProfilesRequest) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderFulfillmentPickupDetailsCurbsidePickupDetails) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -type ListTeamMemberBookingProfilesResponse struct { - // The list of team member booking profiles. The results are returned in the ascending order of the time - // when the team member booking profiles were last updated. Multiple booking profiles updated at the same time - // are further sorted in the ascending order of their IDs. - TeamMemberBookingProfiles []*TeamMemberBookingProfile `json:"team_member_booking_profiles,omitempty" url:"team_member_booking_profiles,omitempty"` - // The pagination cursor to be used in the subsequent request to get the next page of the results. Stop retrieving the next page of the results when the cursor is not set. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // Errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// The schedule type of the pickup fulfillment. +type OrderFulfillmentPickupDetailsScheduleType string + +const ( + OrderFulfillmentPickupDetailsScheduleTypeFulfillmentPickupDetailsScheduleTypeDoNotUse OrderFulfillmentPickupDetailsScheduleType = "FULFILLMENT_PICKUP_DETAILS_SCHEDULE_TYPE_DO_NOT_USE" + OrderFulfillmentPickupDetailsScheduleTypeScheduled OrderFulfillmentPickupDetailsScheduleType = "SCHEDULED" + OrderFulfillmentPickupDetailsScheduleTypeAsap OrderFulfillmentPickupDetailsScheduleType = "ASAP" +) + +func NewOrderFulfillmentPickupDetailsScheduleTypeFromString(s string) (OrderFulfillmentPickupDetailsScheduleType, error) { + switch s { + case "FULFILLMENT_PICKUP_DETAILS_SCHEDULE_TYPE_DO_NOT_USE": + return OrderFulfillmentPickupDetailsScheduleTypeFulfillmentPickupDetailsScheduleTypeDoNotUse, nil + case "SCHEDULED": + return OrderFulfillmentPickupDetailsScheduleTypeScheduled, nil + case "ASAP": + return OrderFulfillmentPickupDetailsScheduleTypeAsap, nil + } + var t OrderFulfillmentPickupDetailsScheduleType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (o OrderFulfillmentPickupDetailsScheduleType) Ptr() *OrderFulfillmentPickupDetailsScheduleType { + return &o +} + +// Information about the fulfillment recipient. +type OrderFulfillmentRecipient struct { + // The ID of the customer associated with the fulfillment. + // If `customer_id` is provided, the fulfillment recipient's `display_name`, + // `email_address`, and `phone_number` are automatically populated from the + // targeted customer profile. If these fields are set in the request, the request + // values override the information from the customer profile. If the + // targeted customer profile does not contain the necessary information and + // these fields are left unset, the request results in an error. + CustomerID *string `json:"customer_id,omitempty" url:"customer_id,omitempty"` + // The display name of the fulfillment recipient. This field is required. + // If provided, the display name overrides the corresponding customer profile value + // indicated by `customer_id`. + DisplayName *string `json:"display_name,omitempty" url:"display_name,omitempty"` + // The email address of the fulfillment recipient. + // If provided, the email address overrides the corresponding customer profile value + // indicated by `customer_id`. + EmailAddress *string `json:"email_address,omitempty" url:"email_address,omitempty"` + // The phone number of the fulfillment recipient. This field is required. + // If provided, the phone number overrides the corresponding customer profile value + // indicated by `customer_id`. + PhoneNumber *string `json:"phone_number,omitempty" url:"phone_number,omitempty"` + // The address of the fulfillment recipient. This field is required. + // If provided, the address overrides the corresponding customer profile value + // indicated by `customer_id`. + Address *Address `json:"address,omitempty" url:"address,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListTeamMemberBookingProfilesResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderFulfillmentRecipient) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListTeamMemberBookingProfilesResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListTeamMemberBookingProfilesResponse +func (o *OrderFulfillmentRecipient) UnmarshalJSON(data []byte) error { + type unmarshaler OrderFulfillmentRecipient var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListTeamMemberBookingProfilesResponse(value) + *o = OrderFulfillmentRecipient(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListTeamMemberBookingProfilesResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderFulfillmentRecipient) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// A request for a set of `TeamMemberWage` objects. -type ListTeamMemberWagesRequest struct { - // Filter the returned wages to only those that are associated with the - // specified team member. - TeamMemberID *string `json:"team_member_id,omitempty" url:"team_member_id,omitempty"` - // The maximum number of `TeamMemberWage` results to return per page. The number can range between - // 1 and 200. The default is 200. - Limit *int `json:"limit,omitempty" url:"limit,omitempty"` - // A pointer to the next page of `EmployeeWage` results to fetch. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` +// Contains the details necessary to fulfill a shipment order. +type OrderFulfillmentShipmentDetails struct { + // Information about the person to receive this shipment fulfillment. + Recipient *OrderFulfillmentRecipient `json:"recipient,omitempty" url:"recipient,omitempty"` + // The shipping carrier being used to ship this fulfillment (such as UPS, FedEx, or USPS). + Carrier *string `json:"carrier,omitempty" url:"carrier,omitempty"` + // A note with additional information for the shipping carrier. + ShippingNote *string `json:"shipping_note,omitempty" url:"shipping_note,omitempty"` + // A description of the type of shipping product purchased from the carrier + // (such as First Class, Priority, or Express). + ShippingType *string `json:"shipping_type,omitempty" url:"shipping_type,omitempty"` + // The reference number provided by the carrier to track the shipment's progress. + TrackingNumber *string `json:"tracking_number,omitempty" url:"tracking_number,omitempty"` + // A link to the tracking webpage on the carrier's website. + TrackingURL *string `json:"tracking_url,omitempty" url:"tracking_url,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when the shipment was requested. The timestamp must be in RFC 3339 format + // (for example, "2016-09-04T23:59:33.123Z"). + PlacedAt *string `json:"placed_at,omitempty" url:"placed_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when this fulfillment was moved to the `RESERVED` state, which indicates that preparation + // of this shipment has begun. The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + InProgressAt *string `json:"in_progress_at,omitempty" url:"in_progress_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when this fulfillment was moved to the `PREPARED` state, which indicates that the + // fulfillment is packaged. The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + PackagedAt *string `json:"packaged_at,omitempty" url:"packaged_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when the shipment is expected to be delivered to the shipping carrier. + // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + ExpectedShippedAt *string `json:"expected_shipped_at,omitempty" url:"expected_shipped_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when this fulfillment was moved to the `COMPLETED` state, which indicates that + // the fulfillment has been given to the shipping carrier. The timestamp must be in RFC 3339 format + // (for example, "2016-09-04T23:59:33.123Z"). + ShippedAt *string `json:"shipped_at,omitempty" url:"shipped_at,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating the shipment was canceled. + // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + CanceledAt *string `json:"canceled_at,omitempty" url:"canceled_at,omitempty"` + // A description of why the shipment was canceled. + CancelReason *string `json:"cancel_reason,omitempty" url:"cancel_reason,omitempty"` + // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + // indicating when the shipment failed to be completed. The timestamp must be in RFC 3339 format + // (for example, "2016-09-04T23:59:33.123Z"). + FailedAt *string `json:"failed_at,omitempty" url:"failed_at,omitempty"` + // A description of why the shipment failed to be completed. + FailureReason *string `json:"failure_reason,omitempty" url:"failure_reason,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListTeamMemberWagesRequest) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderFulfillmentShipmentDetails) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListTeamMemberWagesRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListTeamMemberWagesRequest +func (o *OrderFulfillmentShipmentDetails) UnmarshalJSON(data []byte) error { + type unmarshaler OrderFulfillmentShipmentDetails var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListTeamMemberWagesRequest(value) + *o = OrderFulfillmentShipmentDetails(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListTeamMemberWagesRequest) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderFulfillmentShipmentDetails) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// The response to a request for a set of `TeamMemberWage` objects. The response contains -// a set of `TeamMemberWage` objects. -type ListTeamMemberWagesResponse struct { - // A page of `TeamMemberWage` results. - TeamMemberWages []*TeamMemberWage `json:"team_member_wages,omitempty" url:"team_member_wages,omitempty"` - // The value supplied in the subsequent request to fetch the next page - // of `TeamMemberWage` results. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// The current state of this fulfillment. +type OrderFulfillmentState string - extraProperties map[string]interface{} - _rawJSON json.RawMessage +const ( + OrderFulfillmentStateFulfillmentStateDoNotUse OrderFulfillmentState = "FULFILLMENT_STATE_DO_NOT_USE" + OrderFulfillmentStateProposed OrderFulfillmentState = "PROPOSED" + OrderFulfillmentStateReserved OrderFulfillmentState = "RESERVED" + OrderFulfillmentStatePrepared OrderFulfillmentState = "PREPARED" + OrderFulfillmentStateCompleted OrderFulfillmentState = "COMPLETED" + OrderFulfillmentStateCanceled OrderFulfillmentState = "CANCELED" + OrderFulfillmentStateFailed OrderFulfillmentState = "FAILED" +) + +func NewOrderFulfillmentStateFromString(s string) (OrderFulfillmentState, error) { + switch s { + case "FULFILLMENT_STATE_DO_NOT_USE": + return OrderFulfillmentStateFulfillmentStateDoNotUse, nil + case "PROPOSED": + return OrderFulfillmentStateProposed, nil + case "RESERVED": + return OrderFulfillmentStateReserved, nil + case "PREPARED": + return OrderFulfillmentStatePrepared, nil + case "COMPLETED": + return OrderFulfillmentStateCompleted, nil + case "CANCELED": + return OrderFulfillmentStateCanceled, nil + case "FAILED": + return OrderFulfillmentStateFailed, nil + } + var t OrderFulfillmentState + return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (l *ListTeamMemberWagesResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o OrderFulfillmentState) Ptr() *OrderFulfillmentState { + return &o } -func (l *ListTeamMemberWagesResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListTeamMemberWagesResponse - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *l = ListTeamMemberWagesResponse(value) +// The type of fulfillment. +type OrderFulfillmentType string - extraProperties, err := core.ExtractExtraProperties(data, *l) - if err != nil { - return err - } - l.extraProperties = extraProperties +const ( + OrderFulfillmentTypeFulfillmentTypeDoNotUse OrderFulfillmentType = "FULFILLMENT_TYPE_DO_NOT_USE" + OrderFulfillmentTypeCustom OrderFulfillmentType = "CUSTOM" + OrderFulfillmentTypePickup OrderFulfillmentType = "PICKUP" + OrderFulfillmentTypeManagedDelivery OrderFulfillmentType = "MANAGED_DELIVERY" + OrderFulfillmentTypeShipment OrderFulfillmentType = "SHIPMENT" + OrderFulfillmentTypeDigital OrderFulfillmentType = "DIGITAL" + OrderFulfillmentTypeDelivery OrderFulfillmentType = "DELIVERY" + OrderFulfillmentTypeSimple OrderFulfillmentType = "SIMPLE" +) - l._rawJSON = json.RawMessage(data) - return nil +func NewOrderFulfillmentTypeFromString(s string) (OrderFulfillmentType, error) { + switch s { + case "FULFILLMENT_TYPE_DO_NOT_USE": + return OrderFulfillmentTypeFulfillmentTypeDoNotUse, nil + case "CUSTOM": + return OrderFulfillmentTypeCustom, nil + case "PICKUP": + return OrderFulfillmentTypePickup, nil + case "MANAGED_DELIVERY": + return OrderFulfillmentTypeManagedDelivery, nil + case "SHIPMENT": + return OrderFulfillmentTypeShipment, nil + case "DIGITAL": + return OrderFulfillmentTypeDigital, nil + case "DELIVERY": + return OrderFulfillmentTypeDelivery, nil + case "SIMPLE": + return OrderFulfillmentTypeSimple, nil + } + var t OrderFulfillmentType + return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (l *ListTeamMemberWagesResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(l); err == nil { - return value - } - return fmt.Sprintf("%#v", l) +func (o OrderFulfillmentType) Ptr() *OrderFulfillmentType { + return &o } -// Defines the query parameters that can be included in -// a request to the [ListTransactions](api-endpoint:Transactions-ListTransactions) endpoint. -// -// Deprecated - recommend using [SearchOrders](api-endpoint:Orders-SearchOrders) -type ListTransactionsRequest struct { - // The beginning of the requested reporting period, in RFC 3339 format. - // - // See [Date ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for details on date inclusivity/exclusivity. - // - // Default value: The current time minus one year. - BeginTime *string `json:"begin_time,omitempty" url:"begin_time,omitempty"` - // The end of the requested reporting period, in RFC 3339 format. - // - // See [Date ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for details on date inclusivity/exclusivity. - // - // Default value: The current time. - EndTime *string `json:"end_time,omitempty" url:"end_time,omitempty"` - // The order in which results are listed in the response (`ASC` for - // oldest first, `DESC` for newest first). - // - // Default value: `DESC` - // See [SortOrder](#type-sortorder) for possible values - SortOrder *SortOrder `json:"sort_order,omitempty" url:"sort_order,omitempty"` - // A pagination cursor returned by a previous call to this endpoint. - // Provide this to retrieve the next set of results for your original query. +type OrderFulfillmentUpdated struct { + // The order's unique ID. + OrderID *string `json:"order_id,omitempty" url:"order_id,omitempty"` + // The version number, which is incremented each time an update is committed to the order. + // Orders that were not created through the API do not include a version number and + // therefore cannot be updated. // - // See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // [Read more about working with versions.](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders) + Version *int `json:"version,omitempty" url:"version,omitempty"` + // The ID of the seller location that this order is associated with. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The state of the order. + // See [OrderState](#type-orderstate) for possible values + State *OrderState `json:"state,omitempty" url:"state,omitempty"` + // The timestamp for when the order was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The timestamp for when the order was last updated, in RFC 3339 format. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // The fulfillments that were updated with this version change. + FulfillmentUpdate []*OrderFulfillmentUpdatedUpdate `json:"fulfillment_update,omitempty" url:"fulfillment_update,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListTransactionsRequest) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderFulfillmentUpdated) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListTransactionsRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListTransactionsRequest +func (o *OrderFulfillmentUpdated) UnmarshalJSON(data []byte) error { + type unmarshaler OrderFulfillmentUpdated var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListTransactionsRequest(value) + *o = OrderFulfillmentUpdated(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListTransactionsRequest) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderFulfillmentUpdated) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Defines the fields that are included in the response body of -// a request to the [ListTransactions](api-endpoint:Transactions-ListTransactions) endpoint. -// -// One of `errors` or `transactions` is present in a given response (never both). -type ListTransactionsResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // An array of transactions that match your query. - Transactions []*Transaction `json:"transactions,omitempty" url:"transactions,omitempty"` - // A pagination cursor for retrieving the next set of results, - // if any remain. Provide this value as the `cursor` parameter in a subsequent - // request to this endpoint. - // - // See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` +// Published when an [OrderFulfillment](entity:OrderFulfillment) +// is created or updated. This event is triggered only by the +// [UpdateOrder](api-endpoint:Orders-UpdateOrder) endpoint call. +type OrderFulfillmentUpdatedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents, `"order.fulfillment.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *OrderFulfillmentUpdatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListTransactionsResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderFulfillmentUpdatedEvent) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListTransactionsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListTransactionsResponse +func (o *OrderFulfillmentUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler OrderFulfillmentUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListTransactionsResponse(value) + *o = OrderFulfillmentUpdatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListTransactionsResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderFulfillmentUpdatedEvent) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Lists all webhook event types that can be subscribed to. -type ListWebhookEventTypesRequest struct { - // The API version for which to list event types. Setting this field overrides the default version used by the application. - APIVersion *string `json:"api_version,omitempty" url:"api_version,omitempty"` +type OrderFulfillmentUpdatedEventData struct { + // Name of the affected object’s type, `"order_fulfillment_updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the affected order. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing information about the updated Order. + Object *OrderFulfillmentUpdatedObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListWebhookEventTypesRequest) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderFulfillmentUpdatedEventData) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListWebhookEventTypesRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListWebhookEventTypesRequest +func (o *OrderFulfillmentUpdatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler OrderFulfillmentUpdatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListWebhookEventTypesRequest(value) + *o = OrderFulfillmentUpdatedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListWebhookEventTypesRequest) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderFulfillmentUpdatedEventData) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Defines the fields that are included in the response body of -// a request to the [ListWebhookEventTypes]($e/WebhookSubscriptions/ListWebhookEventTypes) endpoint. -// -// Note: if there are errors processing the request, the event types field will not be -// present. -type ListWebhookEventTypesResponse struct { - // Information on errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The list of event types. - EventTypes []string `json:"event_types,omitempty" url:"event_types,omitempty"` - // Contains the metadata of a webhook event type. For more information, see [EventTypeMetadata](entity:EventTypeMetadata). - Metadata []*EventTypeMetadata `json:"metadata,omitempty" url:"metadata,omitempty"` +type OrderFulfillmentUpdatedObject struct { + // Information about the updated order fulfillment. + OrderFulfillmentUpdated *OrderFulfillmentUpdated `json:"order_fulfillment_updated,omitempty" url:"order_fulfillment_updated,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListWebhookEventTypesResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderFulfillmentUpdatedObject) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListWebhookEventTypesResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListWebhookEventTypesResponse +func (o *OrderFulfillmentUpdatedObject) UnmarshalJSON(data []byte) error { + type unmarshaler OrderFulfillmentUpdatedObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListWebhookEventTypesResponse(value) + *o = OrderFulfillmentUpdatedObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListWebhookEventTypesResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderFulfillmentUpdatedObject) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Lists all [Subscription]($m/WebhookSubscription)s owned by your application. -type ListWebhookSubscriptionsRequest struct { - // A pagination cursor returned by a previous call to this endpoint. - // Provide this to retrieve the next set of results for your original query. - // - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // Includes disabled [Subscription](entity:WebhookSubscription)s. - // By default, all enabled [Subscription](entity:WebhookSubscription)s are returned. - IncludeDisabled *bool `json:"include_disabled,omitempty" url:"include_disabled,omitempty"` - // Sorts the returned list by when the [Subscription](entity:WebhookSubscription) was created with the specified order. - // This field defaults to ASC. - // See [SortOrder](#type-sortorder) for possible values - SortOrder *SortOrder `json:"sort_order,omitempty" url:"sort_order,omitempty"` - // The maximum number of results to be returned in a single page. - // It is possible to receive fewer results than the specified limit on a given page. - // The default value of 100 is also the maximum allowed value. - // - // Default: 100 - Limit *int `json:"limit,omitempty" url:"limit,omitempty"` +// Information about fulfillment updates. +type OrderFulfillmentUpdatedUpdate struct { + // A unique ID that identifies the fulfillment only within this order. + FulfillmentUID *string `json:"fulfillment_uid,omitempty" url:"fulfillment_uid,omitempty"` + // The state of the fulfillment before the change. + // The state is not populated if the fulfillment is created with this new `Order` version. + OldState *FulfillmentState `json:"old_state,omitempty" url:"old_state,omitempty"` + // The state of the fulfillment after the change. The state might be equal to `old_state` if a non-state + // field was changed on the fulfillment (such as the tracking number). + NewState *FulfillmentState `json:"new_state,omitempty" url:"new_state,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListWebhookSubscriptionsRequest) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderFulfillmentUpdatedUpdate) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListWebhookSubscriptionsRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListWebhookSubscriptionsRequest +func (o *OrderFulfillmentUpdatedUpdate) UnmarshalJSON(data []byte) error { + type unmarshaler OrderFulfillmentUpdatedUpdate var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListWebhookSubscriptionsRequest(value) + *o = OrderFulfillmentUpdatedUpdate(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListWebhookSubscriptionsRequest) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderFulfillmentUpdatedUpdate) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Defines the fields that are included in the response body of -// a request to the [ListWebhookSubscriptions]($e/WebhookSubscriptions/ListWebhookSubscriptions) endpoint. -// -// Note: if there are errors processing the request, the subscriptions field will not be -// present. -type ListWebhookSubscriptionsResponse struct { - // Information on errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The requested list of [Subscription](entity:WebhookSubscription)s. - Subscriptions []*WebhookSubscription `json:"subscriptions,omitempty" url:"subscriptions,omitempty"` - // The pagination cursor to be used in a subsequent request. If empty, - // this is the final response. +// Represents a line item in an order. Each line item describes a different +// product to purchase, with its own quantity and price details. +type OrderLineItem struct { + // A unique ID that identifies the line item only within this order. + UID *string `json:"uid,omitempty" url:"uid,omitempty"` + // The name of the line item. + Name *string `json:"name,omitempty" url:"name,omitempty"` + // The count, or measurement, of a line item being purchased: // - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // If `quantity` is a whole number, and `quantity_unit` is not specified, then `quantity` denotes an item count. For example: `3` apples. + // + // If `quantity` is a whole or decimal number, and `quantity_unit` is also specified, then `quantity` denotes a measurement. For example: `2.25` pounds of broccoli. + // + // For more information, see [Specify item quantity and measurement unit](https://developer.squareup.com/docs/orders-api/create-orders#specify-item-quantity-and-measurement-unit). + // + // Line items with a quantity of `0` are automatically removed + // when paying for or otherwise completing the order. + Quantity string `json:"quantity" url:"quantity"` + // The measurement unit and decimal precision that this line item's quantity is measured in. + QuantityUnit *OrderQuantityUnit `json:"quantity_unit,omitempty" url:"quantity_unit,omitempty"` + // An optional note associated with the line item. + Note *string `json:"note,omitempty" url:"note,omitempty"` + // The [CatalogItemVariation](entity:CatalogItemVariation) ID applied to this line item. + CatalogObjectID *string `json:"catalog_object_id,omitempty" url:"catalog_object_id,omitempty"` + // The version of the catalog object that this line item references. + CatalogVersion *int64 `json:"catalog_version,omitempty" url:"catalog_version,omitempty"` + // The name of the variation applied to this line item. + VariationName *string `json:"variation_name,omitempty" url:"variation_name,omitempty"` + // The type of line item: an itemized sale, a non-itemized sale (custom amount), or the + // activation or reloading of a gift card. + // See [OrderLineItemItemType](#type-orderlineitemitemtype) for possible values + ItemType *OrderLineItemItemType `json:"item_type,omitempty" url:"item_type,omitempty"` + // Application-defined data attached to this line item. Metadata fields are intended + // to store descriptive references or associations with an entity in another system or store brief + // information about the object. Square does not process this field; it only stores and returns it + // in relevant API calls. Do not use metadata to store any sensitive information (such as personally + // identifiable information or card details). + // + // Keys written by applications must be 60 characters or less and must be in the character set + // `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed + // with a namespace, separated from the key with a ':' character. + // + // Values have a maximum length of 255 characters. + // + // An application can have up to 10 entries per metadata field. + // + // Entries written by applications are private and can only be read or modified by the same + // application. + // + // For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). + Metadata map[string]*string `json:"metadata,omitempty" url:"metadata,omitempty"` + // The [CatalogModifier](entity:CatalogModifier)s applied to this line item. + Modifiers []*OrderLineItemModifier `json:"modifiers,omitempty" url:"modifiers,omitempty"` + // The list of references to taxes applied to this line item. Each + // `OrderLineItemAppliedTax` has a `tax_uid` that references the `uid` of a + // top-level `OrderLineItemTax` applied to the line item. On reads, the + // amount applied is populated. + // + // An `OrderLineItemAppliedTax` is automatically created on every line + // item for all `ORDER` scoped taxes added to the order. `OrderLineItemAppliedTax` + // records for `LINE_ITEM` scoped taxes must be added in requests for the tax + // to apply to any line items. + // + // To change the amount of a tax, modify the referenced top-level tax. + AppliedTaxes []*OrderLineItemAppliedTax `json:"applied_taxes,omitempty" url:"applied_taxes,omitempty"` + // The list of references to discounts applied to this line item. Each + // `OrderLineItemAppliedDiscount` has a `discount_uid` that references the `uid` of a top-level + // `OrderLineItemDiscounts` applied to the line item. On reads, the amount + // applied is populated. + // + // An `OrderLineItemAppliedDiscount` is automatically created on every line item for all + // `ORDER` scoped discounts that are added to the order. `OrderLineItemAppliedDiscount` records + // for `LINE_ITEM` scoped discounts must be added in requests for the discount to apply to any + // line items. + // + // To change the amount of a discount, modify the referenced top-level discount. + AppliedDiscounts []*OrderLineItemAppliedDiscount `json:"applied_discounts,omitempty" url:"applied_discounts,omitempty"` + // The list of references to service charges applied to this line item. Each + // `OrderLineItemAppliedServiceCharge` has a `service_charge_id` that references the `uid` of a + // top-level `OrderServiceCharge` applied to the line item. On reads, the amount applied is + // populated. + // + // To change the amount of a service charge, modify the referenced top-level service charge. + AppliedServiceCharges []*OrderLineItemAppliedServiceCharge `json:"applied_service_charges,omitempty" url:"applied_service_charges,omitempty"` + // The base price for a single unit of the line item. + BasePriceMoney *Money `json:"base_price_money,omitempty" url:"base_price_money,omitempty"` + // The total price of all item variations sold in this line item. + // The price is calculated as `base_price_money` multiplied by `quantity`. + // It does not include modifiers. + VariationTotalPriceMoney *Money `json:"variation_total_price_money,omitempty" url:"variation_total_price_money,omitempty"` + // The amount of money made in gross sales for this line item. + // The amount is calculated as the sum of the variation's total price and each modifier's total price. + // For inclusive tax items in the US, Canada, and Japan, tax is deducted from `gross_sales_money`. For Europe and + // Australia, inclusive tax remains as part of the gross sale calculation. + GrossSalesMoney *Money `json:"gross_sales_money,omitempty" url:"gross_sales_money,omitempty"` + // The total amount of tax money to collect for the line item. + TotalTaxMoney *Money `json:"total_tax_money,omitempty" url:"total_tax_money,omitempty"` + // The total amount of discount money to collect for the line item. + TotalDiscountMoney *Money `json:"total_discount_money,omitempty" url:"total_discount_money,omitempty"` + // The total amount of money to collect for this line item. + TotalMoney *Money `json:"total_money,omitempty" url:"total_money,omitempty"` + // Describes pricing adjustments that are blocked from automatic + // application to a line item. For more information, see + // [Apply Taxes and Discounts](https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts). + PricingBlocklists *OrderLineItemPricingBlocklists `json:"pricing_blocklists,omitempty" url:"pricing_blocklists,omitempty"` + // The total amount of apportioned service charge money to collect for the line item. + TotalServiceChargeMoney *Money `json:"total_service_charge_money,omitempty" url:"total_service_charge_money,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListWebhookSubscriptionsResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderLineItem) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListWebhookSubscriptionsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListWebhookSubscriptionsResponse +func (o *OrderLineItem) UnmarshalJSON(data []byte) error { + type unmarshaler OrderLineItem var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListWebhookSubscriptionsResponse(value) + *o = OrderLineItem(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListWebhookSubscriptionsResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderLineItem) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// A request for a set of `WorkweekConfig` objects. -type ListWorkweekConfigsRequest struct { - // The maximum number of `WorkweekConfigs` results to return per page. - Limit *int `json:"limit,omitempty" url:"limit,omitempty"` - // A pointer to the next page of `WorkweekConfig` results to fetch. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` +// Represents an applied portion of a discount to a line item in an order. +// +// Order scoped discounts have automatically applied discounts present for each line item. +// Line-item scoped discounts must have applied discounts added manually for any applicable line +// items. The corresponding applied money is automatically computed based on participating +// line items. +type OrderLineItemAppliedDiscount struct { + // A unique ID that identifies the applied discount only within this order. + UID *string `json:"uid,omitempty" url:"uid,omitempty"` + // The `uid` of the discount that the applied discount represents. It must + // reference a discount present in the `order.discounts` field. + // + // This field is immutable. To change which discounts apply to a line item, + // you must delete the discount and re-add it as a new `OrderLineItemAppliedDiscount`. + DiscountUID string `json:"discount_uid" url:"discount_uid"` + // The amount of money applied by the discount to the line item. + AppliedMoney *Money `json:"applied_money,omitempty" url:"applied_money,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListWorkweekConfigsRequest) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderLineItemAppliedDiscount) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListWorkweekConfigsRequest) UnmarshalJSON(data []byte) error { - type unmarshaler ListWorkweekConfigsRequest +func (o *OrderLineItemAppliedDiscount) UnmarshalJSON(data []byte) error { + type unmarshaler OrderLineItemAppliedDiscount var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListWorkweekConfigsRequest(value) + *o = OrderLineItemAppliedDiscount(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListWorkweekConfigsRequest) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderLineItemAppliedDiscount) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// The response to a request for a set of `WorkweekConfig` objects. The response contains -// the requested `WorkweekConfig` objects and might contain a set of `Error` objects if -// the request resulted in errors. -type ListWorkweekConfigsResponse struct { - // A page of `WorkweekConfig` results. - WorkweekConfigs []*WorkweekConfig `json:"workweek_configs,omitempty" url:"workweek_configs,omitempty"` - // The value supplied in the subsequent request to fetch the next page of - // `WorkweekConfig` results. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +type OrderLineItemAppliedServiceCharge struct { + // A unique ID that identifies the applied service charge only within this order. + UID *string `json:"uid,omitempty" url:"uid,omitempty"` + // The `uid` of the service charge that the applied service charge represents. It must + // reference a service charge present in the `order.service_charges` field. + // + // This field is immutable. To change which service charges apply to a line item, + // delete and add a new `OrderLineItemAppliedServiceCharge`. + ServiceChargeUID string `json:"service_charge_uid" url:"service_charge_uid"` + // The amount of money applied by the service charge to the line item. + AppliedMoney *Money `json:"applied_money,omitempty" url:"applied_money,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *ListWorkweekConfigsResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderLineItemAppliedServiceCharge) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *ListWorkweekConfigsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ListWorkweekConfigsResponse +func (o *OrderLineItemAppliedServiceCharge) UnmarshalJSON(data []byte) error { + type unmarshaler OrderLineItemAppliedServiceCharge var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListWorkweekConfigsResponse(value) + *o = OrderLineItemAppliedServiceCharge(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *ListWorkweekConfigsResponse) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderLineItemAppliedServiceCharge) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). -type Location struct { - // A short generated string of letters and numbers that uniquely identifies this location instance. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The name of the location. - // This information appears in the Seller Dashboard as the nickname. - // A location name must be unique within a seller account. - Name *string `json:"name,omitempty" url:"name,omitempty"` - // The physical address of the location. - Address *Address `json:"address,omitempty" url:"address,omitempty"` - // The [IANA time zone](https://www.iana.org/time-zones) identifier for - // the time zone of the location. For example, `America/Los_Angeles`. - Timezone *string `json:"timezone,omitempty" url:"timezone,omitempty"` - // The Square features that are enabled for the location. - // See [LocationCapability](entity:LocationCapability) for possible values. - // See [LocationCapability](#type-locationcapability) for possible values - Capabilities []LocationCapability `json:"capabilities,omitempty" url:"capabilities,omitempty"` - // The status of the location. - // See [LocationStatus](#type-locationstatus) for possible values - Status *LocationStatus `json:"status,omitempty" url:"status,omitempty"` - // The time when the location was created, in RFC 3339 format. - // For more information, see [Working with Dates](https://developer.squareup.com/docs/build-basics/working-with-dates). - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The ID of the merchant that owns the location. - MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` - // The country of the location, in the two-letter format of ISO 3166. For example, `US` or `JP`. +// Represents an applied portion of a tax to a line item in an order. +// +// Order-scoped taxes automatically include the applied taxes in each line item. +// Line item taxes must be referenced from any applicable line items. +// The corresponding applied money is automatically computed, based on the +// set of participating line items. +type OrderLineItemAppliedTax struct { + // A unique ID that identifies the applied tax only within this order. + UID *string `json:"uid,omitempty" url:"uid,omitempty"` + // The `uid` of the tax for which this applied tax represents. It must reference + // a tax present in the `order.taxes` field. // - // See [Country](entity:Country) for possible values. - // See [Country](#type-country) for possible values - Country *Country `json:"country,omitempty" url:"country,omitempty"` - // The language associated with the location, in - // [BCP 47 format](https://tools.ietf.org/html/bcp47#appendix-A). - // For more information, see [Language Preferences](https://developer.squareup.com/docs/build-basics/general-considerations/language-preferences). - LanguageCode *string `json:"language_code,omitempty" url:"language_code,omitempty"` - // The currency used for all transactions at this location, - // in ISO 4217 format. For example, the currency code for US dollars is `USD`. - // See [Currency](entity:Currency) for possible values. - // See [Currency](#type-currency) for possible values - Currency *Currency `json:"currency,omitempty" url:"currency,omitempty"` - // The phone number of the location. For example, `+1 855-700-6000`. - PhoneNumber *string `json:"phone_number,omitempty" url:"phone_number,omitempty"` - // The name of the location's overall business. This name is present on receipts and other customer-facing branding, and can be changed no more than three times in a twelve-month period. - BusinessName *string `json:"business_name,omitempty" url:"business_name,omitempty"` - // The type of the location. - // See [LocationType](#type-locationtype) for possible values - Type *LocationType `json:"type,omitempty" url:"type,omitempty"` - // The website URL of the location. For example, `https://squareup.com`. - WebsiteURL *string `json:"website_url,omitempty" url:"website_url,omitempty"` - // The hours of operation for the location. - BusinessHours *BusinessHours `json:"business_hours,omitempty" url:"business_hours,omitempty"` - // The email address of the location. This can be unique to the location and is not always the email address for the business owner or administrator. - BusinessEmail *string `json:"business_email,omitempty" url:"business_email,omitempty"` - // The description of the location. For example, `Main Street location`. - Description *string `json:"description,omitempty" url:"description,omitempty"` - // The Twitter username of the location without the '@' symbol. For example, `Square`. - TwitterUsername *string `json:"twitter_username,omitempty" url:"twitter_username,omitempty"` - // The Instagram username of the location without the '@' symbol. For example, `square`. - InstagramUsername *string `json:"instagram_username,omitempty" url:"instagram_username,omitempty"` - // The Facebook profile URL of the location. The URL should begin with 'facebook.com/'. For example, `https://www.facebook.com/square`. - FacebookURL *string `json:"facebook_url,omitempty" url:"facebook_url,omitempty"` - // The physical coordinates (latitude and longitude) of the location. - Coordinates *Coordinates `json:"coordinates,omitempty" url:"coordinates,omitempty"` - // The URL of the logo image for the location. When configured in the Seller - // Dashboard (Receipts section), the logo appears on transactions (such as receipts and invoices) that Square generates on behalf of the seller. - // This image should have a roughly square (1:1) aspect ratio and should be at least 200x200 pixels. - LogoURL *string `json:"logo_url,omitempty" url:"logo_url,omitempty"` - // The URL of the Point of Sale background image for the location. - PosBackgroundURL *string `json:"pos_background_url,omitempty" url:"pos_background_url,omitempty"` - // A four-digit number that describes the kind of goods or services sold at the location. - // The [merchant category code (MCC)](https://developer.squareup.com/docs/locations-api#initialize-a-merchant-category-code) of the location as standardized by ISO 18245. - // For example, `5045`, for a location that sells computer goods and software. - Mcc *string `json:"mcc,omitempty" url:"mcc,omitempty"` - // The URL of a full-format logo image for the location. When configured in the Seller - // Dashboard (Receipts section), the logo appears on transactions (such as receipts and invoices) that Square generates on behalf of the seller. - // This image can be wider than it is tall and should be at least 1280x648 pixels. - FullFormatLogoURL *string `json:"full_format_logo_url,omitempty" url:"full_format_logo_url,omitempty"` - // The tax IDs for this location. - TaxIDs *TaxIDs `json:"tax_ids,omitempty" url:"tax_ids,omitempty"` + // This field is immutable. To change which taxes apply to a line item, delete and add a new + // `OrderLineItemAppliedTax`. + TaxUID string `json:"tax_uid" url:"tax_uid"` + // The amount of money applied by the tax to the line item. + AppliedMoney *Money `json:"applied_money,omitempty" url:"applied_money,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *Location) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderLineItemAppliedTax) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *Location) UnmarshalJSON(data []byte) error { - type unmarshaler Location +func (o *OrderLineItemAppliedTax) UnmarshalJSON(data []byte) error { + type unmarshaler OrderLineItemAppliedTax var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = Location(value) + *o = OrderLineItemAppliedTax(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *Location) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderLineItemAppliedTax) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// The booking profile of a seller's location, including the location's ID and whether the location is enabled for online booking. -type LocationBookingProfile struct { - // The ID of the [location](entity:Location). - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` - // Url for the online booking site for this location. - BookingSiteURL *string `json:"booking_site_url,omitempty" url:"booking_site_url,omitempty"` - // Indicates whether the location is enabled for online booking. - OnlineBookingEnabled *bool `json:"online_booking_enabled,omitempty" url:"online_booking_enabled,omitempty"` +// Represents a discount that applies to one or more line items in an +// order. +// +// Fixed-amount, order-scoped discounts are distributed across all non-zero line item totals. +// The amount distributed to each line item is relative to the +// amount contributed by the item to the order subtotal. +type OrderLineItemDiscount struct { + // A unique ID that identifies the discount only within this order. + UID *string `json:"uid,omitempty" url:"uid,omitempty"` + // The catalog object ID referencing [CatalogDiscount](entity:CatalogDiscount). + CatalogObjectID *string `json:"catalog_object_id,omitempty" url:"catalog_object_id,omitempty"` + // The version of the catalog object that this discount references. + CatalogVersion *int64 `json:"catalog_version,omitempty" url:"catalog_version,omitempty"` + // The discount's name. + Name *string `json:"name,omitempty" url:"name,omitempty"` + // The type of the discount. + // + // Discounts that do not reference a catalog object ID must have a type of + // `FIXED_PERCENTAGE` or `FIXED_AMOUNT`. + // See [OrderLineItemDiscountType](#type-orderlineitemdiscounttype) for possible values + Type *OrderLineItemDiscountType `json:"type,omitempty" url:"type,omitempty"` + // The percentage of the discount, as a string representation of a decimal number. + // A value of `7.25` corresponds to a percentage of 7.25%. + // + // `percentage` is not set for amount-based discounts. + Percentage *string `json:"percentage,omitempty" url:"percentage,omitempty"` + // The total declared monetary amount of the discount. + // + // `amount_money` is not set for percentage-based discounts. + AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` + // The amount of discount actually applied to the line item. + // + // The amount represents the amount of money applied as a line-item scoped discount. + // When an amount-based discount is scoped to the entire order, the value + // of `applied_money` is different than `amount_money` because the total + // amount of the discount is distributed across all line items. + AppliedMoney *Money `json:"applied_money,omitempty" url:"applied_money,omitempty"` + // Application-defined data attached to this discount. Metadata fields are intended + // to store descriptive references or associations with an entity in another system or store brief + // information about the object. Square does not process this field; it only stores and returns it + // in relevant API calls. Do not use metadata to store any sensitive information (such as personally + // identifiable information or card details). + // + // Keys written by applications must be 60 characters or less and must be in the character set + // `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed + // with a namespace, separated from the key with a ':' character. + // + // Values have a maximum length of 255 characters. + // + // An application can have up to 10 entries per metadata field. + // + // Entries written by applications are private and can only be read or modified by the same + // application. + // + // For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). + Metadata map[string]*string `json:"metadata,omitempty" url:"metadata,omitempty"` + // Indicates the level at which the discount applies. For `ORDER` scoped discounts, + // Square generates references in `applied_discounts` on all order line items that do + // not have them. For `LINE_ITEM` scoped discounts, the discount only applies to line items + // with a discount reference in their `applied_discounts` field. + // + // This field is immutable. To change the scope of a discount, you must delete + // the discount and re-add it as a new discount. + // See [OrderLineItemDiscountScope](#type-orderlineitemdiscountscope) for possible values + Scope *OrderLineItemDiscountScope `json:"scope,omitempty" url:"scope,omitempty"` + // The reward IDs corresponding to this discount. The application and + // specification of discounts that have `reward_ids` are completely controlled by the backing + // criteria corresponding to the reward tiers of the rewards that are added to the order + // through the Loyalty API. To manually unapply discounts that are the result of added rewards, + // the rewards must be removed from the order through the Loyalty API. + RewardIDs []string `json:"reward_ids,omitempty" url:"reward_ids,omitempty"` + // The object ID of a [pricing rule](entity:CatalogPricingRule) to be applied + // automatically to this discount. The specification and application of the discounts, to + // which a `pricing_rule_id` is assigned, are completely controlled by the corresponding + // pricing rule. + PricingRuleID *string `json:"pricing_rule_id,omitempty" url:"pricing_rule_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LocationBookingProfile) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderLineItemDiscount) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *LocationBookingProfile) UnmarshalJSON(data []byte) error { - type unmarshaler LocationBookingProfile +func (o *OrderLineItemDiscount) UnmarshalJSON(data []byte) error { + type unmarshaler OrderLineItemDiscount var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LocationBookingProfile(value) + *o = OrderLineItemDiscount(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *LocationBookingProfile) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderLineItemDiscount) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// The capabilities a location might have. -type LocationCapability string +// Indicates whether this is a line-item or order-level discount. +type OrderLineItemDiscountScope string const ( - LocationCapabilityCreditCardProcessing LocationCapability = "CREDIT_CARD_PROCESSING" - LocationCapabilityAutomaticTransfers LocationCapability = "AUTOMATIC_TRANSFERS" - LocationCapabilityUnlinkedRefunds LocationCapability = "UNLINKED_REFUNDS" + OrderLineItemDiscountScopeOtherDiscountScope OrderLineItemDiscountScope = "OTHER_DISCOUNT_SCOPE" + OrderLineItemDiscountScopeLineItem OrderLineItemDiscountScope = "LINE_ITEM" + OrderLineItemDiscountScopeOrder OrderLineItemDiscountScope = "ORDER" ) -func NewLocationCapabilityFromString(s string) (LocationCapability, error) { +func NewOrderLineItemDiscountScopeFromString(s string) (OrderLineItemDiscountScope, error) { switch s { - case "CREDIT_CARD_PROCESSING": - return LocationCapabilityCreditCardProcessing, nil - case "AUTOMATIC_TRANSFERS": - return LocationCapabilityAutomaticTransfers, nil - case "UNLINKED_REFUNDS": - return LocationCapabilityUnlinkedRefunds, nil + case "OTHER_DISCOUNT_SCOPE": + return OrderLineItemDiscountScopeOtherDiscountScope, nil + case "LINE_ITEM": + return OrderLineItemDiscountScopeLineItem, nil + case "ORDER": + return OrderLineItemDiscountScopeOrder, nil } - var t LocationCapability + var t OrderLineItemDiscountScope return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (l LocationCapability) Ptr() *LocationCapability { - return &l +func (o OrderLineItemDiscountScope) Ptr() *OrderLineItemDiscountScope { + return &o } -// A location's status. -type LocationStatus string +// Indicates how the discount is applied to the associated line item or order. +type OrderLineItemDiscountType string const ( - LocationStatusActive LocationStatus = "ACTIVE" - LocationStatusInactive LocationStatus = "INACTIVE" + OrderLineItemDiscountTypeUnknownDiscount OrderLineItemDiscountType = "UNKNOWN_DISCOUNT" + OrderLineItemDiscountTypeFixedPercentage OrderLineItemDiscountType = "FIXED_PERCENTAGE" + OrderLineItemDiscountTypeFixedAmount OrderLineItemDiscountType = "FIXED_AMOUNT" + OrderLineItemDiscountTypeVariablePercentage OrderLineItemDiscountType = "VARIABLE_PERCENTAGE" + OrderLineItemDiscountTypeVariableAmount OrderLineItemDiscountType = "VARIABLE_AMOUNT" ) -func NewLocationStatusFromString(s string) (LocationStatus, error) { +func NewOrderLineItemDiscountTypeFromString(s string) (OrderLineItemDiscountType, error) { switch s { - case "ACTIVE": - return LocationStatusActive, nil - case "INACTIVE": - return LocationStatusInactive, nil + case "UNKNOWN_DISCOUNT": + return OrderLineItemDiscountTypeUnknownDiscount, nil + case "FIXED_PERCENTAGE": + return OrderLineItemDiscountTypeFixedPercentage, nil + case "FIXED_AMOUNT": + return OrderLineItemDiscountTypeFixedAmount, nil + case "VARIABLE_PERCENTAGE": + return OrderLineItemDiscountTypeVariablePercentage, nil + case "VARIABLE_AMOUNT": + return OrderLineItemDiscountTypeVariableAmount, nil + } + var t OrderLineItemDiscountType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (o OrderLineItemDiscountType) Ptr() *OrderLineItemDiscountType { + return &o +} + +// Represents the line item type. +type OrderLineItemItemType string + +const ( + OrderLineItemItemTypeDoNotUse OrderLineItemItemType = "DO_NOT_USE" + OrderLineItemItemTypeItem OrderLineItemItemType = "ITEM" + OrderLineItemItemTypeCustomAmount OrderLineItemItemType = "CUSTOM_AMOUNT" + OrderLineItemItemTypeGiftCard OrderLineItemItemType = "GIFT_CARD" + OrderLineItemItemTypeCreditPackage OrderLineItemItemType = "CREDIT_PACKAGE" +) + +func NewOrderLineItemItemTypeFromString(s string) (OrderLineItemItemType, error) { + switch s { + case "DO_NOT_USE": + return OrderLineItemItemTypeDoNotUse, nil + case "ITEM": + return OrderLineItemItemTypeItem, nil + case "CUSTOM_AMOUNT": + return OrderLineItemItemTypeCustomAmount, nil + case "GIFT_CARD": + return OrderLineItemItemTypeGiftCard, nil + case "CREDIT_PACKAGE": + return OrderLineItemItemTypeCreditPackage, nil + } + var t OrderLineItemItemType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (o OrderLineItemItemType) Ptr() *OrderLineItemItemType { + return &o +} + +// A [CatalogModifier](entity:CatalogModifier). +type OrderLineItemModifier struct { + // A unique ID that identifies the modifier only within this order. + UID *string `json:"uid,omitempty" url:"uid,omitempty"` + // The catalog object ID referencing [CatalogModifier](entity:CatalogModifier). + CatalogObjectID *string `json:"catalog_object_id,omitempty" url:"catalog_object_id,omitempty"` + // The version of the catalog object that this modifier references. + CatalogVersion *int64 `json:"catalog_version,omitempty" url:"catalog_version,omitempty"` + // The name of the item modifier. + Name *string `json:"name,omitempty" url:"name,omitempty"` + // The quantity of the line item modifier. The modifier quantity can be 0 or more. + // For example, suppose a restaurant offers a cheeseburger on the menu. When a buyer orders + // this item, the restaurant records the purchase by creating an `Order` object with a line item + // for a burger. The line item includes a line item modifier: the name is cheese and the quantity + // is 1. The buyer has the option to order extra cheese (or no cheese). If the buyer chooses + // the extra cheese option, the modifier quantity increases to 2. If the buyer does not want + // any cheese, the modifier quantity is set to 0. + Quantity *string `json:"quantity,omitempty" url:"quantity,omitempty"` + // The base price for the modifier. + // + // `base_price_money` is required for ad hoc modifiers. + // If both `catalog_object_id` and `base_price_money` are set, `base_price_money` will + // override the predefined [CatalogModifier](entity:CatalogModifier) price. + BasePriceMoney *Money `json:"base_price_money,omitempty" url:"base_price_money,omitempty"` + // The total price of the item modifier for its line item. + // This is the modifier's `base_price_money` multiplied by the line item's quantity. + TotalPriceMoney *Money `json:"total_price_money,omitempty" url:"total_price_money,omitempty"` + // Application-defined data attached to this order. Metadata fields are intended + // to store descriptive references or associations with an entity in another system or store brief + // information about the object. Square does not process this field; it only stores and returns it + // in relevant API calls. Do not use metadata to store any sensitive information (such as personally + // identifiable information or card details). + // + // Keys written by applications must be 60 characters or less and must be in the character set + // `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed + // with a namespace, separated from the key with a ':' character. + // + // Values have a maximum length of 255 characters. + // + // An application can have up to 10 entries per metadata field. + // + // Entries written by applications are private and can only be read or modified by the same + // application. + // + // For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). + Metadata map[string]*string `json:"metadata,omitempty" url:"metadata,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (o *OrderLineItemModifier) GetExtraProperties() map[string]interface{} { + return o.extraProperties +} + +func (o *OrderLineItemModifier) UnmarshalJSON(data []byte) error { + type unmarshaler OrderLineItemModifier + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *o = OrderLineItemModifier(value) + + extraProperties, err := core.ExtractExtraProperties(data, *o) + if err != nil { + return err + } + o.extraProperties = extraProperties + + o._rawJSON = json.RawMessage(data) + return nil +} + +func (o *OrderLineItemModifier) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { + return value + } } - var t LocationStatus - return "", fmt.Errorf("%s is not a valid %T", s, t) + if value, err := core.StringifyJSON(o); err == nil { + return value + } + return fmt.Sprintf("%#v", o) } -func (l LocationStatus) Ptr() *LocationStatus { - return &l +// Describes pricing adjustments that are blocked from automatic +// application to a line item. For more information, see +// [Apply Taxes and Discounts](https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts). +type OrderLineItemPricingBlocklists struct { + // A list of discounts blocked from applying to the line item. + // Discounts can be blocked by the `discount_uid` (for ad hoc discounts) or + // the `discount_catalog_object_id` (for catalog discounts). + BlockedDiscounts []*OrderLineItemPricingBlocklistsBlockedDiscount `json:"blocked_discounts,omitempty" url:"blocked_discounts,omitempty"` + // A list of taxes blocked from applying to the line item. + // Taxes can be blocked by the `tax_uid` (for ad hoc taxes) or + // the `tax_catalog_object_id` (for catalog taxes). + BlockedTaxes []*OrderLineItemPricingBlocklistsBlockedTax `json:"blocked_taxes,omitempty" url:"blocked_taxes,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage } -// A location's type. -type LocationType string +func (o *OrderLineItemPricingBlocklists) GetExtraProperties() map[string]interface{} { + return o.extraProperties +} -const ( - LocationTypePhysical LocationType = "PHYSICAL" - LocationTypeMobile LocationType = "MOBILE" -) +func (o *OrderLineItemPricingBlocklists) UnmarshalJSON(data []byte) error { + type unmarshaler OrderLineItemPricingBlocklists + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *o = OrderLineItemPricingBlocklists(value) -func NewLocationTypeFromString(s string) (LocationType, error) { - switch s { - case "PHYSICAL": - return LocationTypePhysical, nil - case "MOBILE": - return LocationTypeMobile, nil + extraProperties, err := core.ExtractExtraProperties(data, *o) + if err != nil { + return err } - var t LocationType - return "", fmt.Errorf("%s is not a valid %T", s, t) + o.extraProperties = extraProperties + + o._rawJSON = json.RawMessage(data) + return nil } -func (l LocationType) Ptr() *LocationType { - return &l +func (o *OrderLineItemPricingBlocklists) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(o); err == nil { + return value + } + return fmt.Sprintf("%#v", o) } -// Describes a loyalty account in a [loyalty program]($m/LoyaltyProgram). For more information, see -// [Create and Retrieve Loyalty Accounts](https://developer.squareup.com/docs/loyalty-api/loyalty-accounts). -type LoyaltyAccount struct { - // The Square-assigned ID of the loyalty account. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram) to which the account belongs. - ProgramID string `json:"program_id" url:"program_id"` - // The available point balance in the loyalty account. If points are scheduled to expire, they are listed in the `expiring_point_deadlines` field. - // - // Your application should be able to handle loyalty accounts that have a negative point balance (`balance` is less than 0). This might occur if a seller makes a manual adjustment or as a result of a refund or exchange. - Balance *int `json:"balance,omitempty" url:"balance,omitempty"` - // The total points accrued during the lifetime of the account. - LifetimePoints *int `json:"lifetime_points,omitempty" url:"lifetime_points,omitempty"` - // The Square-assigned ID of the [customer](entity:Customer) that is associated with the account. - CustomerID *string `json:"customer_id,omitempty" url:"customer_id,omitempty"` - // The timestamp when the buyer joined the loyalty program, in RFC 3339 format. This field is used to display the **Enrolled On** or **Member Since** date in first-party Square products. - // - // If this field is not set in a `CreateLoyaltyAccount` request, Square populates it after the buyer's first action on their account - // (when `AccumulateLoyaltyPoints` or `CreateLoyaltyReward` is called). In first-party flows, Square populates the field when the buyer agrees to the terms of service in Square Point of Sale. - // - // This field is typically specified in a `CreateLoyaltyAccount` request when creating a loyalty account for a buyer who already interacted with their account. - // For example, you would set this field when migrating accounts from an external system. The timestamp in the request can represent a current or previous date and time, but it cannot be set for the future. - EnrolledAt *string `json:"enrolled_at,omitempty" url:"enrolled_at,omitempty"` - // The timestamp when the loyalty account was created, in RFC 3339 format. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The timestamp when the loyalty account was last updated, in RFC 3339 format. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` - // The mapping that associates the loyalty account with a buyer. Currently, - // a loyalty account can only be mapped to a buyer by phone number. - // - // To create a loyalty account, you must specify the `mapping` field, with the buyer's phone number - // in the `phone_number` field. - Mapping *LoyaltyAccountMapping `json:"mapping,omitempty" url:"mapping,omitempty"` - // The schedule for when points expire in the loyalty account balance. This field is present only if the account has points that are scheduled to expire. - // - // The total number of points in this field equals the number of points in the `balance` field. - ExpiringPointDeadlines []*LoyaltyAccountExpiringPointDeadline `json:"expiring_point_deadlines,omitempty" url:"expiring_point_deadlines,omitempty"` +// A discount to block from applying to a line item. The discount must be +// identified by either `discount_uid` or `discount_catalog_object_id`, but not both. +type OrderLineItemPricingBlocklistsBlockedDiscount struct { + // A unique ID of the `BlockedDiscount` within the order. + UID *string `json:"uid,omitempty" url:"uid,omitempty"` + // The `uid` of the discount that should be blocked. Use this field to block + // ad hoc discounts. For catalog discounts, use the `discount_catalog_object_id` field. + DiscountUID *string `json:"discount_uid,omitempty" url:"discount_uid,omitempty"` + // The `catalog_object_id` of the discount that should be blocked. + // Use this field to block catalog discounts. For ad hoc discounts, use the + // `discount_uid` field. + DiscountCatalogObjectID *string `json:"discount_catalog_object_id,omitempty" url:"discount_catalog_object_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyAccount) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderLineItemPricingBlocklistsBlockedDiscount) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *LoyaltyAccount) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyAccount +func (o *OrderLineItemPricingBlocklistsBlockedDiscount) UnmarshalJSON(data []byte) error { + type unmarshaler OrderLineItemPricingBlocklistsBlockedDiscount var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyAccount(value) + *o = OrderLineItemPricingBlocklistsBlockedDiscount(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyAccount) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderLineItemPricingBlocklistsBlockedDiscount) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Represents a set of points for a loyalty account that are scheduled to expire on a specific date. -type LoyaltyAccountExpiringPointDeadline struct { - // The number of points scheduled to expire at the `expires_at` timestamp. - Points int `json:"points" url:"points"` - // The timestamp of when the points are scheduled to expire, in RFC 3339 format. - ExpiresAt string `json:"expires_at" url:"expires_at"` +// A tax to block from applying to a line item. The tax must be +// identified by either `tax_uid` or `tax_catalog_object_id`, but not both. +type OrderLineItemPricingBlocklistsBlockedTax struct { + // A unique ID of the `BlockedTax` within the order. + UID *string `json:"uid,omitempty" url:"uid,omitempty"` + // The `uid` of the tax that should be blocked. Use this field to block + // ad hoc taxes. For catalog, taxes use the `tax_catalog_object_id` field. + TaxUID *string `json:"tax_uid,omitempty" url:"tax_uid,omitempty"` + // The `catalog_object_id` of the tax that should be blocked. + // Use this field to block catalog taxes. For ad hoc taxes, use the + // `tax_uid` field. + TaxCatalogObjectID *string `json:"tax_catalog_object_id,omitempty" url:"tax_catalog_object_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyAccountExpiringPointDeadline) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderLineItemPricingBlocklistsBlockedTax) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *LoyaltyAccountExpiringPointDeadline) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyAccountExpiringPointDeadline +func (o *OrderLineItemPricingBlocklistsBlockedTax) UnmarshalJSON(data []byte) error { + type unmarshaler OrderLineItemPricingBlocklistsBlockedTax var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyAccountExpiringPointDeadline(value) + *o = OrderLineItemPricingBlocklistsBlockedTax(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyAccountExpiringPointDeadline) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderLineItemPricingBlocklistsBlockedTax) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Represents the mapping that associates a loyalty account with a buyer. +// Represents a tax that applies to one or more line item in the order. // -// Currently, a loyalty account can only be mapped to a buyer by phone number. For more information, see -// [Loyalty Overview](https://developer.squareup.com/docs/loyalty/overview). -type LoyaltyAccountMapping struct { - // The Square-assigned ID of the mapping. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The timestamp when the mapping was created, in RFC 3339 format. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The phone number of the buyer, in E.164 format. For example, "+14155551111". - PhoneNumber *string `json:"phone_number,omitempty" url:"phone_number,omitempty"` +// Fixed-amount, order-scoped taxes are distributed across all non-zero line item totals. +// The amount distributed to each line item is relative to the amount the item +// contributes to the order subtotal. +type OrderLineItemTax struct { + // A unique ID that identifies the tax only within this order. + UID *string `json:"uid,omitempty" url:"uid,omitempty"` + // The catalog object ID referencing [CatalogTax](entity:CatalogTax). + CatalogObjectID *string `json:"catalog_object_id,omitempty" url:"catalog_object_id,omitempty"` + // The version of the catalog object that this tax references. + CatalogVersion *int64 `json:"catalog_version,omitempty" url:"catalog_version,omitempty"` + // The tax's name. + Name *string `json:"name,omitempty" url:"name,omitempty"` + // Indicates the calculation method used to apply the tax. + // See [OrderLineItemTaxType](#type-orderlineitemtaxtype) for possible values + Type *OrderLineItemTaxType `json:"type,omitempty" url:"type,omitempty"` + // The percentage of the tax, as a string representation of a decimal + // number. For example, a value of `"7.25"` corresponds to a percentage of + // 7.25%. + Percentage *string `json:"percentage,omitempty" url:"percentage,omitempty"` + // Application-defined data attached to this tax. Metadata fields are intended + // to store descriptive references or associations with an entity in another system or store brief + // information about the object. Square does not process this field; it only stores and returns it + // in relevant API calls. Do not use metadata to store any sensitive information (such as personally + // identifiable information or card details). + // + // Keys written by applications must be 60 characters or less and must be in the character set + // `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed + // with a namespace, separated from the key with a ':' character. + // + // Values have a maximum length of 255 characters. + // + // An application can have up to 10 entries per metadata field. + // + // Entries written by applications are private and can only be read or modified by the same + // application. + // + // For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). + Metadata map[string]*string `json:"metadata,omitempty" url:"metadata,omitempty"` + // The amount of money applied to the order by the tax. + // + // - For percentage-based taxes, `applied_money` is the money + // calculated using the percentage. + AppliedMoney *Money `json:"applied_money,omitempty" url:"applied_money,omitempty"` + // Indicates the level at which the tax applies. For `ORDER` scoped taxes, + // Square generates references in `applied_taxes` on all order line items that do + // not have them. For `LINE_ITEM` scoped taxes, the tax only applies to line items + // with references in their `applied_taxes` field. + // + // This field is immutable. To change the scope, you must delete the tax and + // re-add it as a new tax. + // See [OrderLineItemTaxScope](#type-orderlineitemtaxscope) for possible values + Scope *OrderLineItemTaxScope `json:"scope,omitempty" url:"scope,omitempty"` + // Determines whether the tax was automatically applied to the order based on + // the catalog configuration. For an example, see + // [Automatically Apply Taxes to an Order](https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts/auto-apply-taxes). + AutoApplied *bool `json:"auto_applied,omitempty" url:"auto_applied,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyAccountMapping) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderLineItemTax) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *LoyaltyAccountMapping) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyAccountMapping +func (o *OrderLineItemTax) UnmarshalJSON(data []byte) error { + type unmarshaler OrderLineItemTax var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyAccountMapping(value) + *o = OrderLineItemTax(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyAccountMapping) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderLineItemTax) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// The type of mapping. -type LoyaltyAccountMappingType = string +// Indicates whether this is a line-item or order-level tax. +type OrderLineItemTaxScope string -// Provides information about a loyalty event. -// For more information, see [Search for Balance-Changing Loyalty Events](https://developer.squareup.com/docs/loyalty-api/loyalty-events). -type LoyaltyEvent struct { - // The Square-assigned ID of the loyalty event. - ID string `json:"id" url:"id"` - // The type of the loyalty event. - // See [LoyaltyEventType](#type-loyaltyeventtype) for possible values - Type LoyaltyEventType `json:"type" url:"type"` - // The timestamp when the event was created, in RFC 3339 format. - CreatedAt string `json:"created_at" url:"created_at"` - // Provides metadata when the event `type` is `ACCUMULATE_POINTS`. - AccumulatePoints *LoyaltyEventAccumulatePoints `json:"accumulate_points,omitempty" url:"accumulate_points,omitempty"` - // Provides metadata when the event `type` is `CREATE_REWARD`. - CreateReward *LoyaltyEventCreateReward `json:"create_reward,omitempty" url:"create_reward,omitempty"` - // Provides metadata when the event `type` is `REDEEM_REWARD`. - RedeemReward *LoyaltyEventRedeemReward `json:"redeem_reward,omitempty" url:"redeem_reward,omitempty"` - // Provides metadata when the event `type` is `DELETE_REWARD`. - DeleteReward *LoyaltyEventDeleteReward `json:"delete_reward,omitempty" url:"delete_reward,omitempty"` - // Provides metadata when the event `type` is `ADJUST_POINTS`. - AdjustPoints *LoyaltyEventAdjustPoints `json:"adjust_points,omitempty" url:"adjust_points,omitempty"` - // The ID of the [loyalty account](entity:LoyaltyAccount) associated with the event. - LoyaltyAccountID string `json:"loyalty_account_id" url:"loyalty_account_id"` - // The ID of the [location](entity:Location) where the event occurred. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` - // Defines whether the event was generated by the Square Point of Sale. - // See [LoyaltyEventSource](#type-loyaltyeventsource) for possible values - Source LoyaltyEventSource `json:"source" url:"source"` - // Provides metadata when the event `type` is `EXPIRE_POINTS`. - ExpirePoints *LoyaltyEventExpirePoints `json:"expire_points,omitempty" url:"expire_points,omitempty"` - // Provides metadata when the event `type` is `OTHER`. - OtherEvent *LoyaltyEventOther `json:"other_event,omitempty" url:"other_event,omitempty"` - // Provides metadata when the event `type` is `ACCUMULATE_PROMOTION_POINTS`. - AccumulatePromotionPoints *LoyaltyEventAccumulatePromotionPoints `json:"accumulate_promotion_points,omitempty" url:"accumulate_promotion_points,omitempty"` +const ( + OrderLineItemTaxScopeOtherTaxScope OrderLineItemTaxScope = "OTHER_TAX_SCOPE" + OrderLineItemTaxScopeLineItem OrderLineItemTaxScope = "LINE_ITEM" + OrderLineItemTaxScopeOrder OrderLineItemTaxScope = "ORDER" +) + +func NewOrderLineItemTaxScopeFromString(s string) (OrderLineItemTaxScope, error) { + switch s { + case "OTHER_TAX_SCOPE": + return OrderLineItemTaxScopeOtherTaxScope, nil + case "LINE_ITEM": + return OrderLineItemTaxScopeLineItem, nil + case "ORDER": + return OrderLineItemTaxScopeOrder, nil + } + var t OrderLineItemTaxScope + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (o OrderLineItemTaxScope) Ptr() *OrderLineItemTaxScope { + return &o +} + +// Indicates how the tax is applied to the associated line item or order. +type OrderLineItemTaxType string + +const ( + OrderLineItemTaxTypeUnknownTax OrderLineItemTaxType = "UNKNOWN_TAX" + OrderLineItemTaxTypeAdditive OrderLineItemTaxType = "ADDITIVE" + OrderLineItemTaxTypeInclusive OrderLineItemTaxType = "INCLUSIVE" +) + +func NewOrderLineItemTaxTypeFromString(s string) (OrderLineItemTaxType, error) { + switch s { + case "UNKNOWN_TAX": + return OrderLineItemTaxTypeUnknownTax, nil + case "ADDITIVE": + return OrderLineItemTaxTypeAdditive, nil + case "INCLUSIVE": + return OrderLineItemTaxTypeInclusive, nil + } + var t OrderLineItemTaxType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (o OrderLineItemTaxType) Ptr() *OrderLineItemTaxType { + return &o +} + +// A collection of various money amounts. +type OrderMoneyAmounts struct { + // The total money. + TotalMoney *Money `json:"total_money,omitempty" url:"total_money,omitempty"` + // The money associated with taxes. + TaxMoney *Money `json:"tax_money,omitempty" url:"tax_money,omitempty"` + // The money associated with discounts. + DiscountMoney *Money `json:"discount_money,omitempty" url:"discount_money,omitempty"` + // The money associated with tips. + TipMoney *Money `json:"tip_money,omitempty" url:"tip_money,omitempty"` + // The money associated with service charges. + ServiceChargeMoney *Money `json:"service_charge_money,omitempty" url:"service_charge_money,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyEvent) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderMoneyAmounts) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *LoyaltyEvent) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyEvent +func (o *OrderMoneyAmounts) UnmarshalJSON(data []byte) error { + type unmarshaler OrderMoneyAmounts var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyEvent(value) + *o = OrderMoneyAmounts(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyEvent) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderMoneyAmounts) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Provides metadata when the event `type` is `ACCUMULATE_POINTS`. -type LoyaltyEventAccumulatePoints struct { - // The ID of the [loyalty program](entity:LoyaltyProgram). - LoyaltyProgramID *string `json:"loyalty_program_id,omitempty" url:"loyalty_program_id,omitempty"` - // The number of points accumulated by the event. - Points *int `json:"points,omitempty" url:"points,omitempty"` - // The ID of the [order](entity:Order) for which the buyer accumulated the points. - // This field is returned only if the Orders API is used to process orders. - OrderID *string `json:"order_id,omitempty" url:"order_id,omitempty"` +// Pricing options for an order. The options affect how the order's price is calculated. +// They can be used, for example, to apply automatic price adjustments that are based on preconfigured +// [pricing rules](entity:CatalogPricingRule). +type OrderPricingOptions struct { + // The option to determine whether pricing rule-based + // discounts are automatically applied to an order. + AutoApplyDiscounts *bool `json:"auto_apply_discounts,omitempty" url:"auto_apply_discounts,omitempty"` + // The option to determine whether rule-based taxes are automatically + // applied to an order when the criteria of the corresponding rules are met. + AutoApplyTaxes *bool `json:"auto_apply_taxes,omitempty" url:"auto_apply_taxes,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyEventAccumulatePoints) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderPricingOptions) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *LoyaltyEventAccumulatePoints) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyEventAccumulatePoints +func (o *OrderPricingOptions) UnmarshalJSON(data []byte) error { + type unmarshaler OrderPricingOptions var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyEventAccumulatePoints(value) + *o = OrderPricingOptions(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyEventAccumulatePoints) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderPricingOptions) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Provides metadata when the event `type` is `ACCUMULATE_PROMOTION_POINTS`. -type LoyaltyEventAccumulatePromotionPoints struct { - // The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram). - LoyaltyProgramID *string `json:"loyalty_program_id,omitempty" url:"loyalty_program_id,omitempty"` - // The Square-assigned ID of the [loyalty promotion](entity:LoyaltyPromotion). - LoyaltyPromotionID *string `json:"loyalty_promotion_id,omitempty" url:"loyalty_promotion_id,omitempty"` - // The number of points earned by the event. - Points int `json:"points" url:"points"` - // The ID of the [order](entity:Order) for which the buyer earned the promotion points. - // Only applications that use the Orders API to process orders can trigger this event. - OrderID string `json:"order_id" url:"order_id"` +// Contains the measurement unit for a quantity and a precision that +// specifies the number of digits after the decimal point for decimal quantities. +type OrderQuantityUnit struct { + // A [MeasurementUnit](entity:MeasurementUnit) that represents the + // unit of measure for the quantity. + MeasurementUnit *MeasurementUnit `json:"measurement_unit,omitempty" url:"measurement_unit,omitempty"` + // For non-integer quantities, represents the number of digits after the decimal point that are + // recorded for this quantity. + // + // For example, a precision of 1 allows quantities such as `"1.0"` and `"1.1"`, but not `"1.01"`. + // + // Min: 0. Max: 5. + Precision *int `json:"precision,omitempty" url:"precision,omitempty"` + // The catalog object ID referencing the + // [CatalogMeasurementUnit](entity:CatalogMeasurementUnit). + // + // This field is set when this is a catalog-backed measurement unit. + CatalogObjectID *string `json:"catalog_object_id,omitempty" url:"catalog_object_id,omitempty"` + // The version of the catalog object that this measurement unit references. + // + // This field is set when this is a catalog-backed measurement unit. + CatalogVersion *int64 `json:"catalog_version,omitempty" url:"catalog_version,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyEventAccumulatePromotionPoints) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderQuantityUnit) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *LoyaltyEventAccumulatePromotionPoints) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyEventAccumulatePromotionPoints +func (o *OrderQuantityUnit) UnmarshalJSON(data []byte) error { + type unmarshaler OrderQuantityUnit var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyEventAccumulatePromotionPoints(value) + *o = OrderQuantityUnit(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyEventAccumulatePromotionPoints) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderQuantityUnit) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Provides metadata when the event `type` is `ADJUST_POINTS`. -type LoyaltyEventAdjustPoints struct { - // The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram). - LoyaltyProgramID *string `json:"loyalty_program_id,omitempty" url:"loyalty_program_id,omitempty"` - // The number of points added or removed. - Points int `json:"points" url:"points"` - // The reason for the adjustment of points. - Reason *string `json:"reason,omitempty" url:"reason,omitempty"` - +// The set of line items, service charges, taxes, discounts, tips, and other items being returned in an order. +type OrderReturn struct { + // A unique ID that identifies the return only within this order. + UID *string `json:"uid,omitempty" url:"uid,omitempty"` + // An order that contains the original sale of these return line items. This is unset + // for unlinked returns. + SourceOrderID *string `json:"source_order_id,omitempty" url:"source_order_id,omitempty"` + // A collection of line items that are being returned. + ReturnLineItems []*OrderReturnLineItem `json:"return_line_items,omitempty" url:"return_line_items,omitempty"` + // A collection of service charges that are being returned. + ReturnServiceCharges []*OrderReturnServiceCharge `json:"return_service_charges,omitempty" url:"return_service_charges,omitempty"` + // A collection of references to taxes being returned for an order, including the total + // applied tax amount to be returned. The taxes must reference a top-level tax ID from the source + // order. + ReturnTaxes []*OrderReturnTax `json:"return_taxes,omitempty" url:"return_taxes,omitempty"` + // A collection of references to discounts being returned for an order, including the total + // applied discount amount to be returned. The discounts must reference a top-level discount ID + // from the source order. + ReturnDiscounts []*OrderReturnDiscount `json:"return_discounts,omitempty" url:"return_discounts,omitempty"` + // A collection of references to tips being returned for an order. + ReturnTips []*OrderReturnTip `json:"return_tips,omitempty" url:"return_tips,omitempty"` + // A positive or negative rounding adjustment to the total value being returned. Adjustments are commonly + // used to apply cash rounding when the minimum unit of the account is smaller than the lowest + // physical denomination of the currency. + RoundingAdjustment *OrderRoundingAdjustment `json:"rounding_adjustment,omitempty" url:"rounding_adjustment,omitempty"` + // An aggregate monetary value being returned by this return entry. + ReturnAmounts *OrderMoneyAmounts `json:"return_amounts,omitempty" url:"return_amounts,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyEventAdjustPoints) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderReturn) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *LoyaltyEventAdjustPoints) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyEventAdjustPoints +func (o *OrderReturn) UnmarshalJSON(data []byte) error { + type unmarshaler OrderReturn var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyEventAdjustPoints(value) + *o = OrderReturn(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyEventAdjustPoints) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderReturn) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Provides metadata when the event `type` is `CREATE_REWARD`. -type LoyaltyEventCreateReward struct { - // The ID of the [loyalty program](entity:LoyaltyProgram). - LoyaltyProgramID string `json:"loyalty_program_id" url:"loyalty_program_id"` - // The Square-assigned ID of the created [loyalty reward](entity:LoyaltyReward). - // This field is returned only if the event source is `LOYALTY_API`. - RewardID *string `json:"reward_id,omitempty" url:"reward_id,omitempty"` - // The loyalty points used to create the reward. - Points int `json:"points" url:"points"` +// Represents a discount being returned that applies to one or more return line items in an +// order. +// +// Fixed-amount, order-scoped discounts are distributed across all non-zero return line item totals. +// The amount distributed to each return line item is relative to that item’s contribution to the +// order subtotal. +type OrderReturnDiscount struct { + // A unique ID that identifies the returned discount only within this order. + UID *string `json:"uid,omitempty" url:"uid,omitempty"` + // The discount `uid` from the order that contains the original application of this discount. + SourceDiscountUID *string `json:"source_discount_uid,omitempty" url:"source_discount_uid,omitempty"` + // The catalog object ID referencing [CatalogDiscount](entity:CatalogDiscount). + CatalogObjectID *string `json:"catalog_object_id,omitempty" url:"catalog_object_id,omitempty"` + // The version of the catalog object that this discount references. + CatalogVersion *int64 `json:"catalog_version,omitempty" url:"catalog_version,omitempty"` + // The discount's name. + Name *string `json:"name,omitempty" url:"name,omitempty"` + // The type of the discount. If it is created by the API, it is `FIXED_PERCENTAGE` or `FIXED_AMOUNT`. + // + // Discounts that do not reference a catalog object ID must have a type of + // `FIXED_PERCENTAGE` or `FIXED_AMOUNT`. + // See [OrderLineItemDiscountType](#type-orderlineitemdiscounttype) for possible values + Type *OrderLineItemDiscountType `json:"type,omitempty" url:"type,omitempty"` + // The percentage of the tax, as a string representation of a decimal number. + // A value of `"7.25"` corresponds to a percentage of 7.25%. + // + // `percentage` is not set for amount-based discounts. + Percentage *string `json:"percentage,omitempty" url:"percentage,omitempty"` + // The total declared monetary amount of the discount. + // + // `amount_money` is not set for percentage-based discounts. + AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` + // The amount of discount actually applied to this line item. When an amount-based + // discount is at the order level, this value is different from `amount_money` because the discount + // is distributed across the line items. + AppliedMoney *Money `json:"applied_money,omitempty" url:"applied_money,omitempty"` + // Indicates the level at which the `OrderReturnDiscount` applies. For `ORDER` scoped + // discounts, the server generates references in `applied_discounts` on all + // `OrderReturnLineItem`s. For `LINE_ITEM` scoped discounts, the discount is only applied to + // `OrderReturnLineItem`s with references in their `applied_discounts` field. + // See [OrderLineItemDiscountScope](#type-orderlineitemdiscountscope) for possible values + Scope *OrderLineItemDiscountScope `json:"scope,omitempty" url:"scope,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyEventCreateReward) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderReturnDiscount) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *LoyaltyEventCreateReward) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyEventCreateReward +func (o *OrderReturnDiscount) UnmarshalJSON(data []byte) error { + type unmarshaler OrderReturnDiscount var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyEventCreateReward(value) + *o = OrderReturnDiscount(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyEventCreateReward) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderReturnDiscount) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Filter events by date time range. -type LoyaltyEventDateTimeFilter struct { - // The `created_at` date time range used to filter the result. - CreatedAt *TimeRange `json:"created_at,omitempty" url:"created_at,omitempty"` +// The line item being returned in an order. +type OrderReturnLineItem struct { + // A unique ID for this return line-item entry. + UID *string `json:"uid,omitempty" url:"uid,omitempty"` + // The `uid` of the line item in the original sale order. + SourceLineItemUID *string `json:"source_line_item_uid,omitempty" url:"source_line_item_uid,omitempty"` + // The name of the line item. + Name *string `json:"name,omitempty" url:"name,omitempty"` + // The quantity returned, formatted as a decimal number. + // For example, `"3"`. + // + // Line items with a `quantity_unit` can have non-integer quantities. + // For example, `"1.70000"`. + Quantity string `json:"quantity" url:"quantity"` + // The unit and precision that this return line item's quantity is measured in. + QuantityUnit *OrderQuantityUnit `json:"quantity_unit,omitempty" url:"quantity_unit,omitempty"` + // The note of the return line item. + Note *string `json:"note,omitempty" url:"note,omitempty"` + // The [CatalogItemVariation](entity:CatalogItemVariation) ID applied to this return line item. + CatalogObjectID *string `json:"catalog_object_id,omitempty" url:"catalog_object_id,omitempty"` + // The version of the catalog object that this line item references. + CatalogVersion *int64 `json:"catalog_version,omitempty" url:"catalog_version,omitempty"` + // The name of the variation applied to this return line item. + VariationName *string `json:"variation_name,omitempty" url:"variation_name,omitempty"` + // The type of line item: an itemized return, a non-itemized return (custom amount), + // or the return of an unactivated gift card sale. + // See [OrderLineItemItemType](#type-orderlineitemitemtype) for possible values + ItemType *OrderLineItemItemType `json:"item_type,omitempty" url:"item_type,omitempty"` + // The [CatalogModifier](entity:CatalogModifier)s applied to this line item. + ReturnModifiers []*OrderReturnLineItemModifier `json:"return_modifiers,omitempty" url:"return_modifiers,omitempty"` + // The list of references to `OrderReturnTax` entities applied to the return line item. Each + // `OrderLineItemAppliedTax` has a `tax_uid` that references the `uid` of a top-level + // `OrderReturnTax` applied to the return line item. On reads, the applied amount + // is populated. + AppliedTaxes []*OrderLineItemAppliedTax `json:"applied_taxes,omitempty" url:"applied_taxes,omitempty"` + // The list of references to `OrderReturnDiscount` entities applied to the return line item. Each + // `OrderLineItemAppliedDiscount` has a `discount_uid` that references the `uid` of a top-level + // `OrderReturnDiscount` applied to the return line item. On reads, the applied amount + // is populated. + AppliedDiscounts []*OrderLineItemAppliedDiscount `json:"applied_discounts,omitempty" url:"applied_discounts,omitempty"` + // The base price for a single unit of the line item. + BasePriceMoney *Money `json:"base_price_money,omitempty" url:"base_price_money,omitempty"` + // The total price of all item variations returned in this line item. + // The price is calculated as `base_price_money` multiplied by `quantity` and + // does not include modifiers. + VariationTotalPriceMoney *Money `json:"variation_total_price_money,omitempty" url:"variation_total_price_money,omitempty"` + // The gross return amount of money calculated as (item base price + modifiers price) \* quantity. + GrossReturnMoney *Money `json:"gross_return_money,omitempty" url:"gross_return_money,omitempty"` + // The total amount of tax money to return for the line item. + TotalTaxMoney *Money `json:"total_tax_money,omitempty" url:"total_tax_money,omitempty"` + // The total amount of discount money to return for the line item. + TotalDiscountMoney *Money `json:"total_discount_money,omitempty" url:"total_discount_money,omitempty"` + // The total amount of money to return for this line item. + TotalMoney *Money `json:"total_money,omitempty" url:"total_money,omitempty"` + // The list of references to `OrderReturnServiceCharge` entities applied to the return + // line item. Each `OrderLineItemAppliedServiceCharge` has a `service_charge_uid` that + // references the `uid` of a top-level `OrderReturnServiceCharge` applied to the return line + // item. On reads, the applied amount is populated. + AppliedServiceCharges []*OrderLineItemAppliedServiceCharge `json:"applied_service_charges,omitempty" url:"applied_service_charges,omitempty"` + // The total amount of apportioned service charge money to return for the line item. + TotalServiceChargeMoney *Money `json:"total_service_charge_money,omitempty" url:"total_service_charge_money,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyEventDateTimeFilter) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderReturnLineItem) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *LoyaltyEventDateTimeFilter) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyEventDateTimeFilter +func (o *OrderReturnLineItem) UnmarshalJSON(data []byte) error { + type unmarshaler OrderReturnLineItem var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyEventDateTimeFilter(value) + *o = OrderReturnLineItem(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyEventDateTimeFilter) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderReturnLineItem) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Provides metadata when the event `type` is `DELETE_REWARD`. -type LoyaltyEventDeleteReward struct { - // The ID of the [loyalty program](entity:LoyaltyProgram). - LoyaltyProgramID string `json:"loyalty_program_id" url:"loyalty_program_id"` - // The ID of the deleted [loyalty reward](entity:LoyaltyReward). - // This field is returned only if the event source is `LOYALTY_API`. - RewardID *string `json:"reward_id,omitempty" url:"reward_id,omitempty"` - // The number of points returned to the loyalty account. - Points int `json:"points" url:"points"` +// A line item modifier being returned. +type OrderReturnLineItemModifier struct { + // A unique ID that identifies the return modifier only within this order. + UID *string `json:"uid,omitempty" url:"uid,omitempty"` + // The modifier `uid` from the order's line item that contains the + // original sale of this line item modifier. + SourceModifierUID *string `json:"source_modifier_uid,omitempty" url:"source_modifier_uid,omitempty"` + // The catalog object ID referencing [CatalogModifier](entity:CatalogModifier). + CatalogObjectID *string `json:"catalog_object_id,omitempty" url:"catalog_object_id,omitempty"` + // The version of the catalog object that this line item modifier references. + CatalogVersion *int64 `json:"catalog_version,omitempty" url:"catalog_version,omitempty"` + // The name of the item modifier. + Name *string `json:"name,omitempty" url:"name,omitempty"` + // The base price for the modifier. + // + // `base_price_money` is required for ad hoc modifiers. + // If both `catalog_object_id` and `base_price_money` are set, `base_price_money` overrides the predefined [CatalogModifier](entity:CatalogModifier) price. + BasePriceMoney *Money `json:"base_price_money,omitempty" url:"base_price_money,omitempty"` + // The total price of the item modifier for its line item. + // This is the modifier's `base_price_money` multiplied by the line item's quantity. + TotalPriceMoney *Money `json:"total_price_money,omitempty" url:"total_price_money,omitempty"` + // The quantity of the line item modifier. The modifier quantity can be 0 or more. + // For example, suppose a restaurant offers a cheeseburger on the menu. When a buyer orders + // this item, the restaurant records the purchase by creating an `Order` object with a line item + // for a burger. The line item includes a line item modifier: the name is cheese and the quantity + // is 1. The buyer has the option to order extra cheese (or no cheese). If the buyer chooses + // the extra cheese option, the modifier quantity increases to 2. If the buyer does not want + // any cheese, the modifier quantity is set to 0. + Quantity *string `json:"quantity,omitempty" url:"quantity,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyEventDeleteReward) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderReturnLineItemModifier) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *LoyaltyEventDeleteReward) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyEventDeleteReward +func (o *OrderReturnLineItemModifier) UnmarshalJSON(data []byte) error { + type unmarshaler OrderReturnLineItemModifier var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyEventDeleteReward(value) + *o = OrderReturnLineItemModifier(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyEventDeleteReward) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderReturnLineItemModifier) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Provides metadata when the event `type` is `EXPIRE_POINTS`. -type LoyaltyEventExpirePoints struct { - // The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram). - LoyaltyProgramID string `json:"loyalty_program_id" url:"loyalty_program_id"` - // The number of points expired. - Points int `json:"points" url:"points"` +// Represents the service charge applied to the original order. +type OrderReturnServiceCharge struct { + // A unique ID that identifies the return service charge only within this order. + UID *string `json:"uid,omitempty" url:"uid,omitempty"` + // The service charge `uid` from the order containing the original + // service charge. `source_service_charge_uid` is `null` for + // unlinked returns. + SourceServiceChargeUID *string `json:"source_service_charge_uid,omitempty" url:"source_service_charge_uid,omitempty"` + // The name of the service charge. + Name *string `json:"name,omitempty" url:"name,omitempty"` + // The catalog object ID of the associated [OrderServiceCharge](entity:OrderServiceCharge). + CatalogObjectID *string `json:"catalog_object_id,omitempty" url:"catalog_object_id,omitempty"` + // The version of the catalog object that this service charge references. + CatalogVersion *int64 `json:"catalog_version,omitempty" url:"catalog_version,omitempty"` + // The percentage of the service charge, as a string representation of + // a decimal number. For example, a value of `"7.25"` corresponds to a + // percentage of 7.25%. + // + // Either `percentage` or `amount_money` should be set, but not both. + Percentage *string `json:"percentage,omitempty" url:"percentage,omitempty"` + // The amount of a non-percentage-based service charge. + // + // Either `percentage` or `amount_money` should be set, but not both. + AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` + // The amount of money applied to the order by the service charge, including + // any inclusive tax amounts, as calculated by Square. + // + // - For fixed-amount service charges, `applied_money` is equal to `amount_money`. + // - For percentage-based service charges, `applied_money` is the money calculated using the percentage. + AppliedMoney *Money `json:"applied_money,omitempty" url:"applied_money,omitempty"` + // The total amount of money to collect for the service charge. + // + // **NOTE**: If an inclusive tax is applied to the service charge, `total_money` + // does not equal `applied_money` plus `total_tax_money` because the inclusive + // tax amount is already included in both `applied_money` and `total_tax_money`. + TotalMoney *Money `json:"total_money,omitempty" url:"total_money,omitempty"` + // The total amount of tax money to collect for the service charge. + TotalTaxMoney *Money `json:"total_tax_money,omitempty" url:"total_tax_money,omitempty"` + // The calculation phase after which to apply the service charge. + // See [OrderServiceChargeCalculationPhase](#type-orderservicechargecalculationphase) for possible values + CalculationPhase *OrderServiceChargeCalculationPhase `json:"calculation_phase,omitempty" url:"calculation_phase,omitempty"` + // Indicates whether the surcharge can be taxed. Service charges + // calculated in the `TOTAL_PHASE` cannot be marked as taxable. + Taxable *bool `json:"taxable,omitempty" url:"taxable,omitempty"` + // The list of references to `OrderReturnTax` entities applied to the + // `OrderReturnServiceCharge`. Each `OrderLineItemAppliedTax` has a `tax_uid` + // that references the `uid` of a top-level `OrderReturnTax` that is being + // applied to the `OrderReturnServiceCharge`. On reads, the applied amount is + // populated. + AppliedTaxes []*OrderLineItemAppliedTax `json:"applied_taxes,omitempty" url:"applied_taxes,omitempty"` + // The treatment type of the service charge. + // See [OrderServiceChargeTreatmentType](#type-orderservicechargetreatmenttype) for possible values + TreatmentType *OrderServiceChargeTreatmentType `json:"treatment_type,omitempty" url:"treatment_type,omitempty"` + // Indicates the level at which the apportioned service charge applies. For `ORDER` + // scoped service charges, Square generates references in `applied_service_charges` on + // all order line items that do not have them. For `LINE_ITEM` scoped service charges, + // the service charge only applies to line items with a service charge reference in their + // `applied_service_charges` field. + // + // This field is immutable. To change the scope of an apportioned service charge, you must delete + // the apportioned service charge and re-add it as a new apportioned service charge. + // See [OrderServiceChargeScope](#type-orderservicechargescope) for possible values + Scope *OrderServiceChargeScope `json:"scope,omitempty" url:"scope,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyEventExpirePoints) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderReturnServiceCharge) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *LoyaltyEventExpirePoints) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyEventExpirePoints +func (o *OrderReturnServiceCharge) UnmarshalJSON(data []byte) error { + type unmarshaler OrderReturnServiceCharge var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyEventExpirePoints(value) + *o = OrderReturnServiceCharge(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyEventExpirePoints) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderReturnServiceCharge) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// The filtering criteria. If the request specifies multiple filters, -// the endpoint uses a logical AND to evaluate them. -type LoyaltyEventFilter struct { - // Filter events by loyalty account. - LoyaltyAccountFilter *LoyaltyEventLoyaltyAccountFilter `json:"loyalty_account_filter,omitempty" url:"loyalty_account_filter,omitempty"` - // Filter events by event type. - TypeFilter *LoyaltyEventTypeFilter `json:"type_filter,omitempty" url:"type_filter,omitempty"` - // Filter events by date time range. - // For each range, the start time is inclusive and the end time - // is exclusive. - DateTimeFilter *LoyaltyEventDateTimeFilter `json:"date_time_filter,omitempty" url:"date_time_filter,omitempty"` - // Filter events by location. - LocationFilter *LoyaltyEventLocationFilter `json:"location_filter,omitempty" url:"location_filter,omitempty"` - // Filter events by the order associated with the event. - OrderFilter *LoyaltyEventOrderFilter `json:"order_filter,omitempty" url:"order_filter,omitempty"` +// Represents a tax being returned that applies to one or more return line items in an order. +// +// Fixed-amount, order-scoped taxes are distributed across all non-zero return line item totals. +// The amount distributed to each return line item is relative to that item’s contribution to the +// order subtotal. +type OrderReturnTax struct { + // A unique ID that identifies the returned tax only within this order. + UID *string `json:"uid,omitempty" url:"uid,omitempty"` + // The tax `uid` from the order that contains the original tax charge. + SourceTaxUID *string `json:"source_tax_uid,omitempty" url:"source_tax_uid,omitempty"` + // The catalog object ID referencing [CatalogTax](entity:CatalogTax). + CatalogObjectID *string `json:"catalog_object_id,omitempty" url:"catalog_object_id,omitempty"` + // The version of the catalog object that this tax references. + CatalogVersion *int64 `json:"catalog_version,omitempty" url:"catalog_version,omitempty"` + // The tax's name. + Name *string `json:"name,omitempty" url:"name,omitempty"` + // Indicates the calculation method used to apply the tax. + // See [OrderLineItemTaxType](#type-orderlineitemtaxtype) for possible values + Type *OrderLineItemTaxType `json:"type,omitempty" url:"type,omitempty"` + // The percentage of the tax, as a string representation of a decimal number. + // For example, a value of `"7.25"` corresponds to a percentage of 7.25%. + Percentage *string `json:"percentage,omitempty" url:"percentage,omitempty"` + // The amount of money applied by the tax in an order. + AppliedMoney *Money `json:"applied_money,omitempty" url:"applied_money,omitempty"` + // Indicates the level at which the `OrderReturnTax` applies. For `ORDER` scoped + // taxes, Square generates references in `applied_taxes` on all + // `OrderReturnLineItem`s. For `LINE_ITEM` scoped taxes, the tax is only applied to + // `OrderReturnLineItem`s with references in their `applied_discounts` field. + // See [OrderLineItemTaxScope](#type-orderlineitemtaxscope) for possible values + Scope *OrderLineItemTaxScope `json:"scope,omitempty" url:"scope,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyEventFilter) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderReturnTax) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *LoyaltyEventFilter) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyEventFilter +func (o *OrderReturnTax) UnmarshalJSON(data []byte) error { + type unmarshaler OrderReturnTax var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyEventFilter(value) + *o = OrderReturnTax(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyEventFilter) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderReturnTax) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Filter events by location. -type LoyaltyEventLocationFilter struct { - // The [location](entity:Location) IDs for loyalty events to query. - // If multiple values are specified, the endpoint uses - // a logical OR to combine them. - LocationIDs []string `json:"location_ids,omitempty" url:"location_ids,omitempty"` +// A tip being returned. +type OrderReturnTip struct { + // A unique ID that identifies the tip only within this order. + UID *string `json:"uid,omitempty" url:"uid,omitempty"` + // ## The amount of tip being returned + AppliedMoney *Money `json:"applied_money,omitempty" url:"applied_money,omitempty"` + // The tender `uid` from the order that contains the original application of this tip. + SourceTenderUID *string `json:"source_tender_uid,omitempty" url:"source_tender_uid,omitempty"` + // The tender `id` from the order that contains the original application of this tip. + SourceTenderID *string `json:"source_tender_id,omitempty" url:"source_tender_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyEventLocationFilter) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderReturnTip) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *LoyaltyEventLocationFilter) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyEventLocationFilter +func (o *OrderReturnTip) UnmarshalJSON(data []byte) error { + type unmarshaler OrderReturnTip var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyEventLocationFilter(value) + *o = OrderReturnTip(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyEventLocationFilter) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderReturnTip) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Filter events by loyalty account. -type LoyaltyEventLoyaltyAccountFilter struct { - // The ID of the [loyalty account](entity:LoyaltyAccount) associated with loyalty events. - LoyaltyAccountID string `json:"loyalty_account_id" url:"loyalty_account_id"` +// Represents a reward that can be applied to an order if the necessary +// reward tier criteria are met. Rewards are created through the Loyalty API. +type OrderReward struct { + // The identifier of the reward. + ID string `json:"id" url:"id"` + // The identifier of the reward tier corresponding to this reward. + RewardTierID string `json:"reward_tier_id" url:"reward_tier_id"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyEventLoyaltyAccountFilter) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderReward) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *LoyaltyEventLoyaltyAccountFilter) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyEventLoyaltyAccountFilter +func (o *OrderReward) UnmarshalJSON(data []byte) error { + type unmarshaler OrderReward var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyEventLoyaltyAccountFilter(value) + *o = OrderReward(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyEventLoyaltyAccountFilter) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderReward) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Filter events by the order associated with the event. -type LoyaltyEventOrderFilter struct { - // The ID of the [order](entity:Order) associated with the event. - OrderID string `json:"order_id" url:"order_id"` +// A rounding adjustment of the money being returned. Commonly used to apply cash rounding +// when the minimum unit of the account is smaller than the lowest physical denomination of the currency. +type OrderRoundingAdjustment struct { + // A unique ID that identifies the rounding adjustment only within this order. + UID *string `json:"uid,omitempty" url:"uid,omitempty"` + // The name of the rounding adjustment from the original sale order. + Name *string `json:"name,omitempty" url:"name,omitempty"` + // The actual rounding adjustment amount. + AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyEventOrderFilter) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderRoundingAdjustment) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *LoyaltyEventOrderFilter) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyEventOrderFilter +func (o *OrderRoundingAdjustment) UnmarshalJSON(data []byte) error { + type unmarshaler OrderRoundingAdjustment var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyEventOrderFilter(value) + *o = OrderRoundingAdjustment(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyEventOrderFilter) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderRoundingAdjustment) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Provides metadata when the event `type` is `OTHER`. -type LoyaltyEventOther struct { - // The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram). - LoyaltyProgramID string `json:"loyalty_program_id" url:"loyalty_program_id"` - // The number of points added or removed. - Points int `json:"points" url:"points"` +// Represents a service charge applied to an order. +type OrderServiceCharge struct { + // A unique ID that identifies the service charge only within this order. + UID *string `json:"uid,omitempty" url:"uid,omitempty"` + // The name of the service charge. + Name *string `json:"name,omitempty" url:"name,omitempty"` + // The catalog object ID referencing the service charge [CatalogObject](entity:CatalogObject). + CatalogObjectID *string `json:"catalog_object_id,omitempty" url:"catalog_object_id,omitempty"` + // The version of the catalog object that this service charge references. + CatalogVersion *int64 `json:"catalog_version,omitempty" url:"catalog_version,omitempty"` + // The service charge percentage as a string representation of a + // decimal number. For example, `"7.25"` indicates a service charge of 7.25%. + // + // Exactly 1 of `percentage` or `amount_money` should be set. + Percentage *string `json:"percentage,omitempty" url:"percentage,omitempty"` + // The amount of a non-percentage-based service charge. + // + // Exactly one of `percentage` or `amount_money` should be set. + AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` + // The amount of money applied to the order by the service charge, + // including any inclusive tax amounts, as calculated by Square. + // + // - For fixed-amount service charges, `applied_money` is equal to `amount_money`. + // - For percentage-based service charges, `applied_money` is the money + // calculated using the percentage. + AppliedMoney *Money `json:"applied_money,omitempty" url:"applied_money,omitempty"` + // The total amount of money to collect for the service charge. + // + // **Note**: If an inclusive tax is applied to the service charge, + // `total_money` does not equal `applied_money` plus `total_tax_money` + // because the inclusive tax amount is already included in both + // `applied_money` and `total_tax_money`. + TotalMoney *Money `json:"total_money,omitempty" url:"total_money,omitempty"` + // The total amount of tax money to collect for the service charge. + TotalTaxMoney *Money `json:"total_tax_money,omitempty" url:"total_tax_money,omitempty"` + // The calculation phase at which to apply the service charge. + // See [OrderServiceChargeCalculationPhase](#type-orderservicechargecalculationphase) for possible values + CalculationPhase *OrderServiceChargeCalculationPhase `json:"calculation_phase,omitempty" url:"calculation_phase,omitempty"` + // Indicates whether the service charge can be taxed. If set to `true`, + // order-level taxes automatically apply to the service charge. Note that + // service charges calculated in the `TOTAL_PHASE` cannot be marked as taxable. + Taxable *bool `json:"taxable,omitempty" url:"taxable,omitempty"` + // The list of references to the taxes applied to this service charge. Each + // `OrderLineItemAppliedTax` has a `tax_uid` that references the `uid` of a top-level + // `OrderLineItemTax` that is being applied to this service charge. On reads, the amount applied + // is populated. + // + // An `OrderLineItemAppliedTax` is automatically created on every taxable service charge + // for all `ORDER` scoped taxes that are added to the order. `OrderLineItemAppliedTax` records + // for `LINE_ITEM` scoped taxes must be added in requests for the tax to apply to any taxable + // service charge. Taxable service charges have the `taxable` field set to `true` and calculated + // in the `SUBTOTAL_PHASE`. + // + // To change the amount of a tax, modify the referenced top-level tax. + AppliedTaxes []*OrderLineItemAppliedTax `json:"applied_taxes,omitempty" url:"applied_taxes,omitempty"` + // Application-defined data attached to this service charge. Metadata fields are intended + // to store descriptive references or associations with an entity in another system or store brief + // information about the object. Square does not process this field; it only stores and returns it + // in relevant API calls. Do not use metadata to store any sensitive information (such as personally + // identifiable information or card details). + // + // Keys written by applications must be 60 characters or less and must be in the character set + // `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed + // with a namespace, separated from the key with a ':' character. + // + // Values have a maximum length of 255 characters. + // + // An application can have up to 10 entries per metadata field. + // + // Entries written by applications are private and can only be read or modified by the same + // application. + // + // For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). + Metadata map[string]*string `json:"metadata,omitempty" url:"metadata,omitempty"` + // The type of the service charge. + // See [OrderServiceChargeType](#type-orderservicechargetype) for possible values + Type *OrderServiceChargeType `json:"type,omitempty" url:"type,omitempty"` + // The treatment type of the service charge. + // See [OrderServiceChargeTreatmentType](#type-orderservicechargetreatmenttype) for possible values + TreatmentType *OrderServiceChargeTreatmentType `json:"treatment_type,omitempty" url:"treatment_type,omitempty"` + // Indicates the level at which the apportioned service charge applies. For `ORDER` + // scoped service charges, Square generates references in `applied_service_charges` on + // all order line items that do not have them. For `LINE_ITEM` scoped service charges, + // the service charge only applies to line items with a service charge reference in their + // `applied_service_charges` field. + // + // This field is immutable. To change the scope of an apportioned service charge, you must delete + // the apportioned service charge and re-add it as a new apportioned service charge. + // See [OrderServiceChargeScope](#type-orderservicechargescope) for possible values + Scope *OrderServiceChargeScope `json:"scope,omitempty" url:"scope,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyEventOther) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderServiceCharge) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *LoyaltyEventOther) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyEventOther +func (o *OrderServiceCharge) UnmarshalJSON(data []byte) error { + type unmarshaler OrderServiceCharge var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyEventOther(value) + *o = OrderServiceCharge(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyEventOther) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderServiceCharge) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Represents a query used to search for loyalty events. -type LoyaltyEventQuery struct { - // The query filter criteria. - Filter *LoyaltyEventFilter `json:"filter,omitempty" url:"filter,omitempty"` +// Represents a phase in the process of calculating order totals. +// Service charges are applied after the indicated phase. +// +// [Read more about how order totals are calculated.](https://developer.squareup.com/docs/orders-api/how-it-works#how-totals-are-calculated) +type OrderServiceChargeCalculationPhase string - extraProperties map[string]interface{} - _rawJSON json.RawMessage +const ( + OrderServiceChargeCalculationPhaseServiceChargeCalculationPhaseDoNotUse OrderServiceChargeCalculationPhase = "SERVICE_CHARGE_CALCULATION_PHASE_DO_NOT_USE" + OrderServiceChargeCalculationPhaseSubtotalPhase OrderServiceChargeCalculationPhase = "SUBTOTAL_PHASE" + OrderServiceChargeCalculationPhaseTotalPhase OrderServiceChargeCalculationPhase = "TOTAL_PHASE" + OrderServiceChargeCalculationPhaseApportionedPercentagePhase OrderServiceChargeCalculationPhase = "APPORTIONED_PERCENTAGE_PHASE" + OrderServiceChargeCalculationPhaseApportionedAmountPhase OrderServiceChargeCalculationPhase = "APPORTIONED_AMOUNT_PHASE" + OrderServiceChargeCalculationPhaseCardSurchargePhase OrderServiceChargeCalculationPhase = "CARD_SURCHARGE_PHASE" +) + +func NewOrderServiceChargeCalculationPhaseFromString(s string) (OrderServiceChargeCalculationPhase, error) { + switch s { + case "SERVICE_CHARGE_CALCULATION_PHASE_DO_NOT_USE": + return OrderServiceChargeCalculationPhaseServiceChargeCalculationPhaseDoNotUse, nil + case "SUBTOTAL_PHASE": + return OrderServiceChargeCalculationPhaseSubtotalPhase, nil + case "TOTAL_PHASE": + return OrderServiceChargeCalculationPhaseTotalPhase, nil + case "APPORTIONED_PERCENTAGE_PHASE": + return OrderServiceChargeCalculationPhaseApportionedPercentagePhase, nil + case "APPORTIONED_AMOUNT_PHASE": + return OrderServiceChargeCalculationPhaseApportionedAmountPhase, nil + case "CARD_SURCHARGE_PHASE": + return OrderServiceChargeCalculationPhaseCardSurchargePhase, nil + } + var t OrderServiceChargeCalculationPhase + return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (l *LoyaltyEventQuery) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o OrderServiceChargeCalculationPhase) Ptr() *OrderServiceChargeCalculationPhase { + return &o } -func (l *LoyaltyEventQuery) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyEventQuery - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *l = LoyaltyEventQuery(value) +// Indicates whether this is a line-item or order-level apportioned +// service charge. +type OrderServiceChargeScope string - extraProperties, err := core.ExtractExtraProperties(data, *l) - if err != nil { - return err +const ( + OrderServiceChargeScopeOtherServiceChargeScope OrderServiceChargeScope = "OTHER_SERVICE_CHARGE_SCOPE" + OrderServiceChargeScopeLineItem OrderServiceChargeScope = "LINE_ITEM" + OrderServiceChargeScopeOrder OrderServiceChargeScope = "ORDER" +) + +func NewOrderServiceChargeScopeFromString(s string) (OrderServiceChargeScope, error) { + switch s { + case "OTHER_SERVICE_CHARGE_SCOPE": + return OrderServiceChargeScopeOtherServiceChargeScope, nil + case "LINE_ITEM": + return OrderServiceChargeScopeLineItem, nil + case "ORDER": + return OrderServiceChargeScopeOrder, nil } - l.extraProperties = extraProperties + var t OrderServiceChargeScope + return "", fmt.Errorf("%s is not a valid %T", s, t) +} - l._rawJSON = json.RawMessage(data) - return nil +func (o OrderServiceChargeScope) Ptr() *OrderServiceChargeScope { + return &o } -func (l *LoyaltyEventQuery) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { - return value - } +// Indicates whether the service charge will be treated as a value-holding line item or +// apportioned toward a line item. +type OrderServiceChargeTreatmentType string + +const ( + OrderServiceChargeTreatmentTypeServiceChargeTreatmentTypeDoNotUse OrderServiceChargeTreatmentType = "SERVICE_CHARGE_TREATMENT_TYPE_DO_NOT_USE" + OrderServiceChargeTreatmentTypeLineItemTreatment OrderServiceChargeTreatmentType = "LINE_ITEM_TREATMENT" + OrderServiceChargeTreatmentTypeApportionedTreatment OrderServiceChargeTreatmentType = "APPORTIONED_TREATMENT" +) + +func NewOrderServiceChargeTreatmentTypeFromString(s string) (OrderServiceChargeTreatmentType, error) { + switch s { + case "SERVICE_CHARGE_TREATMENT_TYPE_DO_NOT_USE": + return OrderServiceChargeTreatmentTypeServiceChargeTreatmentTypeDoNotUse, nil + case "LINE_ITEM_TREATMENT": + return OrderServiceChargeTreatmentTypeLineItemTreatment, nil + case "APPORTIONED_TREATMENT": + return OrderServiceChargeTreatmentTypeApportionedTreatment, nil } - if value, err := core.StringifyJSON(l); err == nil { - return value + var t OrderServiceChargeTreatmentType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (o OrderServiceChargeTreatmentType) Ptr() *OrderServiceChargeTreatmentType { + return &o +} + +type OrderServiceChargeType string + +const ( + OrderServiceChargeTypeServiceChargeTypeDoNotUse OrderServiceChargeType = "SERVICE_CHARGE_TYPE_DO_NOT_USE" + OrderServiceChargeTypeAutoGratuity OrderServiceChargeType = "AUTO_GRATUITY" + OrderServiceChargeTypeCustom OrderServiceChargeType = "CUSTOM" + OrderServiceChargeTypeCardSurcharge OrderServiceChargeType = "CARD_SURCHARGE" +) + +func NewOrderServiceChargeTypeFromString(s string) (OrderServiceChargeType, error) { + switch s { + case "SERVICE_CHARGE_TYPE_DO_NOT_USE": + return OrderServiceChargeTypeServiceChargeTypeDoNotUse, nil + case "AUTO_GRATUITY": + return OrderServiceChargeTypeAutoGratuity, nil + case "CUSTOM": + return OrderServiceChargeTypeCustom, nil + case "CARD_SURCHARGE": + return OrderServiceChargeTypeCardSurcharge, nil } - return fmt.Sprintf("%#v", l) + var t OrderServiceChargeType + return "", fmt.Errorf("%s is not a valid %T", s, t) } -// Provides metadata when the event `type` is `REDEEM_REWARD`. -type LoyaltyEventRedeemReward struct { - // The ID of the [loyalty program](entity:LoyaltyProgram). - LoyaltyProgramID string `json:"loyalty_program_id" url:"loyalty_program_id"` - // The ID of the redeemed [loyalty reward](entity:LoyaltyReward). - // This field is returned only if the event source is `LOYALTY_API`. - RewardID *string `json:"reward_id,omitempty" url:"reward_id,omitempty"` - // The ID of the [order](entity:Order) that redeemed the reward. - // This field is returned only if the Orders API is used to process orders. - OrderID *string `json:"order_id,omitempty" url:"order_id,omitempty"` +func (o OrderServiceChargeType) Ptr() *OrderServiceChargeType { + return &o +} + +// Represents the origination details of an order. +type OrderSource struct { + // The name used to identify the place (physical or digital) that an order originates. + // If unset, the name defaults to the name of the application that created the order. + Name *string `json:"name,omitempty" url:"name,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyEventRedeemReward) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderSource) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *LoyaltyEventRedeemReward) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyEventRedeemReward +func (o *OrderSource) UnmarshalJSON(data []byte) error { + type unmarshaler OrderSource var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyEventRedeemReward(value) + *o = OrderSource(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyEventRedeemReward) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderSource) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Defines whether the event was generated by the Square Point of Sale. -type LoyaltyEventSource string +// The state of the order. +type OrderState string const ( - LoyaltyEventSourceSquare LoyaltyEventSource = "SQUARE" - LoyaltyEventSourceLoyaltyAPI LoyaltyEventSource = "LOYALTY_API" + OrderStateDoNotUse OrderState = "DO_NOT_USE" + OrderStateOpen OrderState = "OPEN" + OrderStateCompleted OrderState = "COMPLETED" + OrderStateCanceled OrderState = "CANCELED" + OrderStateDraft OrderState = "DRAFT" ) -func NewLoyaltyEventSourceFromString(s string) (LoyaltyEventSource, error) { +func NewOrderStateFromString(s string) (OrderState, error) { switch s { - case "SQUARE": - return LoyaltyEventSourceSquare, nil - case "LOYALTY_API": - return LoyaltyEventSourceLoyaltyAPI, nil + case "DO_NOT_USE": + return OrderStateDoNotUse, nil + case "OPEN": + return OrderStateOpen, nil + case "COMPLETED": + return OrderStateCompleted, nil + case "CANCELED": + return OrderStateCanceled, nil + case "DRAFT": + return OrderStateDraft, nil } - var t LoyaltyEventSource + var t OrderState return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (l LoyaltyEventSource) Ptr() *LoyaltyEventSource { - return &l +func (o OrderState) Ptr() *OrderState { + return &o } -// The type of the loyalty event. -type LoyaltyEventType string +type OrderUpdated struct { + // The order's unique ID. + OrderID *string `json:"order_id,omitempty" url:"order_id,omitempty"` + // The version number, which is incremented each time an update is committed to the order. + // Orders that were not created through the API do not include a version number and + // therefore cannot be updated. + // + // [Read more about working with versions.](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders) + Version *int `json:"version,omitempty" url:"version,omitempty"` + // The ID of the seller location that this order is associated with. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The state of the order. + // See [OrderState](#type-orderstate) for possible values + State *OrderState `json:"state,omitempty" url:"state,omitempty"` + // The timestamp for when the order was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The timestamp for when the order was last updated, in RFC 3339 format. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` -const ( - LoyaltyEventTypeAccumulatePoints LoyaltyEventType = "ACCUMULATE_POINTS" - LoyaltyEventTypeCreateReward LoyaltyEventType = "CREATE_REWARD" - LoyaltyEventTypeRedeemReward LoyaltyEventType = "REDEEM_REWARD" - LoyaltyEventTypeDeleteReward LoyaltyEventType = "DELETE_REWARD" - LoyaltyEventTypeAdjustPoints LoyaltyEventType = "ADJUST_POINTS" - LoyaltyEventTypeExpirePoints LoyaltyEventType = "EXPIRE_POINTS" - LoyaltyEventTypeOther LoyaltyEventType = "OTHER" - LoyaltyEventTypeAccumulatePromotionPoints LoyaltyEventType = "ACCUMULATE_PROMOTION_POINTS" -) + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} -func NewLoyaltyEventTypeFromString(s string) (LoyaltyEventType, error) { - switch s { - case "ACCUMULATE_POINTS": - return LoyaltyEventTypeAccumulatePoints, nil - case "CREATE_REWARD": - return LoyaltyEventTypeCreateReward, nil - case "REDEEM_REWARD": - return LoyaltyEventTypeRedeemReward, nil - case "DELETE_REWARD": - return LoyaltyEventTypeDeleteReward, nil - case "ADJUST_POINTS": - return LoyaltyEventTypeAdjustPoints, nil - case "EXPIRE_POINTS": - return LoyaltyEventTypeExpirePoints, nil - case "OTHER": - return LoyaltyEventTypeOther, nil - case "ACCUMULATE_PROMOTION_POINTS": - return LoyaltyEventTypeAccumulatePromotionPoints, nil +func (o *OrderUpdated) GetExtraProperties() map[string]interface{} { + return o.extraProperties +} + +func (o *OrderUpdated) UnmarshalJSON(data []byte) error { + type unmarshaler OrderUpdated + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - var t LoyaltyEventType - return "", fmt.Errorf("%s is not a valid %T", s, t) + *o = OrderUpdated(value) + + extraProperties, err := core.ExtractExtraProperties(data, *o) + if err != nil { + return err + } + o.extraProperties = extraProperties + + o._rawJSON = json.RawMessage(data) + return nil } -func (l LoyaltyEventType) Ptr() *LoyaltyEventType { - return &l +func (o *OrderUpdated) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(o); err == nil { + return value + } + return fmt.Sprintf("%#v", o) } -// Filter events by event type. -type LoyaltyEventTypeFilter struct { - // The loyalty event types used to filter the result. - // If multiple values are specified, the endpoint uses a - // logical OR to combine them. - // See [LoyaltyEventType](#type-loyaltyeventtype) for possible values - Types []LoyaltyEventType `json:"types,omitempty" url:"types,omitempty"` +// Published when an [Order](entity:Order) is updated. This +// event is triggered only by the [UpdateOrder](api-endpoint:Orders-UpdateOrder) +// endpoint call. +type OrderUpdatedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents, `"order.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *OrderUpdatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyEventTypeFilter) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderUpdatedEvent) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *LoyaltyEventTypeFilter) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyEventTypeFilter +func (o *OrderUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler OrderUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyEventTypeFilter(value) + *o = OrderUpdatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyEventTypeFilter) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderUpdatedEvent) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Represents a Square loyalty program. Loyalty programs define how buyers can earn points and redeem points for rewards. -// Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard. -// For more information, see [Loyalty Program Overview](https://developer.squareup.com/docs/loyalty/overview). -type LoyaltyProgram struct { - // The Square-assigned ID of the loyalty program. Updates to - // the loyalty program do not modify the identifier. +type OrderUpdatedEventData struct { + // Name of the affected object’s type, `"order_updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the affected order. ID *string `json:"id,omitempty" url:"id,omitempty"` - // Whether the program is currently active. - // See [LoyaltyProgramStatus](#type-loyaltyprogramstatus) for possible values - Status *LoyaltyProgramStatus `json:"status,omitempty" url:"status,omitempty"` - // The list of rewards for buyers, sorted by ascending points. - RewardTiers []*LoyaltyProgramRewardTier `json:"reward_tiers,omitempty" url:"reward_tiers,omitempty"` - // If present, details for how points expire. - ExpirationPolicy *LoyaltyProgramExpirationPolicy `json:"expiration_policy,omitempty" url:"expiration_policy,omitempty"` - // A cosmetic name for the “points” currency. - Terminology *LoyaltyProgramTerminology `json:"terminology,omitempty" url:"terminology,omitempty"` - // The [locations](entity:Location) at which the program is active. - LocationIDs []string `json:"location_ids,omitempty" url:"location_ids,omitempty"` - // The timestamp when the program was created, in RFC 3339 format. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The timestamp when the reward was last updated, in RFC 3339 format. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` - // Defines how buyers can earn loyalty points from the base loyalty program. - // To check for associated [loyalty promotions](entity:LoyaltyPromotion) that enable - // buyers to earn extra points, call [ListLoyaltyPromotions](api-endpoint:Loyalty-ListLoyaltyPromotions). - AccrualRules []*LoyaltyProgramAccrualRule `json:"accrual_rules,omitempty" url:"accrual_rules,omitempty"` + // An object containing information about the updated Order. + Object *OrderUpdatedObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyProgram) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderUpdatedEventData) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *LoyaltyProgram) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyProgram +func (o *OrderUpdatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler OrderUpdatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyProgram(value) + *o = OrderUpdatedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyProgram) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderUpdatedEventData) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Represents an accrual rule, which defines how buyers can earn points from the base [loyalty program]($m/LoyaltyProgram). -type LoyaltyProgramAccrualRule struct { - // The type of the accrual rule that defines how buyers can earn points. - // See [LoyaltyProgramAccrualRuleType](#type-loyaltyprogramaccrualruletype) for possible values - AccrualType LoyaltyProgramAccrualRuleType `json:"accrual_type" url:"accrual_type"` - // The number of points that - // buyers earn based on the `accrual_type`. - Points *int `json:"points,omitempty" url:"points,omitempty"` - // Additional data for rules with the `VISIT` accrual type. - VisitData *LoyaltyProgramAccrualRuleVisitData `json:"visit_data,omitempty" url:"visit_data,omitempty"` - // Additional data for rules with the `SPEND` accrual type. - SpendData *LoyaltyProgramAccrualRuleSpendData `json:"spend_data,omitempty" url:"spend_data,omitempty"` - // Additional data for rules with the `ITEM_VARIATION` accrual type. - ItemVariationData *LoyaltyProgramAccrualRuleItemVariationData `json:"item_variation_data,omitempty" url:"item_variation_data,omitempty"` - // Additional data for rules with the `CATEGORY` accrual type. - CategoryData *LoyaltyProgramAccrualRuleCategoryData `json:"category_data,omitempty" url:"category_data,omitempty"` +type OrderUpdatedObject struct { + // Information about the updated order. + OrderUpdated *OrderUpdated `json:"order_updated,omitempty" url:"order_updated,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyProgramAccrualRule) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (o *OrderUpdatedObject) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (l *LoyaltyProgramAccrualRule) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyProgramAccrualRule +func (o *OrderUpdatedObject) UnmarshalJSON(data []byte) error { + type unmarshaler OrderUpdatedObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyProgramAccrualRule(value) + *o = OrderUpdatedObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *o) if err != nil { return err } - l.extraProperties = extraProperties + o.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + o._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyProgramAccrualRule) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (o *OrderUpdatedObject) String() string { + if len(o._rawJSON) > 0 { + if value, err := core.StringifyJSON(o._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", o) } -// Represents additional data for rules with the `CATEGORY` accrual type. -type LoyaltyProgramAccrualRuleCategoryData struct { - // The ID of the `CATEGORY` [catalog object](entity:CatalogObject) that buyers can purchase to earn - // points. - CategoryID string `json:"category_id" url:"category_id"` +// Used _internally_ to encapsulate pagination details. The resulting proto will be base62 encoded +// in order to produce a cursor that can be used externally. +type PaginationCursor struct { + // The ID of the last resource in the current page. The page can be in an ascending or + // descending order + OrderValue *string `json:"order_value,omitempty" url:"order_value,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyProgramAccrualRuleCategoryData) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (p *PaginationCursor) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (l *LoyaltyProgramAccrualRuleCategoryData) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyProgramAccrualRuleCategoryData +func (p *PaginationCursor) UnmarshalJSON(data []byte) error { + type unmarshaler PaginationCursor var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyProgramAccrualRuleCategoryData(value) + *p = PaginationCursor(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - l.extraProperties = extraProperties + p.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyProgramAccrualRuleCategoryData) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (p *PaginationCursor) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", p) } -// Represents additional data for rules with the `ITEM_VARIATION` accrual type. -type LoyaltyProgramAccrualRuleItemVariationData struct { - // The ID of the `ITEM_VARIATION` [catalog object](entity:CatalogObject) that buyers can purchase to earn - // points. - ItemVariationID string `json:"item_variation_id" url:"item_variation_id"` +// Defines output parameters in a response from the +// [PauseSubscription](api-endpoint:Subscriptions-PauseSubscription) endpoint. +type PauseSubscriptionResponse struct { + // Errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The subscription to be paused by the scheduled `PAUSE` action. + Subscription *Subscription `json:"subscription,omitempty" url:"subscription,omitempty"` + // The list of a `PAUSE` action and a possible `RESUME` action created by the request. + Actions []*SubscriptionAction `json:"actions,omitempty" url:"actions,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyProgramAccrualRuleItemVariationData) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (p *PauseSubscriptionResponse) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (l *LoyaltyProgramAccrualRuleItemVariationData) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyProgramAccrualRuleItemVariationData +func (p *PauseSubscriptionResponse) UnmarshalJSON(data []byte) error { + type unmarshaler PauseSubscriptionResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyProgramAccrualRuleItemVariationData(value) + *p = PauseSubscriptionResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - l.extraProperties = extraProperties + p.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyProgramAccrualRuleItemVariationData) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (p *PauseSubscriptionResponse) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", p) } -// Represents additional data for rules with the `SPEND` accrual type. -type LoyaltyProgramAccrualRuleSpendData struct { - // The amount that buyers must spend to earn points. - // For example, given an "Earn 1 point for every $10 spent" accrual rule, a buyer who spends $105 earns 10 points. - AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` - // The IDs of any `CATEGORY` catalog objects that are excluded from points accrual. - // - // You can use the [BatchRetrieveCatalogObjects](api-endpoint:Catalog-BatchRetrieveCatalogObjects) - // endpoint to retrieve information about the excluded categories. - ExcludedCategoryIDs []string `json:"excluded_category_ids,omitempty" url:"excluded_category_ids,omitempty"` - // The IDs of any `ITEM_VARIATION` catalog objects that are excluded from points accrual. - // - // You can use the [BatchRetrieveCatalogObjects](api-endpoint:Catalog-BatchRetrieveCatalogObjects) - // endpoint to retrieve information about the excluded item variations. - ExcludedItemVariationIDs []string `json:"excluded_item_variation_ids,omitempty" url:"excluded_item_variation_ids,omitempty"` - // Indicates how taxes should be treated when calculating the purchase amount used for points accrual. - // See [LoyaltyProgramAccrualRuleTaxMode](#type-loyaltyprogramaccrualruletaxmode) for possible values - TaxMode LoyaltyProgramAccrualRuleTaxMode `json:"tax_mode" url:"tax_mode"` +// Defines the fields that are included in the response body of a request to the +// [PayOrder](api-endpoint:Orders-PayOrder) endpoint. +type PayOrderResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The paid, updated [order](entity:Order). + Order *Order `json:"order,omitempty" url:"order,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyProgramAccrualRuleSpendData) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (p *PayOrderResponse) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (l *LoyaltyProgramAccrualRuleSpendData) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyProgramAccrualRuleSpendData +func (p *PayOrderResponse) UnmarshalJSON(data []byte) error { + type unmarshaler PayOrderResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyProgramAccrualRuleSpendData(value) + *p = PayOrderResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - l.extraProperties = extraProperties + p.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyProgramAccrualRuleSpendData) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (p *PayOrderResponse) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", l) -} - -// Indicates how taxes should be treated when calculating the purchase amount used for loyalty points accrual. -// This setting applies only to `SPEND` accrual rules or `VISIT` accrual rules that have a minimum spend requirement. -type LoyaltyProgramAccrualRuleTaxMode string - -const ( - LoyaltyProgramAccrualRuleTaxModeBeforeTax LoyaltyProgramAccrualRuleTaxMode = "BEFORE_TAX" - LoyaltyProgramAccrualRuleTaxModeAfterTax LoyaltyProgramAccrualRuleTaxMode = "AFTER_TAX" -) - -func NewLoyaltyProgramAccrualRuleTaxModeFromString(s string) (LoyaltyProgramAccrualRuleTaxMode, error) { - switch s { - case "BEFORE_TAX": - return LoyaltyProgramAccrualRuleTaxModeBeforeTax, nil - case "AFTER_TAX": - return LoyaltyProgramAccrualRuleTaxModeAfterTax, nil - } - var t LoyaltyProgramAccrualRuleTaxMode - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (l LoyaltyProgramAccrualRuleTaxMode) Ptr() *LoyaltyProgramAccrualRuleTaxMode { - return &l -} - -// The type of the accrual rule that defines how buyers can earn points. -type LoyaltyProgramAccrualRuleType string - -const ( - LoyaltyProgramAccrualRuleTypeVisit LoyaltyProgramAccrualRuleType = "VISIT" - LoyaltyProgramAccrualRuleTypeSpend LoyaltyProgramAccrualRuleType = "SPEND" - LoyaltyProgramAccrualRuleTypeItemVariation LoyaltyProgramAccrualRuleType = "ITEM_VARIATION" - LoyaltyProgramAccrualRuleTypeCategory LoyaltyProgramAccrualRuleType = "CATEGORY" -) - -func NewLoyaltyProgramAccrualRuleTypeFromString(s string) (LoyaltyProgramAccrualRuleType, error) { - switch s { - case "VISIT": - return LoyaltyProgramAccrualRuleTypeVisit, nil - case "SPEND": - return LoyaltyProgramAccrualRuleTypeSpend, nil - case "ITEM_VARIATION": - return LoyaltyProgramAccrualRuleTypeItemVariation, nil - case "CATEGORY": - return LoyaltyProgramAccrualRuleTypeCategory, nil - } - var t LoyaltyProgramAccrualRuleType - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (l LoyaltyProgramAccrualRuleType) Ptr() *LoyaltyProgramAccrualRuleType { - return &l + return fmt.Sprintf("%#v", p) } -// Represents additional data for rules with the `VISIT` accrual type. -type LoyaltyProgramAccrualRuleVisitData struct { - // The minimum purchase required during the visit to quality for points. - MinimumAmountMoney *Money `json:"minimum_amount_money,omitempty" url:"minimum_amount_money,omitempty"` - // Indicates how taxes should be treated when calculating the purchase amount to determine whether the visit qualifies for points. - // This setting applies only if `minimum_amount_money` is specified. - // See [LoyaltyProgramAccrualRuleTaxMode](#type-loyaltyprogramaccrualruletaxmode) for possible values - TaxMode LoyaltyProgramAccrualRuleTaxMode `json:"tax_mode" url:"tax_mode"` +// Represents a payment processed by the Square API. +type Payment struct { + // A unique ID for the payment. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The timestamp of when the payment was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The timestamp of when the payment was last updated, in RFC 3339 format. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // The amount processed for this payment, not including `tip_money`. + // + // The amount is specified in the smallest denomination of the applicable currency (for example, + // US dollar amounts are specified in cents). For more information, see + // [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts). + AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` + // The amount designated as a tip. + // + // This amount is specified in the smallest denomination of the applicable currency (for example, + // US dollar amounts are specified in cents). For more information, see + // [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts). + TipMoney *Money `json:"tip_money,omitempty" url:"tip_money,omitempty"` + // The total amount for the payment, including `amount_money` and `tip_money`. + // This amount is specified in the smallest denomination of the applicable currency (for example, + // US dollar amounts are specified in cents). For more information, see + // [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts). + TotalMoney *Money `json:"total_money,omitempty" url:"total_money,omitempty"` + // The amount the developer is taking as a fee for facilitating the payment on behalf + // of the seller. This amount is specified in the smallest denomination of the applicable currency + // (for example, US dollar amounts are specified in cents). For more information, + // see [Take Payments and Collect Fees](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees). + // + // The amount cannot be more than 90% of the `total_money` value. + // + // To set this field, `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission is required. + // For more information, see [Permissions](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees#permissions). + AppFeeMoney *Money `json:"app_fee_money,omitempty" url:"app_fee_money,omitempty"` + // The amount of money approved for this payment. This value may change if Square chooses to + // obtain reauthorization as part of a call to [UpdatePayment](api-endpoint:Payments-UpdatePayment). + ApprovedMoney *Money `json:"approved_money,omitempty" url:"approved_money,omitempty"` + // The processing fees and fee adjustments assessed by Square for this payment. + ProcessingFee []*ProcessingFee `json:"processing_fee,omitempty" url:"processing_fee,omitempty"` + // The total amount of the payment refunded to date. + // + // This amount is specified in the smallest denomination of the applicable currency (for example, + // US dollar amounts are specified in cents). + RefundedMoney *Money `json:"refunded_money,omitempty" url:"refunded_money,omitempty"` + // Indicates whether the payment is APPROVED, PENDING, COMPLETED, CANCELED, or FAILED. + Status *string `json:"status,omitempty" url:"status,omitempty"` + // The duration of time after the payment's creation when Square automatically applies the + // `delay_action` to the payment. This automatic `delay_action` applies only to payments that + // do not reach a terminal state (COMPLETED, CANCELED, or FAILED) before the `delay_duration` + // time period. + // + // This field is specified as a time duration, in RFC 3339 format. + // + // Notes: + // This feature is only supported for card payments. + // + // Default: + // + // - Card-present payments: "PT36H" (36 hours) from the creation time. + // - Card-not-present payments: "P7D" (7 days) from the creation time. + DelayDuration *string `json:"delay_duration,omitempty" url:"delay_duration,omitempty"` + // The action to be applied to the payment when the `delay_duration` has elapsed. + // + // Current values include `CANCEL` and `COMPLETE`. + DelayAction *string `json:"delay_action,omitempty" url:"delay_action,omitempty"` + // The read-only timestamp of when the `delay_action` is automatically applied, + // in RFC 3339 format. + // + // Note that this field is calculated by summing the payment's `delay_duration` and `created_at` + // fields. The `created_at` field is generated by Square and might not exactly match the + // time on your local machine. + DelayedUntil *string `json:"delayed_until,omitempty" url:"delayed_until,omitempty"` + // The source type for this payment. + // + // Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `BUY_NOW_PAY_LATER`, `SQUARE_ACCOUNT`, + // `CASH` and `EXTERNAL`. For information about these payment source types, + // see [Take Payments](https://developer.squareup.com/docs/payments-api/take-payments). + SourceType *string `json:"source_type,omitempty" url:"source_type,omitempty"` + // Details about a card payment. These details are only populated if the source_type is `CARD`. + CardDetails *CardPaymentDetails `json:"card_details,omitempty" url:"card_details,omitempty"` + // Details about a cash payment. These details are only populated if the source_type is `CASH`. + CashDetails *CashPaymentDetails `json:"cash_details,omitempty" url:"cash_details,omitempty"` + // Details about a bank account payment. These details are only populated if the source_type is `BANK_ACCOUNT`. + BankAccountDetails *BankAccountPaymentDetails `json:"bank_account_details,omitempty" url:"bank_account_details,omitempty"` + // Details about an external payment. The details are only populated + // if the `source_type` is `EXTERNAL`. + ExternalDetails *ExternalPaymentDetails `json:"external_details,omitempty" url:"external_details,omitempty"` + // Details about an wallet payment. The details are only populated + // if the `source_type` is `WALLET`. + WalletDetails *DigitalWalletDetails `json:"wallet_details,omitempty" url:"wallet_details,omitempty"` + // Details about a Buy Now Pay Later payment. The details are only populated + // if the `source_type` is `BUY_NOW_PAY_LATER`. For more information, see + // [Afterpay Payments](https://developer.squareup.com/docs/payments-api/take-payments/afterpay-payments). + BuyNowPayLaterDetails *BuyNowPayLaterDetails `json:"buy_now_pay_later_details,omitempty" url:"buy_now_pay_later_details,omitempty"` + // Details about a Square Account payment. The details are only populated + // if the `source_type` is `SQUARE_ACCOUNT`. + SquareAccountDetails *SquareAccountDetails `json:"square_account_details,omitempty" url:"square_account_details,omitempty"` + // The ID of the location associated with the payment. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The ID of the order associated with the payment. + OrderID *string `json:"order_id,omitempty" url:"order_id,omitempty"` + // An optional ID that associates the payment with an entity in + // another system. + ReferenceID *string `json:"reference_id,omitempty" url:"reference_id,omitempty"` + // The ID of the customer associated with the payment. If the ID is + // not provided in the `CreatePayment` request that was used to create the `Payment`, + // Square may use information in the request + // (such as the billing and shipping address, email address, and payment source) + // to identify a matching customer profile in the Customer Directory. + // If found, the profile ID is used. If a profile is not found, the + // API attempts to create an + // [instant profile](https://developer.squareup.com/docs/customers-api/what-it-does#instant-profiles). + // If the API cannot create an + // instant profile (either because the seller has disabled it or the + // seller's region prevents creating it), this field remains unset. Note that + // this process is asynchronous and it may take some time before a + // customer ID is added to the payment. + CustomerID *string `json:"customer_id,omitempty" url:"customer_id,omitempty"` + // **Deprecated**: Use `Payment.team_member_id` instead. + // + // An optional ID of the employee associated with taking the payment. + EmployeeID *string `json:"employee_id,omitempty" url:"employee_id,omitempty"` + // An optional ID of the [TeamMember](entity:TeamMember) associated with taking the payment. + TeamMemberID *string `json:"team_member_id,omitempty" url:"team_member_id,omitempty"` + // A list of `refund_id`s identifying refunds for the payment. + RefundIDs []string `json:"refund_ids,omitempty" url:"refund_ids,omitempty"` + // Provides information about the risk associated with the payment, as determined by Square. + // This field is present for payments to sellers that have opted in to receive risk + // evaluations. + RiskEvaluation *RiskEvaluation `json:"risk_evaluation,omitempty" url:"risk_evaluation,omitempty"` + // An optional ID for a Terminal checkout that is associated with the payment. + TerminalCheckoutID *string `json:"terminal_checkout_id,omitempty" url:"terminal_checkout_id,omitempty"` + // The buyer's email address. + BuyerEmailAddress *string `json:"buyer_email_address,omitempty" url:"buyer_email_address,omitempty"` + // The buyer's billing address. + BillingAddress *Address `json:"billing_address,omitempty" url:"billing_address,omitempty"` + // The buyer's shipping address. + ShippingAddress *Address `json:"shipping_address,omitempty" url:"shipping_address,omitempty"` + // An optional note to include when creating a payment. + Note *string `json:"note,omitempty" url:"note,omitempty"` + // Additional payment information that gets added to the customer's card statement + // as part of the statement description. + // + // Note that the `statement_description_identifier` might get truncated on the statement description + // to fit the required information including the Square identifier (SQ \*) and the name of the + // seller taking the payment. + StatementDescriptionIdentifier *string `json:"statement_description_identifier,omitempty" url:"statement_description_identifier,omitempty"` + // Actions that can be performed on this payment: + // + // - `EDIT_AMOUNT_UP` - The payment amount can be edited up. + // - `EDIT_AMOUNT_DOWN` - The payment amount can be edited down. + // - `EDIT_TIP_AMOUNT_UP` - The tip amount can be edited up. + // - `EDIT_TIP_AMOUNT_DOWN` - The tip amount can be edited down. + // - `EDIT_DELAY_ACTION` - The delay_action can be edited. + Capabilities []string `json:"capabilities,omitempty" url:"capabilities,omitempty"` + // The payment's receipt number. + // The field is missing if a payment is canceled. + ReceiptNumber *string `json:"receipt_number,omitempty" url:"receipt_number,omitempty"` + // The URL for the payment's receipt. + // The field is only populated for COMPLETED payments. + ReceiptURL *string `json:"receipt_url,omitempty" url:"receipt_url,omitempty"` + // Details about the device that took the payment. + DeviceDetails *DeviceDetails `json:"device_details,omitempty" url:"device_details,omitempty"` + // Details about the application that took the payment. + ApplicationDetails *ApplicationDetails `json:"application_details,omitempty" url:"application_details,omitempty"` + // Whether or not this payment was taken offline. + IsOfflinePayment *bool `json:"is_offline_payment,omitempty" url:"is_offline_payment,omitempty"` + // Additional information about the payment if it was taken offline. + OfflinePaymentDetails *OfflinePaymentDetails `json:"offline_payment_details,omitempty" url:"offline_payment_details,omitempty"` + // Used for optimistic concurrency. This opaque token identifies a specific version of the + // `Payment` object. + VersionToken *string `json:"version_token,omitempty" url:"version_token,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyProgramAccrualRuleVisitData) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (p *Payment) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (l *LoyaltyProgramAccrualRuleVisitData) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyProgramAccrualRuleVisitData +func (p *Payment) UnmarshalJSON(data []byte) error { + type unmarshaler Payment var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyProgramAccrualRuleVisitData(value) + *p = Payment(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - l.extraProperties = extraProperties + p.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyProgramAccrualRuleVisitData) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (p *Payment) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", p) } -// Describes when the loyalty program expires. -type LoyaltyProgramExpirationPolicy struct { - // The number of months before points expire, in `P[n]M` RFC 3339 duration format. For example, a value of `P12M` represents a duration of 12 months. - // Points are valid through the last day of the month in which they are scheduled to expire. For example, with a `P12M` duration, points earned on July 6, 2020 expire on August 1, 2021. - ExpirationDuration string `json:"expiration_duration" url:"expiration_duration"` +type PaymentBalanceActivityAppFeeRefundDetail struct { + // The ID of the payment associated with this activity. + PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` + // The ID of the refund associated with this activity. + RefundID *string `json:"refund_id,omitempty" url:"refund_id,omitempty"` + // The ID of the location of the merchant associated with the payment refund activity + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyProgramExpirationPolicy) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (p *PaymentBalanceActivityAppFeeRefundDetail) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (l *LoyaltyProgramExpirationPolicy) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyProgramExpirationPolicy +func (p *PaymentBalanceActivityAppFeeRefundDetail) UnmarshalJSON(data []byte) error { + type unmarshaler PaymentBalanceActivityAppFeeRefundDetail var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyProgramExpirationPolicy(value) + *p = PaymentBalanceActivityAppFeeRefundDetail(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - l.extraProperties = extraProperties + p.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyProgramExpirationPolicy) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (p *PaymentBalanceActivityAppFeeRefundDetail) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", l) -} - -// Provides details about the reward tier discount. DEPRECATED at version 2020-12-16. Discount details -// are now defined using a catalog pricing rule and other catalog objects. For more information, see -// [Getting discount details for a reward tier](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards#get-discount-details). -type LoyaltyProgramRewardDefinition struct { - // Indicates the scope of the reward tier. DEPRECATED at version 2020-12-16. You can find this information in the - // `product_set_data` field of the `PRODUCT_SET` catalog object referenced by the pricing rule. For `ORDER` scopes, - // `all_products` is true. For `ITEM_VARIATION` or `CATEGORY` scopes, `product_ids_any` is a list of - // catalog object IDs of the given type. - // See [LoyaltyProgramRewardDefinitionScope](#type-loyaltyprogramrewarddefinitionscope) for possible values - Scope LoyaltyProgramRewardDefinitionScope `json:"scope" url:"scope"` - // The type of discount the reward tier offers. DEPRECATED at version 2020-12-16. You can find this information - // in the `discount_data.discount_type` field of the `DISCOUNT` catalog object referenced by the pricing rule. - // See [LoyaltyProgramRewardDefinitionType](#type-loyaltyprogramrewarddefinitiontype) for possible values - DiscountType LoyaltyProgramRewardDefinitionType `json:"discount_type" url:"discount_type"` - // The fixed percentage of the discount. Present if `discount_type` is `FIXED_PERCENTAGE`. - // For example, a 7.25% off discount will be represented as "7.25". DEPRECATED at version 2020-12-16. You can find this - // information in the `discount_data.percentage` field of the `DISCOUNT` catalog object referenced by the pricing rule. - PercentageDiscount *string `json:"percentage_discount,omitempty" url:"percentage_discount,omitempty"` - // The list of catalog objects to which this reward can be applied. They are either all item-variation ids or category ids, depending on the `type` field. - // DEPRECATED at version 2020-12-16. You can find this information in the `product_set_data.product_ids_any` field - // of the `PRODUCT_SET` catalog object referenced by the pricing rule. - CatalogObjectIDs []string `json:"catalog_object_ids,omitempty" url:"catalog_object_ids,omitempty"` - // The amount of the discount. Present if `discount_type` is `FIXED_AMOUNT`. For example, $5 off. - // DEPRECATED at version 2020-12-16. You can find this information in the `discount_data.amount_money` field of the - // `DISCOUNT` catalog object referenced by the pricing rule. - FixedDiscountMoney *Money `json:"fixed_discount_money,omitempty" url:"fixed_discount_money,omitempty"` - // When `discount_type` is `FIXED_PERCENTAGE`, the maximum discount amount that can be applied. - // DEPRECATED at version 2020-12-16. You can find this information in the `discount_data.maximum_amount_money` field - // of the `DISCOUNT` catalog object referenced by the the pricing rule. - MaxDiscountMoney *Money `json:"max_discount_money,omitempty" url:"max_discount_money,omitempty"` + return fmt.Sprintf("%#v", p) +} + +type PaymentBalanceActivityAppFeeRevenueDetail struct { + // The ID of the payment associated with this activity. + PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` + // The ID of the location of the merchant associated with the payment activity + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyProgramRewardDefinition) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (p *PaymentBalanceActivityAppFeeRevenueDetail) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (l *LoyaltyProgramRewardDefinition) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyProgramRewardDefinition +func (p *PaymentBalanceActivityAppFeeRevenueDetail) UnmarshalJSON(data []byte) error { + type unmarshaler PaymentBalanceActivityAppFeeRevenueDetail var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyProgramRewardDefinition(value) + *p = PaymentBalanceActivityAppFeeRevenueDetail(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - l.extraProperties = extraProperties + p.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyProgramRewardDefinition) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (p *PaymentBalanceActivityAppFeeRevenueDetail) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", l) -} - -// Indicates the scope of the reward tier. DEPRECATED at version 2020-12-16. Discount details -// are now defined using a catalog pricing rule and other catalog objects. For more information, see -// [Getting discount details for a reward tier](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards#get-discount-details). -type LoyaltyProgramRewardDefinitionScope string - -const ( - LoyaltyProgramRewardDefinitionScopeOrder LoyaltyProgramRewardDefinitionScope = "ORDER" - LoyaltyProgramRewardDefinitionScopeItemVariation LoyaltyProgramRewardDefinitionScope = "ITEM_VARIATION" - LoyaltyProgramRewardDefinitionScopeCategory LoyaltyProgramRewardDefinitionScope = "CATEGORY" -) - -func NewLoyaltyProgramRewardDefinitionScopeFromString(s string) (LoyaltyProgramRewardDefinitionScope, error) { - switch s { - case "ORDER": - return LoyaltyProgramRewardDefinitionScopeOrder, nil - case "ITEM_VARIATION": - return LoyaltyProgramRewardDefinitionScopeItemVariation, nil - case "CATEGORY": - return LoyaltyProgramRewardDefinitionScopeCategory, nil - } - var t LoyaltyProgramRewardDefinitionScope - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (l LoyaltyProgramRewardDefinitionScope) Ptr() *LoyaltyProgramRewardDefinitionScope { - return &l -} - -// The type of discount the reward tier offers. DEPRECATED at version 2020-12-16. Discount details -// are now defined using a catalog pricing rule and other catalog objects. For more information, see -// [Getting discount details for a reward tier](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards#get-discount-details). -type LoyaltyProgramRewardDefinitionType string - -const ( - LoyaltyProgramRewardDefinitionTypeFixedAmount LoyaltyProgramRewardDefinitionType = "FIXED_AMOUNT" - LoyaltyProgramRewardDefinitionTypeFixedPercentage LoyaltyProgramRewardDefinitionType = "FIXED_PERCENTAGE" -) - -func NewLoyaltyProgramRewardDefinitionTypeFromString(s string) (LoyaltyProgramRewardDefinitionType, error) { - switch s { - case "FIXED_AMOUNT": - return LoyaltyProgramRewardDefinitionTypeFixedAmount, nil - case "FIXED_PERCENTAGE": - return LoyaltyProgramRewardDefinitionTypeFixedPercentage, nil - } - var t LoyaltyProgramRewardDefinitionType - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (l LoyaltyProgramRewardDefinitionType) Ptr() *LoyaltyProgramRewardDefinitionType { - return &l + return fmt.Sprintf("%#v", p) } -// Represents a reward tier in a loyalty program. A reward tier defines how buyers can redeem points for a reward, such as the number of points required and the value and scope of the discount. A loyalty program can offer multiple reward tiers. -type LoyaltyProgramRewardTier struct { - // The Square-assigned ID of the reward tier. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The points exchanged for the reward tier. - Points int `json:"points" url:"points"` - // The name of the reward tier. - Name *string `json:"name,omitempty" url:"name,omitempty"` - // Provides details about the reward tier definition. - // DEPRECATED at version 2020-12-16. Replaced by the `pricing_rule_reference` field. - Definition *LoyaltyProgramRewardDefinition `json:"definition,omitempty" url:"definition,omitempty"` - // The timestamp when the reward tier was created, in RFC 3339 format. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // A reference to the specific version of a `PRICING_RULE` catalog object that contains information about the reward tier discount. - // - // Use `object_id` and `catalog_version` with the [RetrieveCatalogObject](api-endpoint:Catalog-RetrieveCatalogObject) endpoint - // to get discount details. Make sure to set `include_related_objects` to true in the request to retrieve all catalog objects - // that define the discount. For more information, see [Getting discount details for a reward tier](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards#get-discount-details). - PricingRuleReference *CatalogObjectReference `json:"pricing_rule_reference,omitempty" url:"pricing_rule_reference,omitempty"` +type PaymentBalanceActivityAutomaticSavingsDetail struct { + // The ID of the payment associated with this activity. + PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` + // The ID of the payout associated with this activity. + PayoutID *string `json:"payout_id,omitempty" url:"payout_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyProgramRewardTier) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (p *PaymentBalanceActivityAutomaticSavingsDetail) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (l *LoyaltyProgramRewardTier) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyProgramRewardTier +func (p *PaymentBalanceActivityAutomaticSavingsDetail) UnmarshalJSON(data []byte) error { + type unmarshaler PaymentBalanceActivityAutomaticSavingsDetail var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyProgramRewardTier(value) + *p = PaymentBalanceActivityAutomaticSavingsDetail(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - l.extraProperties = extraProperties + p.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyProgramRewardTier) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (p *PaymentBalanceActivityAutomaticSavingsDetail) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", l) -} - -// Indicates whether the program is currently active. -type LoyaltyProgramStatus string - -const ( - LoyaltyProgramStatusInactive LoyaltyProgramStatus = "INACTIVE" - LoyaltyProgramStatusActive LoyaltyProgramStatus = "ACTIVE" -) - -func NewLoyaltyProgramStatusFromString(s string) (LoyaltyProgramStatus, error) { - switch s { - case "INACTIVE": - return LoyaltyProgramStatusInactive, nil - case "ACTIVE": - return LoyaltyProgramStatusActive, nil - } - var t LoyaltyProgramStatus - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (l LoyaltyProgramStatus) Ptr() *LoyaltyProgramStatus { - return &l + return fmt.Sprintf("%#v", p) } -// Represents the naming used for loyalty points. -type LoyaltyProgramTerminology struct { - // A singular unit for a point (for example, 1 point is called 1 star). - One string `json:"one" url:"one"` - // A plural unit for point (for example, 10 points is called 10 stars). - Other string `json:"other" url:"other"` +type PaymentBalanceActivityAutomaticSavingsReversedDetail struct { + // The ID of the payment associated with this activity. + PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` + // The ID of the payout associated with this activity. + PayoutID *string `json:"payout_id,omitempty" url:"payout_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyProgramTerminology) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (p *PaymentBalanceActivityAutomaticSavingsReversedDetail) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (l *LoyaltyProgramTerminology) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyProgramTerminology +func (p *PaymentBalanceActivityAutomaticSavingsReversedDetail) UnmarshalJSON(data []byte) error { + type unmarshaler PaymentBalanceActivityAutomaticSavingsReversedDetail var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyProgramTerminology(value) + *p = PaymentBalanceActivityAutomaticSavingsReversedDetail(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - l.extraProperties = extraProperties + p.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyProgramTerminology) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (p *PaymentBalanceActivityAutomaticSavingsReversedDetail) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", p) } -// Represents a promotion for a [loyalty program]($m/LoyaltyProgram). Loyalty promotions enable buyers -// to earn extra points on top of those earned from the base program. -// -// A loyalty program can have a maximum of 10 loyalty promotions with an `ACTIVE` or `SCHEDULED` status. -type LoyaltyPromotion struct { - // The Square-assigned ID of the promotion. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The name of the promotion. - Name string `json:"name" url:"name"` - // The points incentive for the promotion. This field defines whether promotion points - // are earned by multiplying base program points or by adding a specified number of points. - Incentive *LoyaltyPromotionIncentive `json:"incentive,omitempty" url:"incentive,omitempty"` - // The scheduling information that defines when purchases can qualify to earn points from an `ACTIVE` promotion. - AvailableTime *LoyaltyPromotionAvailableTimeData `json:"available_time,omitempty" url:"available_time,omitempty"` - // The number of times a buyer can earn promotion points during a specified interval. - // If not specified, buyers can trigger the promotion an unlimited number of times. - TriggerLimit *LoyaltyPromotionTriggerLimit `json:"trigger_limit,omitempty" url:"trigger_limit,omitempty"` - // The current status of the promotion. - // See [LoyaltyPromotionStatus](#type-loyaltypromotionstatus) for possible values - Status *LoyaltyPromotionStatus `json:"status,omitempty" url:"status,omitempty"` - // The timestamp of when the promotion was created, in RFC 3339 format. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The timestamp of when the promotion was canceled, in RFC 3339 format. - CanceledAt *string `json:"canceled_at,omitempty" url:"canceled_at,omitempty"` - // The timestamp when the promotion was last updated, in RFC 3339 format. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` - // The ID of the [loyalty program](entity:LoyaltyProgram) associated with the promotion. - LoyaltyProgramID *string `json:"loyalty_program_id,omitempty" url:"loyalty_program_id,omitempty"` - // The minimum purchase amount required to earn promotion points. If specified, this amount is positive. - MinimumSpendAmountMoney *Money `json:"minimum_spend_amount_money,omitempty" url:"minimum_spend_amount_money,omitempty"` - // The IDs of any qualifying `ITEM_VARIATION` [catalog objects](entity:CatalogObject). If specified, - // the purchase must include at least one of these items to qualify for the promotion. - // - // This option is valid only if the base loyalty program uses a `VISIT` or `SPEND` accrual rule. - // With `SPEND` accrual rules, make sure that qualifying promotional items are not excluded. - // - // You can specify `qualifying_item_variation_ids` or `qualifying_category_ids` for a given promotion, but not both. - QualifyingItemVariationIDs []string `json:"qualifying_item_variation_ids,omitempty" url:"qualifying_item_variation_ids,omitempty"` - // The IDs of any qualifying `CATEGORY` [catalog objects](entity:CatalogObject). If specified, - // the purchase must include at least one item from one of these categories to qualify for the promotion. - // - // This option is valid only if the base loyalty program uses a `VISIT` or `SPEND` accrual rule. - // With `SPEND` accrual rules, make sure that qualifying promotional items are not excluded. - // - // You can specify `qualifying_category_ids` or `qualifying_item_variation_ids` for a promotion, but not both. - QualifyingCategoryIDs []string `json:"qualifying_category_ids,omitempty" url:"qualifying_category_ids,omitempty"` +type PaymentBalanceActivityChargeDetail struct { + // The ID of the payment associated with this activity. + PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyPromotion) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (p *PaymentBalanceActivityChargeDetail) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (l *LoyaltyPromotion) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyPromotion +func (p *PaymentBalanceActivityChargeDetail) UnmarshalJSON(data []byte) error { + type unmarshaler PaymentBalanceActivityChargeDetail var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyPromotion(value) + *p = PaymentBalanceActivityChargeDetail(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - l.extraProperties = extraProperties + p.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyPromotion) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (p *PaymentBalanceActivityChargeDetail) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", p) } -// Represents scheduling information that determines when purchases can qualify to earn points -// from a [loyalty promotion]($m/LoyaltyPromotion). -type LoyaltyPromotionAvailableTimeData struct { - // The date that the promotion starts, in `YYYY-MM-DD` format. Square populates this field - // based on the provided `time_periods`. - StartDate *string `json:"start_date,omitempty" url:"start_date,omitempty"` - // The date that the promotion ends, in `YYYY-MM-DD` format. Square populates this field - // based on the provided `time_periods`. If an end date is not specified, an `ACTIVE` promotion - // remains available until it is canceled. - EndDate *string `json:"end_date,omitempty" url:"end_date,omitempty"` - // A list of [iCalendar (RFC 5545) events](https://tools.ietf.org/html/rfc5545#section-3.6.1) - // (`VEVENT`). Each event represents an available time period per day or days of the week. - // A day can have a maximum of one available time period. - // - // Only `DTSTART`, `DURATION`, and `RRULE` are supported. `DTSTART` and `DURATION` are required and - // timestamps must be in local (unzoned) time format. Include `RRULE` to specify recurring promotions, - // an end date (using the `UNTIL` keyword), or both. For more information, see - // [Available time](https://developer.squareup.com/docs/loyalty-api/loyalty-promotions#available-time). - // - // Note that `BEGIN:VEVENT` and `END:VEVENT` are optional in a `CreateLoyaltyPromotion` request - // but are always included in the response. - TimePeriods []string `json:"time_periods,omitempty" url:"time_periods,omitempty"` +type PaymentBalanceActivityDepositFeeDetail struct { + // The ID of the payout that triggered this deposit fee activity. + PayoutID *string `json:"payout_id,omitempty" url:"payout_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyPromotionAvailableTimeData) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (p *PaymentBalanceActivityDepositFeeDetail) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (l *LoyaltyPromotionAvailableTimeData) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyPromotionAvailableTimeData +func (p *PaymentBalanceActivityDepositFeeDetail) UnmarshalJSON(data []byte) error { + type unmarshaler PaymentBalanceActivityDepositFeeDetail var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyPromotionAvailableTimeData(value) + *p = PaymentBalanceActivityDepositFeeDetail(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - l.extraProperties = extraProperties + p.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyPromotionAvailableTimeData) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (p *PaymentBalanceActivityDepositFeeDetail) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", p) } -// Represents how points for a [loyalty promotion]($m/LoyaltyPromotion) are calculated, -// either by multiplying the points earned from the base program or by adding a specified number -// of points to the points earned from the base program. -type LoyaltyPromotionIncentive struct { - // The type of points incentive. - // See [LoyaltyPromotionIncentiveType](#type-loyaltypromotionincentivetype) for possible values - Type LoyaltyPromotionIncentiveType `json:"type" url:"type"` - // Additional data for a `POINTS_MULTIPLIER` incentive type. - PointsMultiplierData *LoyaltyPromotionIncentivePointsMultiplierData `json:"points_multiplier_data,omitempty" url:"points_multiplier_data,omitempty"` - // Additional data for a `POINTS_ADDITION` incentive type. - PointsAdditionData *LoyaltyPromotionIncentivePointsAdditionData `json:"points_addition_data,omitempty" url:"points_addition_data,omitempty"` +type PaymentBalanceActivityDisputeDetail struct { + // The ID of the payment associated with this activity. + PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` + // The ID of the dispute associated with this activity. + DisputeID *string `json:"dispute_id,omitempty" url:"dispute_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyPromotionIncentive) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (p *PaymentBalanceActivityDisputeDetail) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (l *LoyaltyPromotionIncentive) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyPromotionIncentive +func (p *PaymentBalanceActivityDisputeDetail) UnmarshalJSON(data []byte) error { + type unmarshaler PaymentBalanceActivityDisputeDetail var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyPromotionIncentive(value) + *p = PaymentBalanceActivityDisputeDetail(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - l.extraProperties = extraProperties + p.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyPromotionIncentive) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (p *PaymentBalanceActivityDisputeDetail) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", p) } -// Represents the metadata for a `POINTS_ADDITION` type of [loyalty promotion incentive]($m/LoyaltyPromotionIncentive). -type LoyaltyPromotionIncentivePointsAdditionData struct { - // The number of additional points to earn each time the promotion is triggered. For example, - // suppose a purchase qualifies for 5 points from the base loyalty program. If the purchase also - // qualifies for a `POINTS_ADDITION` promotion incentive with a `points_addition` of 3, the buyer - // earns a total of 8 points (5 program points + 3 promotion points = 8 points). - PointsAddition int `json:"points_addition" url:"points_addition"` +type PaymentBalanceActivityFeeDetail struct { + // The ID of the payment associated with this activity + // This will only be populated when a principal LedgerEntryToken is also populated. + // If the fee is independent (there is no principal LedgerEntryToken) then this will likely not + // be populated. + PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyPromotionIncentivePointsAdditionData) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (p *PaymentBalanceActivityFeeDetail) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (l *LoyaltyPromotionIncentivePointsAdditionData) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyPromotionIncentivePointsAdditionData +func (p *PaymentBalanceActivityFeeDetail) UnmarshalJSON(data []byte) error { + type unmarshaler PaymentBalanceActivityFeeDetail var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyPromotionIncentivePointsAdditionData(value) + *p = PaymentBalanceActivityFeeDetail(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - l.extraProperties = extraProperties + p.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyPromotionIncentivePointsAdditionData) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (p *PaymentBalanceActivityFeeDetail) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", p) } -// Represents the metadata for a `POINTS_MULTIPLIER` type of [loyalty promotion incentive]($m/LoyaltyPromotionIncentive). -type LoyaltyPromotionIncentivePointsMultiplierData struct { - // The multiplier used to calculate the number of points earned each time the promotion - // is triggered. For example, suppose a purchase qualifies for 5 points from the base loyalty program. - // If the purchase also qualifies for a `POINTS_MULTIPLIER` promotion incentive with a `points_multiplier` - // of 3, the buyer earns a total of 15 points (5 program points x 3 promotion multiplier = 15 points). - // - // DEPRECATED at version 2023-08-16. Replaced by the `multiplier` field. - // - // One of the following is required when specifying a points multiplier: - // - // - (Recommended) The `multiplier` field. - // - This deprecated `points_multiplier` field. If provided in the request, Square also returns `multiplier` - // with the equivalent value. - PointsMultiplier *int `json:"points_multiplier,omitempty" url:"points_multiplier,omitempty"` - // The multiplier used to calculate the number of points earned each time the promotion is triggered, - // specified as a string representation of a decimal. Square supports multipliers up to 10x, with three - // point precision for decimal multipliers. For example, suppose a purchase qualifies for 4 points from the - // base loyalty program. If the purchase also qualifies for a `POINTS_MULTIPLIER` promotion incentive with a - // `multiplier` of "1.5", the buyer earns a total of 6 points (4 program points x 1.5 promotion multiplier = 6 points). - // Fractional points are dropped. - // - // One of the following is required when specifying a points multiplier: - // - // - (Recommended) This `multiplier` field. - // - The deprecated `points_multiplier` field. If provided in the request, Square also returns `multiplier` - // with the equivalent value. - Multiplier *string `json:"multiplier,omitempty" url:"multiplier,omitempty"` +type PaymentBalanceActivityFreeProcessingDetail struct { + // The ID of the payment associated with this activity. + PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyPromotionIncentivePointsMultiplierData) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (p *PaymentBalanceActivityFreeProcessingDetail) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (l *LoyaltyPromotionIncentivePointsMultiplierData) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyPromotionIncentivePointsMultiplierData +func (p *PaymentBalanceActivityFreeProcessingDetail) UnmarshalJSON(data []byte) error { + type unmarshaler PaymentBalanceActivityFreeProcessingDetail var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyPromotionIncentivePointsMultiplierData(value) + *p = PaymentBalanceActivityFreeProcessingDetail(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - l.extraProperties = extraProperties + p.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyPromotionIncentivePointsMultiplierData) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (p *PaymentBalanceActivityFreeProcessingDetail) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", l) -} - -// Indicates the type of points incentive for a [loyalty promotion]($m/LoyaltyPromotion), -// which is used to determine how buyers can earn points from the promotion. -type LoyaltyPromotionIncentiveType string - -const ( - LoyaltyPromotionIncentiveTypePointsMultiplier LoyaltyPromotionIncentiveType = "POINTS_MULTIPLIER" - LoyaltyPromotionIncentiveTypePointsAddition LoyaltyPromotionIncentiveType = "POINTS_ADDITION" -) - -func NewLoyaltyPromotionIncentiveTypeFromString(s string) (LoyaltyPromotionIncentiveType, error) { - switch s { - case "POINTS_MULTIPLIER": - return LoyaltyPromotionIncentiveTypePointsMultiplier, nil - case "POINTS_ADDITION": - return LoyaltyPromotionIncentiveTypePointsAddition, nil - } - var t LoyaltyPromotionIncentiveType - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (l LoyaltyPromotionIncentiveType) Ptr() *LoyaltyPromotionIncentiveType { - return &l -} - -// Indicates the status of a [loyalty promotion]($m/LoyaltyPromotion). -type LoyaltyPromotionStatus string - -const ( - LoyaltyPromotionStatusActive LoyaltyPromotionStatus = "ACTIVE" - LoyaltyPromotionStatusEnded LoyaltyPromotionStatus = "ENDED" - LoyaltyPromotionStatusCanceled LoyaltyPromotionStatus = "CANCELED" - LoyaltyPromotionStatusScheduled LoyaltyPromotionStatus = "SCHEDULED" -) - -func NewLoyaltyPromotionStatusFromString(s string) (LoyaltyPromotionStatus, error) { - switch s { - case "ACTIVE": - return LoyaltyPromotionStatusActive, nil - case "ENDED": - return LoyaltyPromotionStatusEnded, nil - case "CANCELED": - return LoyaltyPromotionStatusCanceled, nil - case "SCHEDULED": - return LoyaltyPromotionStatusScheduled, nil - } - var t LoyaltyPromotionStatus - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (l LoyaltyPromotionStatus) Ptr() *LoyaltyPromotionStatus { - return &l + return fmt.Sprintf("%#v", p) } -// Represents the number of times a buyer can earn points during a [loyalty promotion]($m/LoyaltyPromotion). -// If this field is not set, buyers can trigger the promotion an unlimited number of times to earn points during -// the time that the promotion is available. -// -// A purchase that is disqualified from earning points because of this limit might qualify for another active promotion. -type LoyaltyPromotionTriggerLimit struct { - // The maximum number of times a buyer can trigger the promotion during the specified `interval`. - Times int `json:"times" url:"times"` - // The time period the limit applies to. - // See [LoyaltyPromotionTriggerLimitInterval](#type-loyaltypromotiontriggerlimitinterval) for possible values - Interval *LoyaltyPromotionTriggerLimitInterval `json:"interval,omitempty" url:"interval,omitempty"` +type PaymentBalanceActivityHoldAdjustmentDetail struct { + // The ID of the payment associated with this activity. + PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyPromotionTriggerLimit) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (p *PaymentBalanceActivityHoldAdjustmentDetail) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (l *LoyaltyPromotionTriggerLimit) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyPromotionTriggerLimit +func (p *PaymentBalanceActivityHoldAdjustmentDetail) UnmarshalJSON(data []byte) error { + type unmarshaler PaymentBalanceActivityHoldAdjustmentDetail var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyPromotionTriggerLimit(value) + *p = PaymentBalanceActivityHoldAdjustmentDetail(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - l.extraProperties = extraProperties + p.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyPromotionTriggerLimit) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (p *PaymentBalanceActivityHoldAdjustmentDetail) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", l) -} - -// Indicates the time period that the [trigger limit]($m/LoyaltyPromotionTriggerLimit) applies to, -// which is used to determine the number of times a buyer can earn points for a [loyalty promotion]($m/LoyaltyPromotion). -type LoyaltyPromotionTriggerLimitInterval string - -const ( - LoyaltyPromotionTriggerLimitIntervalAllTime LoyaltyPromotionTriggerLimitInterval = "ALL_TIME" - LoyaltyPromotionTriggerLimitIntervalDay LoyaltyPromotionTriggerLimitInterval = "DAY" -) - -func NewLoyaltyPromotionTriggerLimitIntervalFromString(s string) (LoyaltyPromotionTriggerLimitInterval, error) { - switch s { - case "ALL_TIME": - return LoyaltyPromotionTriggerLimitIntervalAllTime, nil - case "DAY": - return LoyaltyPromotionTriggerLimitIntervalDay, nil - } - var t LoyaltyPromotionTriggerLimitInterval - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (l LoyaltyPromotionTriggerLimitInterval) Ptr() *LoyaltyPromotionTriggerLimitInterval { - return &l + return fmt.Sprintf("%#v", p) } -// Represents a contract to redeem loyalty points for a [reward tier]($m/LoyaltyProgramRewardTier) discount. Loyalty rewards can be in an ISSUED, REDEEMED, or DELETED state. -// For more information, see [Manage loyalty rewards](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards). -type LoyaltyReward struct { - // The Square-assigned ID of the loyalty reward. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The status of a loyalty reward. - // See [LoyaltyRewardStatus](#type-loyaltyrewardstatus) for possible values - Status *LoyaltyRewardStatus `json:"status,omitempty" url:"status,omitempty"` - // The Square-assigned ID of the [loyalty account](entity:LoyaltyAccount) to which the reward belongs. - LoyaltyAccountID string `json:"loyalty_account_id" url:"loyalty_account_id"` - // The Square-assigned ID of the [reward tier](entity:LoyaltyProgramRewardTier) used to create the reward. - RewardTierID string `json:"reward_tier_id" url:"reward_tier_id"` - // The number of loyalty points used for the reward. - Points *int `json:"points,omitempty" url:"points,omitempty"` - // The Square-assigned ID of the [order](entity:Order) to which the reward is attached. - OrderID *string `json:"order_id,omitempty" url:"order_id,omitempty"` - // The timestamp when the reward was created, in RFC 3339 format. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The timestamp when the reward was last updated, in RFC 3339 format. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` - // The timestamp when the reward was redeemed, in RFC 3339 format. - RedeemedAt *string `json:"redeemed_at,omitempty" url:"redeemed_at,omitempty"` +type PaymentBalanceActivityOpenDisputeDetail struct { + // The ID of the payment associated with this activity. + PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` + // The ID of the dispute associated with this activity. + DisputeID *string `json:"dispute_id,omitempty" url:"dispute_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (l *LoyaltyReward) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (p *PaymentBalanceActivityOpenDisputeDetail) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (l *LoyaltyReward) UnmarshalJSON(data []byte) error { - type unmarshaler LoyaltyReward +func (p *PaymentBalanceActivityOpenDisputeDetail) UnmarshalJSON(data []byte) error { + type unmarshaler PaymentBalanceActivityOpenDisputeDetail var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = LoyaltyReward(value) + *p = PaymentBalanceActivityOpenDisputeDetail(value) - extraProperties, err := core.ExtractExtraProperties(data, *l) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - l.extraProperties = extraProperties + p.extraProperties = extraProperties - l._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (l *LoyaltyReward) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (p *PaymentBalanceActivityOpenDisputeDetail) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", l) -} - -// The status of the loyalty reward. -type LoyaltyRewardStatus string - -const ( - LoyaltyRewardStatusIssued LoyaltyRewardStatus = "ISSUED" - LoyaltyRewardStatusRedeemed LoyaltyRewardStatus = "REDEEMED" - LoyaltyRewardStatusDeleted LoyaltyRewardStatus = "DELETED" -) - -func NewLoyaltyRewardStatusFromString(s string) (LoyaltyRewardStatus, error) { - switch s { - case "ISSUED": - return LoyaltyRewardStatusIssued, nil - case "REDEEMED": - return LoyaltyRewardStatusRedeemed, nil - case "DELETED": - return LoyaltyRewardStatusDeleted, nil - } - var t LoyaltyRewardStatus - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (l LoyaltyRewardStatus) Ptr() *LoyaltyRewardStatus { - return &l + return fmt.Sprintf("%#v", p) } -// Represents a unit of measurement to use with a quantity, such as ounces -// or inches. Exactly one of the following fields are required: `custom_unit`, -// `area_unit`, `length_unit`, `volume_unit`, and `weight_unit`. -type MeasurementUnit struct { - // A custom unit of measurement defined by the seller using the Point of Sale - // app or ad-hoc as an order line item. - CustomUnit *MeasurementUnitCustom `json:"custom_unit,omitempty" url:"custom_unit,omitempty"` - // Represents a standard area unit. - // See [MeasurementUnitArea](#type-measurementunitarea) for possible values - AreaUnit *MeasurementUnitArea `json:"area_unit,omitempty" url:"area_unit,omitempty"` - // Represents a standard length unit. - // See [MeasurementUnitLength](#type-measurementunitlength) for possible values - LengthUnit *MeasurementUnitLength `json:"length_unit,omitempty" url:"length_unit,omitempty"` - // Represents a standard volume unit. - // See [MeasurementUnitVolume](#type-measurementunitvolume) for possible values - VolumeUnit *MeasurementUnitVolume `json:"volume_unit,omitempty" url:"volume_unit,omitempty"` - // Represents a standard unit of weight or mass. - // See [MeasurementUnitWeight](#type-measurementunitweight) for possible values - WeightUnit *MeasurementUnitWeight `json:"weight_unit,omitempty" url:"weight_unit,omitempty"` - // Reserved for API integrations that lack the ability to specify a real measurement unit - // See [MeasurementUnitGeneric](#type-measurementunitgeneric) for possible values - GenericUnit *MeasurementUnitGeneric `json:"generic_unit,omitempty" url:"generic_unit,omitempty"` - // Represents a standard unit of time. - // See [MeasurementUnitTime](#type-measurementunittime) for possible values - TimeUnit *MeasurementUnitTime `json:"time_unit,omitempty" url:"time_unit,omitempty"` - // Represents the type of the measurement unit. - // See [MeasurementUnitUnitType](#type-measurementunitunittype) for possible values - Type *MeasurementUnitUnitType `json:"type,omitempty" url:"type,omitempty"` +type PaymentBalanceActivityOtherAdjustmentDetail struct { + // The ID of the payment associated with this activity. + PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (m *MeasurementUnit) GetExtraProperties() map[string]interface{} { - return m.extraProperties +func (p *PaymentBalanceActivityOtherAdjustmentDetail) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (m *MeasurementUnit) UnmarshalJSON(data []byte) error { - type unmarshaler MeasurementUnit +func (p *PaymentBalanceActivityOtherAdjustmentDetail) UnmarshalJSON(data []byte) error { + type unmarshaler PaymentBalanceActivityOtherAdjustmentDetail var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *m = MeasurementUnit(value) + *p = PaymentBalanceActivityOtherAdjustmentDetail(value) - extraProperties, err := core.ExtractExtraProperties(data, *m) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - m.extraProperties = extraProperties + p.extraProperties = extraProperties - m._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (m *MeasurementUnit) String() string { - if len(m._rawJSON) > 0 { - if value, err := core.StringifyJSON(m._rawJSON); err == nil { +func (p *PaymentBalanceActivityOtherAdjustmentDetail) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(m); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", m) + return fmt.Sprintf("%#v", p) } -// Unit of area used to measure a quantity. -type MeasurementUnitArea string +type PaymentBalanceActivityOtherDetail struct { + // The ID of the payment associated with this activity. + PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` -const ( - MeasurementUnitAreaImperialAcre MeasurementUnitArea = "IMPERIAL_ACRE" - MeasurementUnitAreaImperialSquareInch MeasurementUnitArea = "IMPERIAL_SQUARE_INCH" - MeasurementUnitAreaImperialSquareFoot MeasurementUnitArea = "IMPERIAL_SQUARE_FOOT" - MeasurementUnitAreaImperialSquareYard MeasurementUnitArea = "IMPERIAL_SQUARE_YARD" - MeasurementUnitAreaImperialSquareMile MeasurementUnitArea = "IMPERIAL_SQUARE_MILE" - MeasurementUnitAreaMetricSquareCentimeter MeasurementUnitArea = "METRIC_SQUARE_CENTIMETER" - MeasurementUnitAreaMetricSquareMeter MeasurementUnitArea = "METRIC_SQUARE_METER" - MeasurementUnitAreaMetricSquareKilometer MeasurementUnitArea = "METRIC_SQUARE_KILOMETER" -) + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} -func NewMeasurementUnitAreaFromString(s string) (MeasurementUnitArea, error) { - switch s { - case "IMPERIAL_ACRE": - return MeasurementUnitAreaImperialAcre, nil - case "IMPERIAL_SQUARE_INCH": - return MeasurementUnitAreaImperialSquareInch, nil - case "IMPERIAL_SQUARE_FOOT": - return MeasurementUnitAreaImperialSquareFoot, nil - case "IMPERIAL_SQUARE_YARD": - return MeasurementUnitAreaImperialSquareYard, nil - case "IMPERIAL_SQUARE_MILE": - return MeasurementUnitAreaImperialSquareMile, nil - case "METRIC_SQUARE_CENTIMETER": - return MeasurementUnitAreaMetricSquareCentimeter, nil - case "METRIC_SQUARE_METER": - return MeasurementUnitAreaMetricSquareMeter, nil - case "METRIC_SQUARE_KILOMETER": - return MeasurementUnitAreaMetricSquareKilometer, nil +func (p *PaymentBalanceActivityOtherDetail) GetExtraProperties() map[string]interface{} { + return p.extraProperties +} + +func (p *PaymentBalanceActivityOtherDetail) UnmarshalJSON(data []byte) error { + type unmarshaler PaymentBalanceActivityOtherDetail + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - var t MeasurementUnitArea - return "", fmt.Errorf("%s is not a valid %T", s, t) + *p = PaymentBalanceActivityOtherDetail(value) + + extraProperties, err := core.ExtractExtraProperties(data, *p) + if err != nil { + return err + } + p.extraProperties = extraProperties + + p._rawJSON = json.RawMessage(data) + return nil } -func (m MeasurementUnitArea) Ptr() *MeasurementUnitArea { - return &m +func (p *PaymentBalanceActivityOtherDetail) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(p); err == nil { + return value + } + return fmt.Sprintf("%#v", p) } -// The information needed to define a custom unit, provided by the seller. -type MeasurementUnitCustom struct { - // The name of the custom unit, for example "bushel". - Name string `json:"name" url:"name"` - // The abbreviation of the custom unit, such as "bsh" (bushel). This appears - // in the cart for the Point of Sale app, and in reports. - Abbreviation string `json:"abbreviation" url:"abbreviation"` +type PaymentBalanceActivityRefundDetail struct { + // The ID of the payment associated with this activity. + PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` + // The ID of the refund associated with this activity. + RefundID *string `json:"refund_id,omitempty" url:"refund_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (m *MeasurementUnitCustom) GetExtraProperties() map[string]interface{} { - return m.extraProperties +func (p *PaymentBalanceActivityRefundDetail) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (m *MeasurementUnitCustom) UnmarshalJSON(data []byte) error { - type unmarshaler MeasurementUnitCustom +func (p *PaymentBalanceActivityRefundDetail) UnmarshalJSON(data []byte) error { + type unmarshaler PaymentBalanceActivityRefundDetail var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *m = MeasurementUnitCustom(value) + *p = PaymentBalanceActivityRefundDetail(value) - extraProperties, err := core.ExtractExtraProperties(data, *m) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - m.extraProperties = extraProperties + p.extraProperties = extraProperties - m._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (m *MeasurementUnitCustom) String() string { - if len(m._rawJSON) > 0 { - if value, err := core.StringifyJSON(m._rawJSON); err == nil { +func (p *PaymentBalanceActivityRefundDetail) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(m); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", m) + return fmt.Sprintf("%#v", p) } -type MeasurementUnitGeneric = string - -// The unit of length used to measure a quantity. -type MeasurementUnitLength string - -const ( - MeasurementUnitLengthImperialInch MeasurementUnitLength = "IMPERIAL_INCH" - MeasurementUnitLengthImperialFoot MeasurementUnitLength = "IMPERIAL_FOOT" - MeasurementUnitLengthImperialYard MeasurementUnitLength = "IMPERIAL_YARD" - MeasurementUnitLengthImperialMile MeasurementUnitLength = "IMPERIAL_MILE" - MeasurementUnitLengthMetricMillimeter MeasurementUnitLength = "METRIC_MILLIMETER" - MeasurementUnitLengthMetricCentimeter MeasurementUnitLength = "METRIC_CENTIMETER" - MeasurementUnitLengthMetricMeter MeasurementUnitLength = "METRIC_METER" - MeasurementUnitLengthMetricKilometer MeasurementUnitLength = "METRIC_KILOMETER" -) +type PaymentBalanceActivityReleaseAdjustmentDetail struct { + // The ID of the payment associated with this activity. + PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` -func NewMeasurementUnitLengthFromString(s string) (MeasurementUnitLength, error) { - switch s { - case "IMPERIAL_INCH": - return MeasurementUnitLengthImperialInch, nil - case "IMPERIAL_FOOT": - return MeasurementUnitLengthImperialFoot, nil - case "IMPERIAL_YARD": - return MeasurementUnitLengthImperialYard, nil - case "IMPERIAL_MILE": - return MeasurementUnitLengthImperialMile, nil - case "METRIC_MILLIMETER": - return MeasurementUnitLengthMetricMillimeter, nil - case "METRIC_CENTIMETER": - return MeasurementUnitLengthMetricCentimeter, nil - case "METRIC_METER": - return MeasurementUnitLengthMetricMeter, nil - case "METRIC_KILOMETER": - return MeasurementUnitLengthMetricKilometer, nil - } - var t MeasurementUnitLength - return "", fmt.Errorf("%s is not a valid %T", s, t) + extraProperties map[string]interface{} + _rawJSON json.RawMessage } -func (m MeasurementUnitLength) Ptr() *MeasurementUnitLength { - return &m +func (p *PaymentBalanceActivityReleaseAdjustmentDetail) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -// Unit of time used to measure a quantity (a duration). -type MeasurementUnitTime string - -const ( - MeasurementUnitTimeGenericMillisecond MeasurementUnitTime = "GENERIC_MILLISECOND" - MeasurementUnitTimeGenericSecond MeasurementUnitTime = "GENERIC_SECOND" - MeasurementUnitTimeGenericMinute MeasurementUnitTime = "GENERIC_MINUTE" - MeasurementUnitTimeGenericHour MeasurementUnitTime = "GENERIC_HOUR" - MeasurementUnitTimeGenericDay MeasurementUnitTime = "GENERIC_DAY" -) +func (p *PaymentBalanceActivityReleaseAdjustmentDetail) UnmarshalJSON(data []byte) error { + type unmarshaler PaymentBalanceActivityReleaseAdjustmentDetail + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *p = PaymentBalanceActivityReleaseAdjustmentDetail(value) -func NewMeasurementUnitTimeFromString(s string) (MeasurementUnitTime, error) { - switch s { - case "GENERIC_MILLISECOND": - return MeasurementUnitTimeGenericMillisecond, nil - case "GENERIC_SECOND": - return MeasurementUnitTimeGenericSecond, nil - case "GENERIC_MINUTE": - return MeasurementUnitTimeGenericMinute, nil - case "GENERIC_HOUR": - return MeasurementUnitTimeGenericHour, nil - case "GENERIC_DAY": - return MeasurementUnitTimeGenericDay, nil + extraProperties, err := core.ExtractExtraProperties(data, *p) + if err != nil { + return err } - var t MeasurementUnitTime - return "", fmt.Errorf("%s is not a valid %T", s, t) -} + p.extraProperties = extraProperties -func (m MeasurementUnitTime) Ptr() *MeasurementUnitTime { - return &m + p._rawJSON = json.RawMessage(data) + return nil } -// Describes the type of this unit and indicates which field contains the unit information. This is an ‘open’ enum. -type MeasurementUnitUnitType string - -const ( - MeasurementUnitUnitTypeTypeCustom MeasurementUnitUnitType = "TYPE_CUSTOM" - MeasurementUnitUnitTypeTypeArea MeasurementUnitUnitType = "TYPE_AREA" - MeasurementUnitUnitTypeTypeLength MeasurementUnitUnitType = "TYPE_LENGTH" - MeasurementUnitUnitTypeTypeVolume MeasurementUnitUnitType = "TYPE_VOLUME" - MeasurementUnitUnitTypeTypeWeight MeasurementUnitUnitType = "TYPE_WEIGHT" - MeasurementUnitUnitTypeTypeGeneric MeasurementUnitUnitType = "TYPE_GENERIC" -) - -func NewMeasurementUnitUnitTypeFromString(s string) (MeasurementUnitUnitType, error) { - switch s { - case "TYPE_CUSTOM": - return MeasurementUnitUnitTypeTypeCustom, nil - case "TYPE_AREA": - return MeasurementUnitUnitTypeTypeArea, nil - case "TYPE_LENGTH": - return MeasurementUnitUnitTypeTypeLength, nil - case "TYPE_VOLUME": - return MeasurementUnitUnitTypeTypeVolume, nil - case "TYPE_WEIGHT": - return MeasurementUnitUnitTypeTypeWeight, nil - case "TYPE_GENERIC": - return MeasurementUnitUnitTypeTypeGeneric, nil +func (p *PaymentBalanceActivityReleaseAdjustmentDetail) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { + return value + } } - var t MeasurementUnitUnitType - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (m MeasurementUnitUnitType) Ptr() *MeasurementUnitUnitType { - return &m + if value, err := core.StringifyJSON(p); err == nil { + return value + } + return fmt.Sprintf("%#v", p) } -// The unit of volume used to measure a quantity. -type MeasurementUnitVolume string - -const ( - MeasurementUnitVolumeGenericFluidOunce MeasurementUnitVolume = "GENERIC_FLUID_OUNCE" - MeasurementUnitVolumeGenericShot MeasurementUnitVolume = "GENERIC_SHOT" - MeasurementUnitVolumeGenericCup MeasurementUnitVolume = "GENERIC_CUP" - MeasurementUnitVolumeGenericPint MeasurementUnitVolume = "GENERIC_PINT" - MeasurementUnitVolumeGenericQuart MeasurementUnitVolume = "GENERIC_QUART" - MeasurementUnitVolumeGenericGallon MeasurementUnitVolume = "GENERIC_GALLON" - MeasurementUnitVolumeImperialCubicInch MeasurementUnitVolume = "IMPERIAL_CUBIC_INCH" - MeasurementUnitVolumeImperialCubicFoot MeasurementUnitVolume = "IMPERIAL_CUBIC_FOOT" - MeasurementUnitVolumeImperialCubicYard MeasurementUnitVolume = "IMPERIAL_CUBIC_YARD" - MeasurementUnitVolumeMetricMilliliter MeasurementUnitVolume = "METRIC_MILLILITER" - MeasurementUnitVolumeMetricLiter MeasurementUnitVolume = "METRIC_LITER" -) +type PaymentBalanceActivityReserveHoldDetail struct { + // The ID of the payment associated with this activity. + PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` -func NewMeasurementUnitVolumeFromString(s string) (MeasurementUnitVolume, error) { - switch s { - case "GENERIC_FLUID_OUNCE": - return MeasurementUnitVolumeGenericFluidOunce, nil - case "GENERIC_SHOT": - return MeasurementUnitVolumeGenericShot, nil - case "GENERIC_CUP": - return MeasurementUnitVolumeGenericCup, nil - case "GENERIC_PINT": - return MeasurementUnitVolumeGenericPint, nil - case "GENERIC_QUART": - return MeasurementUnitVolumeGenericQuart, nil - case "GENERIC_GALLON": - return MeasurementUnitVolumeGenericGallon, nil - case "IMPERIAL_CUBIC_INCH": - return MeasurementUnitVolumeImperialCubicInch, nil - case "IMPERIAL_CUBIC_FOOT": - return MeasurementUnitVolumeImperialCubicFoot, nil - case "IMPERIAL_CUBIC_YARD": - return MeasurementUnitVolumeImperialCubicYard, nil - case "METRIC_MILLILITER": - return MeasurementUnitVolumeMetricMilliliter, nil - case "METRIC_LITER": - return MeasurementUnitVolumeMetricLiter, nil - } - var t MeasurementUnitVolume - return "", fmt.Errorf("%s is not a valid %T", s, t) + extraProperties map[string]interface{} + _rawJSON json.RawMessage } -func (m MeasurementUnitVolume) Ptr() *MeasurementUnitVolume { - return &m +func (p *PaymentBalanceActivityReserveHoldDetail) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -// Unit of weight used to measure a quantity. -type MeasurementUnitWeight string - -const ( - MeasurementUnitWeightImperialWeightOunce MeasurementUnitWeight = "IMPERIAL_WEIGHT_OUNCE" - MeasurementUnitWeightImperialPound MeasurementUnitWeight = "IMPERIAL_POUND" - MeasurementUnitWeightImperialStone MeasurementUnitWeight = "IMPERIAL_STONE" - MeasurementUnitWeightMetricMilligram MeasurementUnitWeight = "METRIC_MILLIGRAM" - MeasurementUnitWeightMetricGram MeasurementUnitWeight = "METRIC_GRAM" - MeasurementUnitWeightMetricKilogram MeasurementUnitWeight = "METRIC_KILOGRAM" -) +func (p *PaymentBalanceActivityReserveHoldDetail) UnmarshalJSON(data []byte) error { + type unmarshaler PaymentBalanceActivityReserveHoldDetail + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *p = PaymentBalanceActivityReserveHoldDetail(value) -func NewMeasurementUnitWeightFromString(s string) (MeasurementUnitWeight, error) { - switch s { - case "IMPERIAL_WEIGHT_OUNCE": - return MeasurementUnitWeightImperialWeightOunce, nil - case "IMPERIAL_POUND": - return MeasurementUnitWeightImperialPound, nil - case "IMPERIAL_STONE": - return MeasurementUnitWeightImperialStone, nil - case "METRIC_MILLIGRAM": - return MeasurementUnitWeightMetricMilligram, nil - case "METRIC_GRAM": - return MeasurementUnitWeightMetricGram, nil - case "METRIC_KILOGRAM": - return MeasurementUnitWeightMetricKilogram, nil + extraProperties, err := core.ExtractExtraProperties(data, *p) + if err != nil { + return err } - var t MeasurementUnitWeight - return "", fmt.Errorf("%s is not a valid %T", s, t) + p.extraProperties = extraProperties + + p._rawJSON = json.RawMessage(data) + return nil } -func (m MeasurementUnitWeight) Ptr() *MeasurementUnitWeight { - return &m +func (p *PaymentBalanceActivityReserveHoldDetail) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(p); err == nil { + return value + } + return fmt.Sprintf("%#v", p) } -// Represents a business that sells with Square. -type Merchant struct { - // The Square-issued ID of the merchant. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The name of the merchant's overall business. - BusinessName *string `json:"business_name,omitempty" url:"business_name,omitempty"` - // The country code associated with the merchant, in the two-letter format of ISO 3166. For example, `US` or `JP`. - // See [Country](#type-country) for possible values - Country Country `json:"country" url:"country"` - // The code indicating the [language preferences](https://developer.squareup.com/docs/build-basics/general-considerations/language-preferences) of the merchant, in [BCP 47 format](https://tools.ietf.org/html/bcp47#appendix-A). For example, `en-US` or `fr-CA`. - LanguageCode *string `json:"language_code,omitempty" url:"language_code,omitempty"` - // The currency associated with the merchant, in ISO 4217 format. For example, the currency code for US dollars is `USD`. - // See [Currency](#type-currency) for possible values - Currency *Currency `json:"currency,omitempty" url:"currency,omitempty"` - // The merchant's status. - // See [MerchantStatus](#type-merchantstatus) for possible values - Status *MerchantStatus `json:"status,omitempty" url:"status,omitempty"` - // The ID of the [main `Location`](https://developer.squareup.com/docs/locations-api#about-the-main-location) for this merchant. - MainLocationID *string `json:"main_location_id,omitempty" url:"main_location_id,omitempty"` - // The time when the merchant was created, in RFC 3339 format. - // For more information, see [Working with Dates](https://developer.squareup.com/docs/build-basics/working-with-dates). - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` +type PaymentBalanceActivityReserveReleaseDetail struct { + // The ID of the payment associated with this activity. + PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (m *Merchant) GetExtraProperties() map[string]interface{} { - return m.extraProperties +func (p *PaymentBalanceActivityReserveReleaseDetail) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (m *Merchant) UnmarshalJSON(data []byte) error { - type unmarshaler Merchant +func (p *PaymentBalanceActivityReserveReleaseDetail) UnmarshalJSON(data []byte) error { + type unmarshaler PaymentBalanceActivityReserveReleaseDetail var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *m = Merchant(value) + *p = PaymentBalanceActivityReserveReleaseDetail(value) - extraProperties, err := core.ExtractExtraProperties(data, *m) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - m.extraProperties = extraProperties + p.extraProperties = extraProperties - m._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (m *Merchant) String() string { - if len(m._rawJSON) > 0 { - if value, err := core.StringifyJSON(m._rawJSON); err == nil { +func (p *PaymentBalanceActivityReserveReleaseDetail) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(m); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", m) + return fmt.Sprintf("%#v", p) } -type MerchantStatus string +type PaymentBalanceActivitySquareCapitalPaymentDetail struct { + // The ID of the payment associated with this activity. + PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` -const ( - MerchantStatusActive MerchantStatus = "ACTIVE" - MerchantStatusInactive MerchantStatus = "INACTIVE" -) + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} -func NewMerchantStatusFromString(s string) (MerchantStatus, error) { - switch s { - case "ACTIVE": - return MerchantStatusActive, nil - case "INACTIVE": - return MerchantStatusInactive, nil +func (p *PaymentBalanceActivitySquareCapitalPaymentDetail) GetExtraProperties() map[string]interface{} { + return p.extraProperties +} + +func (p *PaymentBalanceActivitySquareCapitalPaymentDetail) UnmarshalJSON(data []byte) error { + type unmarshaler PaymentBalanceActivitySquareCapitalPaymentDetail + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - var t MerchantStatus - return "", fmt.Errorf("%s is not a valid %T", s, t) + *p = PaymentBalanceActivitySquareCapitalPaymentDetail(value) + + extraProperties, err := core.ExtractExtraProperties(data, *p) + if err != nil { + return err + } + p.extraProperties = extraProperties + + p._rawJSON = json.RawMessage(data) + return nil } -func (m MerchantStatus) Ptr() *MerchantStatus { - return &m +func (p *PaymentBalanceActivitySquareCapitalPaymentDetail) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(p); err == nil { + return value + } + return fmt.Sprintf("%#v", p) } -// Location-specific overrides for specified properties of a `CatalogModifier` object. -type ModifierLocationOverrides struct { - // The ID of the `Location` object representing the location. This can include a deactivated location. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` - // The overridden price at the specified location. If this is unspecified, the modifier price is not overridden. - // The modifier becomes free of charge at the specified location, when this `price_money` field is set to 0. - PriceMoney *Money `json:"price_money,omitempty" url:"price_money,omitempty"` - // Indicates whether the modifier is sold out at the specified location or not. As an example, for cheese (modifier) burger (item), when the modifier is sold out, it is the cheese, but not the burger, that is sold out. - // The seller can manually set this sold out status. Attempts by an application to set this attribute are ignored. - SoldOut *bool `json:"sold_out,omitempty" url:"sold_out,omitempty"` +type PaymentBalanceActivitySquareCapitalReversedPaymentDetail struct { + // The ID of the payment associated with this activity. + PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (m *ModifierLocationOverrides) GetExtraProperties() map[string]interface{} { - return m.extraProperties +func (p *PaymentBalanceActivitySquareCapitalReversedPaymentDetail) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (m *ModifierLocationOverrides) UnmarshalJSON(data []byte) error { - type unmarshaler ModifierLocationOverrides +func (p *PaymentBalanceActivitySquareCapitalReversedPaymentDetail) UnmarshalJSON(data []byte) error { + type unmarshaler PaymentBalanceActivitySquareCapitalReversedPaymentDetail var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *m = ModifierLocationOverrides(value) + *p = PaymentBalanceActivitySquareCapitalReversedPaymentDetail(value) - extraProperties, err := core.ExtractExtraProperties(data, *m) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - m.extraProperties = extraProperties + p.extraProperties = extraProperties - m._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (m *ModifierLocationOverrides) String() string { - if len(m._rawJSON) > 0 { - if value, err := core.StringifyJSON(m._rawJSON); err == nil { +func (p *PaymentBalanceActivitySquareCapitalReversedPaymentDetail) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(m); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", m) + return fmt.Sprintf("%#v", p) } -// Represents an amount of money. `Money` fields can be signed or unsigned. -// Fields that do not explicitly define whether they are signed or unsigned are -// considered unsigned and can only hold positive amounts. For signed fields, the -// sign of the value indicates the purpose of the money transfer. See -// [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts) -// for more information. -type Money struct { - // The amount of money, in the smallest denomination of the currency - // indicated by `currency`. For example, when `currency` is `USD`, `amount` is - // in cents. Monetary amounts can be positive or negative. See the specific - // field description to determine the meaning of the sign in a particular case. - Amount *int64 `json:"amount,omitempty" url:"amount,omitempty"` - // The type of currency, in **ISO 4217 format**. For example, the currency - // code for US dollars is `USD`. - // - // See [Currency](entity:Currency) for possible values. - // See [Currency](#type-currency) for possible values - Currency *Currency `json:"currency,omitempty" url:"currency,omitempty"` +type PaymentBalanceActivityTaxOnFeeDetail struct { + // The ID of the payment associated with this activity. + PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` + // The description of the tax rate being applied. For example: "GST", "HST". + TaxRateDescription *string `json:"tax_rate_description,omitempty" url:"tax_rate_description,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (m *Money) GetExtraProperties() map[string]interface{} { - return m.extraProperties +func (p *PaymentBalanceActivityTaxOnFeeDetail) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (m *Money) UnmarshalJSON(data []byte) error { - type unmarshaler Money +func (p *PaymentBalanceActivityTaxOnFeeDetail) UnmarshalJSON(data []byte) error { + type unmarshaler PaymentBalanceActivityTaxOnFeeDetail var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *m = Money(value) + *p = PaymentBalanceActivityTaxOnFeeDetail(value) - extraProperties, err := core.ExtractExtraProperties(data, *m) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - m.extraProperties = extraProperties + p.extraProperties = extraProperties - m._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (m *Money) String() string { - if len(m._rawJSON) > 0 { - if value, err := core.StringifyJSON(m._rawJSON); err == nil { +func (p *PaymentBalanceActivityTaxOnFeeDetail) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(m); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", m) + return fmt.Sprintf("%#v", p) } -type ObtainTokenResponse struct { - // A valid OAuth access token. - // Provide the access token in a header with every request to Connect API - // endpoints. For more information, see [OAuth API: Walkthrough](https://developer.squareup.com/docs/oauth-api/walkthrough). - AccessToken *string `json:"access_token,omitempty" url:"access_token,omitempty"` - // This value is always _bearer_. - TokenType *string `json:"token_type,omitempty" url:"token_type,omitempty"` - // The date when the `access_token` expires, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm) format. - ExpiresAt *string `json:"expires_at,omitempty" url:"expires_at,omitempty"` - // The ID of the authorizing merchant's business. - MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` - // **LEGACY FIELD**. The ID of a subscription plan the merchant signed up - // for. The ID is only present if the merchant signed up for a subscription plan during authorization. - SubscriptionID *string `json:"subscription_id,omitempty" url:"subscription_id,omitempty"` - // **LEGACY FIELD**. The ID of the subscription plan the merchant signed - // up for. The ID is only present if the merchant signed up for a subscription plan during - // authorization. - PlanID *string `json:"plan_id,omitempty" url:"plan_id,omitempty"` - // The OpenID token belonging to this person. This token is only present if the - // OPENID scope is included in the authorization request. - IDToken *string `json:"id_token,omitempty" url:"id_token,omitempty"` - // A refresh token. - // For more information, see [Refresh, Revoke, and Limit the Scope of OAuth Tokens](https://developer.squareup.com/docs/oauth-api/refresh-revoke-limit-scope). - RefreshToken *string `json:"refresh_token,omitempty" url:"refresh_token,omitempty"` - // A Boolean indicating that the access token is a short-lived access token. - // The short-lived access token returned in the response expires in 24 hours. - ShortLived *bool `json:"short_lived,omitempty" url:"short_lived,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The date when the `refresh_token` expires, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm) format. - RefreshTokenExpiresAt *string `json:"refresh_token_expires_at,omitempty" url:"refresh_token_expires_at,omitempty"` +type PaymentBalanceActivityThirdPartyFeeDetail struct { + // The ID of the payment associated with this activity. + PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *ObtainTokenResponse) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (p *PaymentBalanceActivityThirdPartyFeeDetail) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (o *ObtainTokenResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ObtainTokenResponse +func (p *PaymentBalanceActivityThirdPartyFeeDetail) UnmarshalJSON(data []byte) error { + type unmarshaler PaymentBalanceActivityThirdPartyFeeDetail var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = ObtainTokenResponse(value) + *p = PaymentBalanceActivityThirdPartyFeeDetail(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - o.extraProperties = extraProperties + p.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (o *ObtainTokenResponse) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (p *PaymentBalanceActivityThirdPartyFeeDetail) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", p) } -// Details specific to offline payments. -type OfflinePaymentDetails struct { - // The client-side timestamp of when the offline payment was created, in RFC 3339 format. - ClientCreatedAt *string `json:"client_created_at,omitempty" url:"client_created_at,omitempty"` +type PaymentBalanceActivityThirdPartyFeeRefundDetail struct { + // The ID of the payment associated with this activity. + PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` + // The public refund id associated with this activity. + RefundID *string `json:"refund_id,omitempty" url:"refund_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OfflinePaymentDetails) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (p *PaymentBalanceActivityThirdPartyFeeRefundDetail) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (o *OfflinePaymentDetails) UnmarshalJSON(data []byte) error { - type unmarshaler OfflinePaymentDetails +func (p *PaymentBalanceActivityThirdPartyFeeRefundDetail) UnmarshalJSON(data []byte) error { + type unmarshaler PaymentBalanceActivityThirdPartyFeeRefundDetail var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OfflinePaymentDetails(value) + *p = PaymentBalanceActivityThirdPartyFeeRefundDetail(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - o.extraProperties = extraProperties + p.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (o *OfflinePaymentDetails) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (p *PaymentBalanceActivityThirdPartyFeeRefundDetail) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", p) } -// Contains all information related to a single order to process with Square, -// including line items that specify the products to purchase. `Order` objects also -// include information about any associated tenders, refunds, and returns. -// -// All Connect V2 Transactions have all been converted to Orders including all associated -// itemization data. -type Order struct { - // The order's unique ID. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The ID of the seller location that this order is associated with. - LocationID string `json:"location_id" url:"location_id"` - // A client-specified ID to associate an entity in another system - // with this order. - ReferenceID *string `json:"reference_id,omitempty" url:"reference_id,omitempty"` - // The origination details of the order. - Source *OrderSource `json:"source,omitempty" url:"source,omitempty"` - // The ID of the [customer]($m/Customer) associated with the order. - // - // You should specify a `customer_id` on the order (or the payment) to ensure that transactions - // are reliably linked to customers. Omitting this field might result in the creation of new - // [instant profiles](https://developer.squareup.com/docs/customers-api/what-it-does#instant-profiles). - CustomerID *string `json:"customer_id,omitempty" url:"customer_id,omitempty"` - // The line items included in the order. - LineItems []*OrderLineItem `json:"line_items,omitempty" url:"line_items,omitempty"` - // The list of all taxes associated with the order. - // - // Taxes can be scoped to either `ORDER` or `LINE_ITEM`. For taxes with `LINE_ITEM` scope, an - // `OrderLineItemAppliedTax` must be added to each line item that the tax applies to. For taxes - // with `ORDER` scope, the server generates an `OrderLineItemAppliedTax` for every line item. - // - // On reads, each tax in the list includes the total amount of that tax applied to the order. - // - // **IMPORTANT**: If `LINE_ITEM` scope is set on any taxes in this field, using the deprecated - // `line_items.taxes` field results in an error. Use `line_items.applied_taxes` - // instead. - Taxes []*OrderLineItemTax `json:"taxes,omitempty" url:"taxes,omitempty"` - // The list of all discounts associated with the order. - // - // Discounts can be scoped to either `ORDER` or `LINE_ITEM`. For discounts scoped to `LINE_ITEM`, - // an `OrderLineItemAppliedDiscount` must be added to each line item that the discount applies to. - // For discounts with `ORDER` scope, the server generates an `OrderLineItemAppliedDiscount` - // for every line item. - // - // **IMPORTANT**: If `LINE_ITEM` scope is set on any discounts in this field, using the deprecated - // `line_items.discounts` field results in an error. Use `line_items.applied_discounts` - // instead. - Discounts []*OrderLineItemDiscount `json:"discounts,omitempty" url:"discounts,omitempty"` - // A list of service charges applied to the order. - ServiceCharges []*OrderServiceCharge `json:"service_charges,omitempty" url:"service_charges,omitempty"` - // Details about order fulfillment. - // - // Orders can only be created with at most one fulfillment. However, orders returned - // by the API might contain multiple fulfillments. - Fulfillments []*Fulfillment `json:"fulfillments,omitempty" url:"fulfillments,omitempty"` - // A collection of items from sale orders being returned in this one. Normally part of an - // itemized return or exchange. There is exactly one `Return` object per sale `Order` being - // referenced. - Returns []*OrderReturn `json:"returns,omitempty" url:"returns,omitempty"` - // The rollup of the returned money amounts. - ReturnAmounts *OrderMoneyAmounts `json:"return_amounts,omitempty" url:"return_amounts,omitempty"` - // The net money amounts (sale money - return money). - NetAmounts *OrderMoneyAmounts `json:"net_amounts,omitempty" url:"net_amounts,omitempty"` - // A positive rounding adjustment to the total of the order. This adjustment is commonly - // used to apply cash rounding when the minimum unit of account is smaller than the lowest physical - // denomination of the currency. - RoundingAdjustment *OrderRoundingAdjustment `json:"rounding_adjustment,omitempty" url:"rounding_adjustment,omitempty"` - // The tenders that were used to pay for the order. - Tenders []*Tender `json:"tenders,omitempty" url:"tenders,omitempty"` - // The refunds that are part of this order. - Refunds []*Refund `json:"refunds,omitempty" url:"refunds,omitempty"` - // Application-defined data attached to this order. Metadata fields are intended - // to store descriptive references or associations with an entity in another system or store brief - // information about the object. Square does not process this field; it only stores and returns it - // in relevant API calls. Do not use metadata to store any sensitive information (such as personally - // identifiable information or card details). - // - // Keys written by applications must be 60 characters or less and must be in the character set - // `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed - // with a namespace, separated from the key with a ':' character. - // - // Values have a maximum length of 255 characters. - // - // An application can have up to 10 entries per metadata field. - // - // Entries written by applications are private and can only be read or modified by the same - // application. - // - // For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). - Metadata map[string]*string `json:"metadata,omitempty" url:"metadata,omitempty"` - // The timestamp for when the order was created, at server side, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). +// Published when a [Payment](entity:Payment) is created. +type PaymentCreatedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents, `"payment.created"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The timestamp for when the order was last updated, at server side, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` - // The timestamp for when the order reached a terminal [state](entity:OrderState), in RFC 3339 format (for example "2016-09-04T23:59:33.123Z"). - ClosedAt *string `json:"closed_at,omitempty" url:"closed_at,omitempty"` - // The current state of the order. - // See [OrderState](#type-orderstate) for possible values - State *OrderState `json:"state,omitempty" url:"state,omitempty"` - // The version number, which is incremented each time an update is committed to the order. - // Orders not created through the API do not include a version number and - // therefore cannot be updated. - // - // [Read more about working with versions](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders). - Version *int `json:"version,omitempty" url:"version,omitempty"` - // The total amount of money to collect for the order. - TotalMoney *Money `json:"total_money,omitempty" url:"total_money,omitempty"` - // The total amount of tax money to collect for the order. - TotalTaxMoney *Money `json:"total_tax_money,omitempty" url:"total_tax_money,omitempty"` - // The total amount of discount money to collect for the order. - TotalDiscountMoney *Money `json:"total_discount_money,omitempty" url:"total_discount_money,omitempty"` - // The total amount of tip money to collect for the order. - TotalTipMoney *Money `json:"total_tip_money,omitempty" url:"total_tip_money,omitempty"` - // The total amount of money collected in service charges for the order. - // - // Note: `total_service_charge_money` is the sum of `applied_money` fields for each individual - // service charge. Therefore, `total_service_charge_money` only includes inclusive tax amounts, - // not additive tax amounts. - TotalServiceChargeMoney *Money `json:"total_service_charge_money,omitempty" url:"total_service_charge_money,omitempty"` - // A short-term identifier for the order (such as a customer first name, - // table number, or auto-generated order number that resets daily). - TicketName *string `json:"ticket_name,omitempty" url:"ticket_name,omitempty"` - // Pricing options for an order. The options affect how the order's price is calculated. - // They can be used, for example, to apply automatic price adjustments that are based on - // preconfigured [pricing rules](entity:CatalogPricingRule). - PricingOptions *OrderPricingOptions `json:"pricing_options,omitempty" url:"pricing_options,omitempty"` - // A set-like list of Rewards that have been added to the Order. - Rewards []*OrderReward `json:"rewards,omitempty" url:"rewards,omitempty"` - // The net amount of money due on the order. - NetAmountDueMoney *Money `json:"net_amount_due_money,omitempty" url:"net_amount_due_money,omitempty"` + // Data associated with the event. + Data *PaymentCreatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *Order) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (p *PaymentCreatedEvent) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (o *Order) UnmarshalJSON(data []byte) error { - type unmarshaler Order +func (p *PaymentCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler PaymentCreatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = Order(value) + *p = PaymentCreatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - o.extraProperties = extraProperties + p.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (o *Order) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (p *PaymentCreatedEvent) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", p) } -type OrderCreated struct { - // The order's unique ID. - OrderID *string `json:"order_id,omitempty" url:"order_id,omitempty"` - // The version number, which is incremented each time an update is committed to the order. - // Orders that were not created through the API do not include a version number and - // therefore cannot be updated. - // - // [Read more about working with versions.](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders) - Version *int `json:"version,omitempty" url:"version,omitempty"` - // The ID of the seller location that this order is associated with. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` - // The state of the order. - // See [OrderState](#type-orderstate) for possible values - State *OrderState `json:"state,omitempty" url:"state,omitempty"` - // The timestamp for when the order was created, in RFC 3339 format. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` +type PaymentCreatedEventData struct { + // Name of the affected object’s type, `"payment"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the affected payment. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the created payment. + Object *PaymentCreatedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderCreated) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (p *PaymentCreatedEventData) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (o *OrderCreated) UnmarshalJSON(data []byte) error { - type unmarshaler OrderCreated +func (p *PaymentCreatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler PaymentCreatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderCreated(value) + *p = PaymentCreatedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - o.extraProperties = extraProperties + p.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (o *OrderCreated) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (p *PaymentCreatedEventData) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", p) } -type OrderCreatedObject struct { - // Information about the created order. - OrderCreated *OrderCreated `json:"order_created,omitempty" url:"order_created,omitempty"` +type PaymentCreatedEventObject struct { + // The created payment. + Payment *Payment `json:"payment,omitempty" url:"payment,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderCreatedObject) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (p *PaymentCreatedEventObject) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (o *OrderCreatedObject) UnmarshalJSON(data []byte) error { - type unmarshaler OrderCreatedObject +func (p *PaymentCreatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler PaymentCreatedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderCreatedObject(value) + *p = PaymentCreatedEventObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - o.extraProperties = extraProperties + p.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (o *OrderCreatedObject) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (p *PaymentCreatedEventObject) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", p) } -// A lightweight description of an [order]($m/Order) that is returned when -// `returned_entries` is `true` on a [SearchOrdersRequest]($e/Orders/SearchOrders). -type OrderEntry struct { - // The ID of the order. +type PaymentLink struct { + // The Square-assigned ID of the payment link. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The Square-assigned version number, which is incremented each time an update is committed to the payment link. + Version int `json:"version" url:"version"` + // The optional description of the `payment_link` object. + // It is primarily for use by your application and is not used anywhere. + Description *string `json:"description,omitempty" url:"description,omitempty"` + // The ID of the order associated with the payment link. OrderID *string `json:"order_id,omitempty" url:"order_id,omitempty"` - // The version number, which is incremented each time an update is committed to the order. - // Orders that were not created through the API do not include a version number and - // therefore cannot be updated. - // - // [Read more about working with versions.](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders) - Version *int `json:"version,omitempty" url:"version,omitempty"` - // The location ID the order belongs to. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The checkout options configured for the payment link. + // For more information, see [Optional Checkout Configurations](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations). + CheckoutOptions *CheckoutOptions `json:"checkout_options,omitempty" url:"checkout_options,omitempty"` + // Describes buyer data to prepopulate + // on the checkout page. + PrePopulatedData *PrePopulatedData `json:"pre_populated_data,omitempty" url:"pre_populated_data,omitempty"` + // The shortened URL of the payment link. + URL *string `json:"url,omitempty" url:"url,omitempty"` + // The long URL of the payment link. + LongURL *string `json:"long_url,omitempty" url:"long_url,omitempty"` + // The timestamp when the payment link was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The timestamp when the payment link was last updated, in RFC 3339 format. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // An optional note. After Square processes the payment, this note is added to the + // resulting `Payment`. + PaymentNote *string `json:"payment_note,omitempty" url:"payment_note,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderEntry) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (p *PaymentLink) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (o *OrderEntry) UnmarshalJSON(data []byte) error { - type unmarshaler OrderEntry +func (p *PaymentLink) UnmarshalJSON(data []byte) error { + type unmarshaler PaymentLink var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderEntry(value) + *p = PaymentLink(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - o.extraProperties = extraProperties + p.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (o *OrderEntry) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (p *PaymentLink) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", p) } -// Contains details about how to fulfill this order. -// Orders can only be created with at most one fulfillment using the API. -// However, orders returned by the Orders API might contain multiple fulfillments because sellers can create multiple fulfillments using Square products such as Square Online. -type OrderFulfillment struct { - // A unique ID that identifies the fulfillment only within this order. - UID *string `json:"uid,omitempty" url:"uid,omitempty"` - // The type of the fulfillment. - // See [OrderFulfillmentType](#type-orderfulfillmenttype) for possible values - Type *OrderFulfillmentType `json:"type,omitempty" url:"type,omitempty"` - // The state of the fulfillment. - // See [OrderFulfillmentState](#type-orderfulfillmentstate) for possible values - State *OrderFulfillmentState `json:"state,omitempty" url:"state,omitempty"` - // Describes what order line items this fulfillment applies to. - // It can be `ALL` or `ENTRY_LIST` with a supplied list of fulfillment entries. - // See [OrderFulfillmentFulfillmentLineItemApplication](#type-orderfulfillmentfulfillmentlineitemapplication) for possible values - LineItemApplication *OrderFulfillmentFulfillmentLineItemApplication `json:"line_item_application,omitempty" url:"line_item_application,omitempty"` - // A list of entries pertaining to the fulfillment of an order. Each entry must reference - // a valid `uid` for an order line item in the `line_item_uid` field, as well as a `quantity` to - // fulfill. - // Multiple entries can reference the same line item `uid`, as long as the total quantity among - // all fulfillment entries referencing a single line item does not exceed the quantity of the - // order's line item itself. - // An order cannot be marked as `COMPLETED` before all fulfillments are `COMPLETED`, - // `CANCELED`, or `FAILED`. Fulfillments can be created and completed independently - // before order completion. - Entries []*OrderFulfillmentFulfillmentEntry `json:"entries,omitempty" url:"entries,omitempty"` - // Application-defined data attached to this fulfillment. Metadata fields are intended - // to store descriptive references or associations with an entity in another system or store brief - // information about the object. Square does not process this field; it only stores and returns it - // in relevant API calls. Do not use metadata to store any sensitive information (such as personally - // identifiable information or card details). - // Keys written by applications must be 60 characters or less and must be in the character set - // `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed - // with a namespace, separated from the key with a ':' character. - // Values have a maximum length of 255 characters. - // An application can have up to 10 entries per metadata field. - // Entries written by applications are private and can only be read or modified by the same - // application. - // For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). - Metadata map[string]*string `json:"metadata,omitempty" url:"metadata,omitempty"` - // Contains details for a pickup fulfillment. These details are required when the fulfillment - // type is `PICKUP`. - PickupDetails *OrderFulfillmentPickupDetails `json:"pickup_details,omitempty" url:"pickup_details,omitempty"` - // Contains details for a shipment fulfillment. These details are required when the fulfillment type - // is `SHIPMENT`. - // A shipment fulfillment's relationship to fulfillment `state`: - // `PROPOSED`: A shipment is requested. - // `RESERVED`: Fulfillment in progress. Shipment processing. - // `PREPARED`: Shipment packaged. Shipping label created. - // `COMPLETED`: Package has been shipped. - // `CANCELED`: Shipment has been canceled. - // `FAILED`: Shipment has failed. - ShipmentDetails *OrderFulfillmentShipmentDetails `json:"shipment_details,omitempty" url:"shipment_details,omitempty"` - // Describes delivery details of an order fulfillment. - DeliveryDetails *OrderFulfillmentDeliveryDetails `json:"delivery_details,omitempty" url:"delivery_details,omitempty"` +type PaymentLinkRelatedResources struct { + // The order associated with the payment link. + Orders []*Order `json:"orders,omitempty" url:"orders,omitempty"` + // The subscription plan associated with the payment link. + SubscriptionPlans []*CatalogObject `json:"subscription_plans,omitempty" url:"subscription_plans,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderFulfillment) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (p *PaymentLinkRelatedResources) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (o *OrderFulfillment) UnmarshalJSON(data []byte) error { - type unmarshaler OrderFulfillment +func (p *PaymentLinkRelatedResources) UnmarshalJSON(data []byte) error { + type unmarshaler PaymentLinkRelatedResources var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderFulfillment(value) + *p = PaymentLinkRelatedResources(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - o.extraProperties = extraProperties + p.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (o *OrderFulfillment) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (p *PaymentLinkRelatedResources) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", p) } -// Describes delivery details of an order fulfillment. -type OrderFulfillmentDeliveryDetails struct { - // The contact information for the person to receive the fulfillment. - Recipient *OrderFulfillmentRecipient `json:"recipient,omitempty" url:"recipient,omitempty"` - // Indicates the fulfillment delivery schedule type. If `SCHEDULED`, then - // `deliver_at` is required. If `ASAP`, then `prep_time_duration` is required. The default is `SCHEDULED`. - // See [OrderFulfillmentDeliveryDetailsScheduleType](#type-orderfulfillmentdeliverydetailsscheduletype) for possible values - ScheduleType *OrderFulfillmentDeliveryDetailsScheduleType `json:"schedule_type,omitempty" url:"schedule_type,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when the fulfillment was placed. - // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - // Must be in RFC 3339 timestamp format, e.g., "2016-09-04T23:59:33.123Z". - PlacedAt *string `json:"placed_at,omitempty" url:"placed_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // that represents the start of the delivery period. - // When the fulfillment `schedule_type` is `ASAP`, the field is automatically - // set to the current time plus the `prep_time_duration`. - // Otherwise, the application can set this field while the fulfillment `state` is - // `PROPOSED`, `RESERVED`, or `PREPARED` (any time before the - // terminal state such as `COMPLETED`, `CANCELED`, and `FAILED`). +type PaymentOptions struct { + // Indicates whether the `Payment` objects created from this `TerminalCheckout` are automatically + // `COMPLETED` or left in an `APPROVED` state for later modification. + Autocomplete *bool `json:"autocomplete,omitempty" url:"autocomplete,omitempty"` + // The duration of time after the payment's creation when Square automatically cancels the + // payment. This automatic cancellation applies only to payments that do not reach a terminal state + // (COMPLETED or CANCELED) before the `delay_duration` time period. // - // The timestamp must be in RFC 3339 format - // (for example, "2016-09-04T23:59:33.123Z"). - DeliverAt *string `json:"deliver_at,omitempty" url:"deliver_at,omitempty"` - // The duration of time it takes to prepare and deliver this fulfillment. - // The duration must be in RFC 3339 format (for example, "P1W3D"). - PrepTimeDuration *string `json:"prep_time_duration,omitempty" url:"prep_time_duration,omitempty"` - // The time period after `deliver_at` in which to deliver the order. - // Applications can set this field when the fulfillment `state` is - // `PROPOSED`, `RESERVED`, or `PREPARED` (any time before the terminal state - // such as `COMPLETED`, `CANCELED`, and `FAILED`). - // The duration must be in RFC 3339 format (for example, "P1W3D"). - DeliveryWindowDuration *string `json:"delivery_window_duration,omitempty" url:"delivery_window_duration,omitempty"` - // Provides additional instructions about the delivery fulfillment. - // It is displayed in the Square Point of Sale application and set by the API. - Note *string `json:"note,omitempty" url:"note,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicates when the seller completed the fulfillment. - // This field is automatically set when fulfillment `state` changes to `COMPLETED`. - // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - CompletedAt *string `json:"completed_at,omitempty" url:"completed_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicates when the seller started processing the fulfillment. - // This field is automatically set when the fulfillment `state` changes to `RESERVED`. - // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - InProgressAt *string `json:"in_progress_at,omitempty" url:"in_progress_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when the fulfillment was rejected. This field is - // automatically set when the fulfillment `state` changes to `FAILED`. - // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - RejectedAt *string `json:"rejected_at,omitempty" url:"rejected_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when the seller marked the fulfillment as ready for - // courier pickup. This field is automatically set when the fulfillment `state` changes - // to PREPARED. - // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - ReadyAt *string `json:"ready_at,omitempty" url:"ready_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when the fulfillment was delivered to the recipient. - // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - DeliveredAt *string `json:"delivered_at,omitempty" url:"delivered_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when the fulfillment was canceled. This field is automatically - // set when the fulfillment `state` changes to `CANCELED`. + // This parameter should be specified as a time duration, in RFC 3339 format, with a minimum value + // of 1 minute. // - // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - CanceledAt *string `json:"canceled_at,omitempty" url:"canceled_at,omitempty"` - // The delivery cancellation reason. Max length: 100 characters. - CancelReason *string `json:"cancel_reason,omitempty" url:"cancel_reason,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when an order can be picked up by the courier for delivery. - // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - CourierPickupAt *string `json:"courier_pickup_at,omitempty" url:"courier_pickup_at,omitempty"` - // The time period after `courier_pickup_at` in which the courier should pick up the order. - // The duration must be in RFC 3339 format (for example, "P1W3D"). - CourierPickupWindowDuration *string `json:"courier_pickup_window_duration,omitempty" url:"courier_pickup_window_duration,omitempty"` - // Whether the delivery is preferred to be no contact. - IsNoContactDelivery *bool `json:"is_no_contact_delivery,omitempty" url:"is_no_contact_delivery,omitempty"` - // A note to provide additional instructions about how to deliver the order. - DropoffNotes *string `json:"dropoff_notes,omitempty" url:"dropoff_notes,omitempty"` - // The name of the courier provider. - CourierProviderName *string `json:"courier_provider_name,omitempty" url:"courier_provider_name,omitempty"` - // The support phone number of the courier. - CourierSupportPhoneNumber *string `json:"courier_support_phone_number,omitempty" url:"courier_support_phone_number,omitempty"` - // The identifier for the delivery created by Square. - SquareDeliveryID *string `json:"square_delivery_id,omitempty" url:"square_delivery_id,omitempty"` - // The identifier for the delivery created by the third-party courier service. - ExternalDeliveryID *string `json:"external_delivery_id,omitempty" url:"external_delivery_id,omitempty"` - // The flag to indicate the delivery is managed by a third party (ie DoorDash), which means - // we may not receive all recipient information for PII purposes. - ManagedDelivery *bool `json:"managed_delivery,omitempty" url:"managed_delivery,omitempty"` + // Note: This feature is only supported for card payments. This parameter can only be set for a delayed + // capture payment (`autocomplete=false`). + // Default: + // + // - Card-present payments: "PT36H" (36 hours) from the creation time. + // - Card-not-present payments: "P7D" (7 days) from the creation time. + DelayDuration *string `json:"delay_duration,omitempty" url:"delay_duration,omitempty"` + // If set to `true` and charging a Square Gift Card, a payment might be returned with + // `amount_money` equal to less than what was requested. For example, a request for $20 when charging + // a Square Gift Card with a balance of $5 results in an APPROVED payment of $5. You might choose + // to prompt the buyer for an additional payment to cover the remainder or cancel the Gift Card + // payment. + // + // This field cannot be `true` when `autocomplete = true`. + // This field cannot be `true` when an `order_id` isn't specified. + // + // For more information, see + // [Take Partial Payments](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/partial-payments-with-gift-cards). + // + // Default: false + AcceptPartialAuthorization *bool `json:"accept_partial_authorization,omitempty" url:"accept_partial_authorization,omitempty"` + // The action to be applied to the payment when the delay_duration has elapsed. + // The action must be CANCEL or COMPLETE. + // + // This parameter can only be set for a delayed capture payment (when `autocomplete` is `false`). + // See [DelayAction](#type-delayaction) for possible values + DelayAction *PaymentOptionsDelayAction `json:"delay_action,omitempty" url:"delay_action,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderFulfillmentDeliveryDetails) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (p *PaymentOptions) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (o *OrderFulfillmentDeliveryDetails) UnmarshalJSON(data []byte) error { - type unmarshaler OrderFulfillmentDeliveryDetails +func (p *PaymentOptions) UnmarshalJSON(data []byte) error { + type unmarshaler PaymentOptions var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderFulfillmentDeliveryDetails(value) + *p = PaymentOptions(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - o.extraProperties = extraProperties + p.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (o *OrderFulfillmentDeliveryDetails) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (p *PaymentOptions) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", p) } -// The schedule type of the delivery fulfillment. -type OrderFulfillmentDeliveryDetailsScheduleType string +// Describes the action to be applied to a delayed capture payment when the delay_duration +// has elapsed. +type PaymentOptionsDelayAction string const ( - OrderFulfillmentDeliveryDetailsScheduleTypeScheduled OrderFulfillmentDeliveryDetailsScheduleType = "SCHEDULED" - OrderFulfillmentDeliveryDetailsScheduleTypeAsap OrderFulfillmentDeliveryDetailsScheduleType = "ASAP" + PaymentOptionsDelayActionInvalidType PaymentOptionsDelayAction = "INVALID_TYPE" + PaymentOptionsDelayActionCancel PaymentOptionsDelayAction = "CANCEL" + PaymentOptionsDelayActionComplete PaymentOptionsDelayAction = "COMPLETE" ) -func NewOrderFulfillmentDeliveryDetailsScheduleTypeFromString(s string) (OrderFulfillmentDeliveryDetailsScheduleType, error) { +func NewPaymentOptionsDelayActionFromString(s string) (PaymentOptionsDelayAction, error) { switch s { - case "SCHEDULED": - return OrderFulfillmentDeliveryDetailsScheduleTypeScheduled, nil - case "ASAP": - return OrderFulfillmentDeliveryDetailsScheduleTypeAsap, nil + case "INVALID_TYPE": + return PaymentOptionsDelayActionInvalidType, nil + case "CANCEL": + return PaymentOptionsDelayActionCancel, nil + case "COMPLETE": + return PaymentOptionsDelayActionComplete, nil } - var t OrderFulfillmentDeliveryDetailsScheduleType + var t PaymentOptionsDelayAction return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (o OrderFulfillmentDeliveryDetailsScheduleType) Ptr() *OrderFulfillmentDeliveryDetailsScheduleType { - return &o +func (p PaymentOptionsDelayAction) Ptr() *PaymentOptionsDelayAction { + return &p } -// Links an order line item to a fulfillment. Each entry must reference -// a valid `uid` for an order line item in the `line_item_uid` field, as well as a `quantity` to -// fulfill. -type OrderFulfillmentFulfillmentEntry struct { - // A unique ID that identifies the fulfillment entry only within this order. - UID *string `json:"uid,omitempty" url:"uid,omitempty"` - // The `uid` from the order line item. - LineItemUID string `json:"line_item_uid" url:"line_item_uid"` - // The quantity of the line item being fulfilled, formatted as a decimal number. - // For example, `"3"`. - // Fulfillments for line items with a `quantity_unit` can have non-integer quantities. - // For example, `"1.70000"`. - Quantity string `json:"quantity" url:"quantity"` - // Application-defined data attached to this fulfillment entry. Metadata fields are intended - // to store descriptive references or associations with an entity in another system or store brief - // information about the object. Square does not process this field; it only stores and returns it - // in relevant API calls. Do not use metadata to store any sensitive information (such as personally - // identifiable information or card details). - // Keys written by applications must be 60 characters or less and must be in the character set - // `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed - // with a namespace, separated from the key with a ':' character. - // Values have a maximum length of 255 characters. - // An application can have up to 10 entries per metadata field. - // Entries written by applications are private and can only be read or modified by the same - // application. - // For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). - Metadata map[string]*string `json:"metadata,omitempty" url:"metadata,omitempty"` +// Represents a refund of a payment made using Square. Contains information about +// the original payment and the amount of money refunded. +type PaymentRefund struct { + // The unique ID for this refund, generated by Square. + ID string `json:"id" url:"id"` + // The refund's status: + // + // - `PENDING` - Awaiting approval. + // - `COMPLETED` - Successfully completed. + // - `REJECTED` - The refund was rejected. + // - `FAILED` - An error occurred. + Status *string `json:"status,omitempty" url:"status,omitempty"` + // The location ID associated with the payment this refund is attached to. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // Flag indicating whether or not the refund is linked to an existing payment in Square. + Unlinked *bool `json:"unlinked,omitempty" url:"unlinked,omitempty"` + // The destination type for this refund. + // + // Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `BUY_NOW_PAY_LATER`, `CASH`, + // `EXTERNAL`, and `SQUARE_ACCOUNT`. + DestinationType *string `json:"destination_type,omitempty" url:"destination_type,omitempty"` + // Contains information about the refund destination. This field is populated only if + // `destination_id` is defined in the `RefundPayment` request. + DestinationDetails *DestinationDetails `json:"destination_details,omitempty" url:"destination_details,omitempty"` + // The amount of money refunded. This amount is specified in the smallest denomination + // of the applicable currency (for example, US dollar amounts are specified in cents). + AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` + // The amount of money the application developer contributed to help cover the refunded amount. + // This amount is specified in the smallest denomination of the applicable currency (for example, + // US dollar amounts are specified in cents). For more information, see + // [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts). + AppFeeMoney *Money `json:"app_fee_money,omitempty" url:"app_fee_money,omitempty"` + // Processing fees and fee adjustments assessed by Square for this refund. + ProcessingFee []*ProcessingFee `json:"processing_fee,omitempty" url:"processing_fee,omitempty"` + // The ID of the payment associated with this refund. + PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` + // The ID of the order associated with the refund. + OrderID *string `json:"order_id,omitempty" url:"order_id,omitempty"` + // The reason for the refund. + Reason *string `json:"reason,omitempty" url:"reason,omitempty"` + // The timestamp of when the refund was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The timestamp of when the refund was last updated, in RFC 3339 format. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // An optional ID of the team member associated with taking the payment. + TeamMemberID *string `json:"team_member_id,omitempty" url:"team_member_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderFulfillmentFulfillmentEntry) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (p *PaymentRefund) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (o *OrderFulfillmentFulfillmentEntry) UnmarshalJSON(data []byte) error { - type unmarshaler OrderFulfillmentFulfillmentEntry +func (p *PaymentRefund) UnmarshalJSON(data []byte) error { + type unmarshaler PaymentRefund var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderFulfillmentFulfillmentEntry(value) + *p = PaymentRefund(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - o.extraProperties = extraProperties + p.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (o *OrderFulfillmentFulfillmentEntry) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (p *PaymentRefund) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", o) -} - -// The `line_item_application` describes what order line items this fulfillment applies -// to. It can be `ALL` or `ENTRY_LIST` with a supplied list of fulfillment entries. -type OrderFulfillmentFulfillmentLineItemApplication string - -const ( - OrderFulfillmentFulfillmentLineItemApplicationAll OrderFulfillmentFulfillmentLineItemApplication = "ALL" - OrderFulfillmentFulfillmentLineItemApplicationEntryList OrderFulfillmentFulfillmentLineItemApplication = "ENTRY_LIST" -) - -func NewOrderFulfillmentFulfillmentLineItemApplicationFromString(s string) (OrderFulfillmentFulfillmentLineItemApplication, error) { - switch s { - case "ALL": - return OrderFulfillmentFulfillmentLineItemApplicationAll, nil - case "ENTRY_LIST": - return OrderFulfillmentFulfillmentLineItemApplicationEntryList, nil - } - var t OrderFulfillmentFulfillmentLineItemApplication - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (o OrderFulfillmentFulfillmentLineItemApplication) Ptr() *OrderFulfillmentFulfillmentLineItemApplication { - return &o + return fmt.Sprintf("%#v", p) } -// Contains details necessary to fulfill a pickup order. -type OrderFulfillmentPickupDetails struct { - // Information about the person to pick up this fulfillment from a physical - // location. - Recipient *OrderFulfillmentRecipient `json:"recipient,omitempty" url:"recipient,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when this fulfillment expires if it is not marked in progress. The timestamp must be - // in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). The expiration time can only be set - // up to 7 days in the future. If `expires_at` is not set, any new payments attached to the order - // are automatically completed. - ExpiresAt *string `json:"expires_at,omitempty" url:"expires_at,omitempty"` - // The duration of time after which an in progress pickup fulfillment is automatically moved - // to the `COMPLETED` state. The duration must be in RFC 3339 format (for example, "P1W3D"). - // - // If not set, this pickup fulfillment remains in progress until it is canceled or completed. - AutoCompleteDuration *string `json:"auto_complete_duration,omitempty" url:"auto_complete_duration,omitempty"` - // The schedule type of the pickup fulfillment. Defaults to `SCHEDULED`. - // See [OrderFulfillmentPickupDetailsScheduleType](#type-orderfulfillmentpickupdetailsscheduletype) for possible values - ScheduleType *OrderFulfillmentPickupDetailsScheduleType `json:"schedule_type,omitempty" url:"schedule_type,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // that represents the start of the pickup window. Must be in RFC 3339 timestamp format, e.g., - // "2016-09-04T23:59:33.123Z". - // For fulfillments with the schedule type `ASAP`, this is automatically set - // to the current time plus the expected duration to prepare the fulfillment. - PickupAt *string `json:"pickup_at,omitempty" url:"pickup_at,omitempty"` - // The window of time in which the order should be picked up after the `pickup_at` timestamp. - // Must be in RFC 3339 duration format, e.g., "P1W3D". Can be used as an - // informational guideline for merchants. - PickupWindowDuration *string `json:"pickup_window_duration,omitempty" url:"pickup_window_duration,omitempty"` - // The duration of time it takes to prepare this fulfillment. - // The duration must be in RFC 3339 format (for example, "P1W3D"). - PrepTimeDuration *string `json:"prep_time_duration,omitempty" url:"prep_time_duration,omitempty"` - // A note to provide additional instructions about the pickup - // fulfillment displayed in the Square Point of Sale application and set by the API. - Note *string `json:"note,omitempty" url:"note,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when the fulfillment was placed. The timestamp must be in RFC 3339 format - // (for example, "2016-09-04T23:59:33.123Z"). - PlacedAt *string `json:"placed_at,omitempty" url:"placed_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when the fulfillment was marked in progress. The timestamp must be in RFC 3339 format - // (for example, "2016-09-04T23:59:33.123Z"). - AcceptedAt *string `json:"accepted_at,omitempty" url:"accepted_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when the fulfillment was rejected. The timestamp must be in RFC 3339 format - // (for example, "2016-09-04T23:59:33.123Z"). - RejectedAt *string `json:"rejected_at,omitempty" url:"rejected_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when the fulfillment is marked as ready for pickup. The timestamp must be in RFC 3339 format - // (for example, "2016-09-04T23:59:33.123Z"). - ReadyAt *string `json:"ready_at,omitempty" url:"ready_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when the fulfillment expired. The timestamp must be in RFC 3339 format - // (for example, "2016-09-04T23:59:33.123Z"). - ExpiredAt *string `json:"expired_at,omitempty" url:"expired_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when the fulfillment was picked up by the recipient. The timestamp must be in RFC 3339 format - // (for example, "2016-09-04T23:59:33.123Z"). - PickedUpAt *string `json:"picked_up_at,omitempty" url:"picked_up_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when the fulfillment was canceled. The timestamp must be in RFC 3339 format - // (for example, "2016-09-04T23:59:33.123Z"). - CanceledAt *string `json:"canceled_at,omitempty" url:"canceled_at,omitempty"` - // A description of why the pickup was canceled. The maximum length: 100 characters. - CancelReason *string `json:"cancel_reason,omitempty" url:"cancel_reason,omitempty"` - // If set to `true`, indicates that this pickup order is for curbside pickup, not in-store pickup. - IsCurbsidePickup *bool `json:"is_curbside_pickup,omitempty" url:"is_curbside_pickup,omitempty"` - // Specific details for curbside pickup. These details can only be populated if `is_curbside_pickup` is set to `true`. - CurbsidePickupDetails *OrderFulfillmentPickupDetailsCurbsidePickupDetails `json:"curbside_pickup_details,omitempty" url:"curbside_pickup_details,omitempty"` +// Published when a [Payment](entity:Payment) is updated. +// Typically the `payment.status`, or `card_details.status` fields are updated +// as a payment is canceled, authorized, or completed. +type PaymentUpdatedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents, `"payment.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *PaymentUpdatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderFulfillmentPickupDetails) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (p *PaymentUpdatedEvent) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (o *OrderFulfillmentPickupDetails) UnmarshalJSON(data []byte) error { - type unmarshaler OrderFulfillmentPickupDetails +func (p *PaymentUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler PaymentUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderFulfillmentPickupDetails(value) + *p = PaymentUpdatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - o.extraProperties = extraProperties + p.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (o *OrderFulfillmentPickupDetails) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (p *PaymentUpdatedEvent) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", p) } -// Specific details for curbside pickup. -type OrderFulfillmentPickupDetailsCurbsidePickupDetails struct { - // Specific details for curbside pickup, such as parking number and vehicle model. - CurbsideDetails *string `json:"curbside_details,omitempty" url:"curbside_details,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when the buyer arrived and is waiting for pickup. The timestamp must be in RFC 3339 format - // (for example, "2016-09-04T23:59:33.123Z"). - BuyerArrivedAt *string `json:"buyer_arrived_at,omitempty" url:"buyer_arrived_at,omitempty"` +type PaymentUpdatedEventData struct { + // Name of the affected object’s type, `"payment"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the affected payment. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the updated payment. + Object *PaymentUpdatedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderFulfillmentPickupDetailsCurbsidePickupDetails) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (p *PaymentUpdatedEventData) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (o *OrderFulfillmentPickupDetailsCurbsidePickupDetails) UnmarshalJSON(data []byte) error { - type unmarshaler OrderFulfillmentPickupDetailsCurbsidePickupDetails +func (p *PaymentUpdatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler PaymentUpdatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderFulfillmentPickupDetailsCurbsidePickupDetails(value) + *p = PaymentUpdatedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - o.extraProperties = extraProperties + p.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (o *OrderFulfillmentPickupDetailsCurbsidePickupDetails) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (p *PaymentUpdatedEventData) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", p) } -// The schedule type of the pickup fulfillment. -type OrderFulfillmentPickupDetailsScheduleType string +type PaymentUpdatedEventObject struct { + // The updated payment. + Payment *Payment `json:"payment,omitempty" url:"payment,omitempty"` -const ( - OrderFulfillmentPickupDetailsScheduleTypeScheduled OrderFulfillmentPickupDetailsScheduleType = "SCHEDULED" - OrderFulfillmentPickupDetailsScheduleTypeAsap OrderFulfillmentPickupDetailsScheduleType = "ASAP" -) + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} -func NewOrderFulfillmentPickupDetailsScheduleTypeFromString(s string) (OrderFulfillmentPickupDetailsScheduleType, error) { - switch s { - case "SCHEDULED": - return OrderFulfillmentPickupDetailsScheduleTypeScheduled, nil - case "ASAP": - return OrderFulfillmentPickupDetailsScheduleTypeAsap, nil +func (p *PaymentUpdatedEventObject) GetExtraProperties() map[string]interface{} { + return p.extraProperties +} + +func (p *PaymentUpdatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler PaymentUpdatedEventObject + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - var t OrderFulfillmentPickupDetailsScheduleType - return "", fmt.Errorf("%s is not a valid %T", s, t) + *p = PaymentUpdatedEventObject(value) + + extraProperties, err := core.ExtractExtraProperties(data, *p) + if err != nil { + return err + } + p.extraProperties = extraProperties + + p._rawJSON = json.RawMessage(data) + return nil } -func (o OrderFulfillmentPickupDetailsScheduleType) Ptr() *OrderFulfillmentPickupDetailsScheduleType { - return &o +func (p *PaymentUpdatedEventObject) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(p); err == nil { + return value + } + return fmt.Sprintf("%#v", p) } -// Information about the fulfillment recipient. -type OrderFulfillmentRecipient struct { - // The ID of the customer associated with the fulfillment. - // If `customer_id` is provided, the fulfillment recipient's `display_name`, - // `email_address`, and `phone_number` are automatically populated from the - // targeted customer profile. If these fields are set in the request, the request - // values override the information from the customer profile. If the - // targeted customer profile does not contain the necessary information and - // these fields are left unset, the request results in an error. - CustomerID *string `json:"customer_id,omitempty" url:"customer_id,omitempty"` - // The display name of the fulfillment recipient. This field is required. - // If provided, the display name overrides the corresponding customer profile value - // indicated by `customer_id`. - DisplayName *string `json:"display_name,omitempty" url:"display_name,omitempty"` - // The email address of the fulfillment recipient. - // If provided, the email address overrides the corresponding customer profile value - // indicated by `customer_id`. - EmailAddress *string `json:"email_address,omitempty" url:"email_address,omitempty"` - // The phone number of the fulfillment recipient. This field is required. - // If provided, the phone number overrides the corresponding customer profile value - // indicated by `customer_id`. - PhoneNumber *string `json:"phone_number,omitempty" url:"phone_number,omitempty"` - // The address of the fulfillment recipient. This field is required. - // If provided, the address overrides the corresponding customer profile value - // indicated by `customer_id`. - Address *Address `json:"address,omitempty" url:"address,omitempty"` +// An accounting of the amount owed the seller and record of the actual transfer to their +// external bank account or to the Square balance. +type Payout struct { + // A unique ID for the payout. + ID string `json:"id" url:"id"` + // Indicates the payout status. + // See [PayoutStatus](#type-payoutstatus) for possible values + Status *PayoutStatus `json:"status,omitempty" url:"status,omitempty"` + // The ID of the location associated with the payout. + LocationID string `json:"location_id" url:"location_id"` + // The timestamp of when the payout was created and submitted for deposit to the seller's banking destination, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The timestamp of when the payout was last updated, in RFC 3339 format. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // The amount of money involved in the payout. A positive amount indicates a deposit, and a negative amount indicates a withdrawal. This amount is never zero. + AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` + // Information about the banking destination (such as a bank account, Square checking account, or debit card) + // against which the payout was made. + Destination *Destination `json:"destination,omitempty" url:"destination,omitempty"` + // The version number, which is incremented each time an update is made to this payout record. + // The version number helps developers receive event notifications or feeds out of order. + Version *int `json:"version,omitempty" url:"version,omitempty"` + // Indicates the payout type. + // See [PayoutType](#type-payouttype) for possible values + Type *PayoutType `json:"type,omitempty" url:"type,omitempty"` + // A list of transfer fees and any taxes on the fees assessed by Square for this payout. + PayoutFee []*PayoutFee `json:"payout_fee,omitempty" url:"payout_fee,omitempty"` + // The calendar date, in ISO 8601 format (YYYY-MM-DD), when the payout is due to arrive in the seller’s banking destination. + ArrivalDate *string `json:"arrival_date,omitempty" url:"arrival_date,omitempty"` + // A unique ID for each `Payout` object that might also appear on the seller’s bank statement. You can use this ID to automate the process of reconciling each payout with the corresponding line item on the bank statement. + EndToEndID *string `json:"end_to_end_id,omitempty" url:"end_to_end_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderFulfillmentRecipient) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (p *Payout) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (o *OrderFulfillmentRecipient) UnmarshalJSON(data []byte) error { - type unmarshaler OrderFulfillmentRecipient +func (p *Payout) UnmarshalJSON(data []byte) error { + type unmarshaler Payout var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderFulfillmentRecipient(value) + *p = Payout(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - o.extraProperties = extraProperties + p.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (o *OrderFulfillmentRecipient) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (p *Payout) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", p) } -// Contains the details necessary to fulfill a shipment order. -type OrderFulfillmentShipmentDetails struct { - // Information about the person to receive this shipment fulfillment. - Recipient *OrderFulfillmentRecipient `json:"recipient,omitempty" url:"recipient,omitempty"` - // The shipping carrier being used to ship this fulfillment (such as UPS, FedEx, or USPS). - Carrier *string `json:"carrier,omitempty" url:"carrier,omitempty"` - // A note with additional information for the shipping carrier. - ShippingNote *string `json:"shipping_note,omitempty" url:"shipping_note,omitempty"` - // A description of the type of shipping product purchased from the carrier - // (such as First Class, Priority, or Express). - ShippingType *string `json:"shipping_type,omitempty" url:"shipping_type,omitempty"` - // The reference number provided by the carrier to track the shipment's progress. - TrackingNumber *string `json:"tracking_number,omitempty" url:"tracking_number,omitempty"` - // A link to the tracking webpage on the carrier's website. - TrackingURL *string `json:"tracking_url,omitempty" url:"tracking_url,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when the shipment was requested. The timestamp must be in RFC 3339 format - // (for example, "2016-09-04T23:59:33.123Z"). - PlacedAt *string `json:"placed_at,omitempty" url:"placed_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when this fulfillment was moved to the `RESERVED` state, which indicates that preparation - // of this shipment has begun. The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - InProgressAt *string `json:"in_progress_at,omitempty" url:"in_progress_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when this fulfillment was moved to the `PREPARED` state, which indicates that the - // fulfillment is packaged. The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - PackagedAt *string `json:"packaged_at,omitempty" url:"packaged_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when the shipment is expected to be delivered to the shipping carrier. - // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - ExpectedShippedAt *string `json:"expected_shipped_at,omitempty" url:"expected_shipped_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when this fulfillment was moved to the `COMPLETED` state, which indicates that - // the fulfillment has been given to the shipping carrier. The timestamp must be in RFC 3339 format - // (for example, "2016-09-04T23:59:33.123Z"). - ShippedAt *string `json:"shipped_at,omitempty" url:"shipped_at,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating the shipment was canceled. - // The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - CanceledAt *string `json:"canceled_at,omitempty" url:"canceled_at,omitempty"` - // A description of why the shipment was canceled. - CancelReason *string `json:"cancel_reason,omitempty" url:"cancel_reason,omitempty"` - // The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - // indicating when the shipment failed to be completed. The timestamp must be in RFC 3339 format - // (for example, "2016-09-04T23:59:33.123Z"). - FailedAt *string `json:"failed_at,omitempty" url:"failed_at,omitempty"` - // A description of why the shipment failed to be completed. - FailureReason *string `json:"failure_reason,omitempty" url:"failure_reason,omitempty"` +// One or more PayoutEntries that make up a Payout. Each one has a date, amount, and type of activity. +// The total amount of the payout will equal the sum of the payout entries for a batch payout +type PayoutEntry struct { + // A unique ID for the payout entry. + ID string `json:"id" url:"id"` + // The ID of the payout entries’ associated payout. + PayoutID string `json:"payout_id" url:"payout_id"` + // The timestamp of when the payout entry affected the balance, in RFC 3339 format. + EffectiveAt *string `json:"effective_at,omitempty" url:"effective_at,omitempty"` + // The type of activity associated with this payout entry. + // See [ActivityType](#type-activitytype) for possible values + Type *ActivityType `json:"type,omitempty" url:"type,omitempty"` + // The amount of money involved in this payout entry. + GrossAmountMoney *Money `json:"gross_amount_money,omitempty" url:"gross_amount_money,omitempty"` + // The amount of Square fees associated with this payout entry. + FeeAmountMoney *Money `json:"fee_amount_money,omitempty" url:"fee_amount_money,omitempty"` + // The net proceeds from this transaction after any fees. + NetAmountMoney *Money `json:"net_amount_money,omitempty" url:"net_amount_money,omitempty"` + // Details of any developer app fee revenue generated on a payment. + TypeAppFeeRevenueDetails *PaymentBalanceActivityAppFeeRevenueDetail `json:"type_app_fee_revenue_details,omitempty" url:"type_app_fee_revenue_details,omitempty"` + // Details of a refund for an app fee on a payment. + TypeAppFeeRefundDetails *PaymentBalanceActivityAppFeeRefundDetail `json:"type_app_fee_refund_details,omitempty" url:"type_app_fee_refund_details,omitempty"` + // Details of any automatic transfer from the payment processing balance to the Square Savings account. These are, generally, proportional to the merchant's sales. + TypeAutomaticSavingsDetails *PaymentBalanceActivityAutomaticSavingsDetail `json:"type_automatic_savings_details,omitempty" url:"type_automatic_savings_details,omitempty"` + // Details of any automatic transfer from the Square Savings account back to the processing balance. These are, generally, proportional to the merchant's refunds. + TypeAutomaticSavingsReversedDetails *PaymentBalanceActivityAutomaticSavingsReversedDetail `json:"type_automatic_savings_reversed_details,omitempty" url:"type_automatic_savings_reversed_details,omitempty"` + // Details of credit card payment captures. + TypeChargeDetails *PaymentBalanceActivityChargeDetail `json:"type_charge_details,omitempty" url:"type_charge_details,omitempty"` + // Details of any fees involved with deposits such as for instant deposits. + TypeDepositFeeDetails *PaymentBalanceActivityDepositFeeDetail `json:"type_deposit_fee_details,omitempty" url:"type_deposit_fee_details,omitempty"` + // Details of any balance change due to a dispute event. + TypeDisputeDetails *PaymentBalanceActivityDisputeDetail `json:"type_dispute_details,omitempty" url:"type_dispute_details,omitempty"` + // Details of adjustments due to the Square processing fee. + TypeFeeDetails *PaymentBalanceActivityFeeDetail `json:"type_fee_details,omitempty" url:"type_fee_details,omitempty"` + // Square offers Free Payments Processing for a variety of business scenarios including seller referral or when Square wants to apologize for a bug, customer service, repricing complication, and so on. This entry represents details of any credit to the merchant for the purposes of Free Processing. + TypeFreeProcessingDetails *PaymentBalanceActivityFreeProcessingDetail `json:"type_free_processing_details,omitempty" url:"type_free_processing_details,omitempty"` + // Details of any adjustment made by Square related to the holding or releasing of a payment. + TypeHoldAdjustmentDetails *PaymentBalanceActivityHoldAdjustmentDetail `json:"type_hold_adjustment_details,omitempty" url:"type_hold_adjustment_details,omitempty"` + // Details of any open disputes. + TypeOpenDisputeDetails *PaymentBalanceActivityOpenDisputeDetail `json:"type_open_dispute_details,omitempty" url:"type_open_dispute_details,omitempty"` + // Details of any other type that does not belong in the rest of the types. + TypeOtherDetails *PaymentBalanceActivityOtherDetail `json:"type_other_details,omitempty" url:"type_other_details,omitempty"` + // Details of any other type of adjustments that don't fall under existing types. + TypeOtherAdjustmentDetails *PaymentBalanceActivityOtherAdjustmentDetail `json:"type_other_adjustment_details,omitempty" url:"type_other_adjustment_details,omitempty"` + // Details of a refund for an existing card payment. + TypeRefundDetails *PaymentBalanceActivityRefundDetail `json:"type_refund_details,omitempty" url:"type_refund_details,omitempty"` + // Details of fees released for adjustments. + TypeReleaseAdjustmentDetails *PaymentBalanceActivityReleaseAdjustmentDetail `json:"type_release_adjustment_details,omitempty" url:"type_release_adjustment_details,omitempty"` + // Details of fees paid for funding risk reserve. + TypeReserveHoldDetails *PaymentBalanceActivityReserveHoldDetail `json:"type_reserve_hold_details,omitempty" url:"type_reserve_hold_details,omitempty"` + // Details of fees released from risk reserve. + TypeReserveReleaseDetails *PaymentBalanceActivityReserveReleaseDetail `json:"type_reserve_release_details,omitempty" url:"type_reserve_release_details,omitempty"` + // Details of capital merchant cash advance (MCA) assessments. These are, generally, proportional to the merchant's sales but may be issued for other reasons related to the MCA. + TypeSquareCapitalPaymentDetails *PaymentBalanceActivitySquareCapitalPaymentDetail `json:"type_square_capital_payment_details,omitempty" url:"type_square_capital_payment_details,omitempty"` + // Details of capital merchant cash advance (MCA) assessment refunds. These are, generally, proportional to the merchant's refunds but may be issued for other reasons related to the MCA. + TypeSquareCapitalReversedPaymentDetails *PaymentBalanceActivitySquareCapitalReversedPaymentDetail `json:"type_square_capital_reversed_payment_details,omitempty" url:"type_square_capital_reversed_payment_details,omitempty"` + // Details of tax paid on fee amounts. + TypeTaxOnFeeDetails *PaymentBalanceActivityTaxOnFeeDetail `json:"type_tax_on_fee_details,omitempty" url:"type_tax_on_fee_details,omitempty"` + // Details of fees collected by a 3rd party platform. + TypeThirdPartyFeeDetails *PaymentBalanceActivityThirdPartyFeeDetail `json:"type_third_party_fee_details,omitempty" url:"type_third_party_fee_details,omitempty"` + // Details of refunded fees from a 3rd party platform. + TypeThirdPartyFeeRefundDetails *PaymentBalanceActivityThirdPartyFeeRefundDetail `json:"type_third_party_fee_refund_details,omitempty" url:"type_third_party_fee_refund_details,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderFulfillmentShipmentDetails) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (p *PayoutEntry) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (o *OrderFulfillmentShipmentDetails) UnmarshalJSON(data []byte) error { - type unmarshaler OrderFulfillmentShipmentDetails +func (p *PayoutEntry) UnmarshalJSON(data []byte) error { + type unmarshaler PayoutEntry var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderFulfillmentShipmentDetails(value) + *p = PayoutEntry(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - o.extraProperties = extraProperties + p.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (o *OrderFulfillmentShipmentDetails) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (p *PayoutEntry) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", p) } -// The current state of this fulfillment. -type OrderFulfillmentState string +// Published when a [Payout](entity:Payout) has failed. +type PayoutFailedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The ID of the target location associated with the event. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The type of event that this represents, `payout.failed`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The timestamp of when the event was verified, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *PayoutFailedEventData `json:"data,omitempty" url:"data,omitempty"` -const ( - OrderFulfillmentStateProposed OrderFulfillmentState = "PROPOSED" - OrderFulfillmentStateReserved OrderFulfillmentState = "RESERVED" - OrderFulfillmentStatePrepared OrderFulfillmentState = "PREPARED" - OrderFulfillmentStateCompleted OrderFulfillmentState = "COMPLETED" - OrderFulfillmentStateCanceled OrderFulfillmentState = "CANCELED" - OrderFulfillmentStateFailed OrderFulfillmentState = "FAILED" -) + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} -func NewOrderFulfillmentStateFromString(s string) (OrderFulfillmentState, error) { - switch s { - case "PROPOSED": - return OrderFulfillmentStateProposed, nil - case "RESERVED": - return OrderFulfillmentStateReserved, nil - case "PREPARED": - return OrderFulfillmentStatePrepared, nil - case "COMPLETED": - return OrderFulfillmentStateCompleted, nil - case "CANCELED": - return OrderFulfillmentStateCanceled, nil - case "FAILED": - return OrderFulfillmentStateFailed, nil +func (p *PayoutFailedEvent) GetExtraProperties() map[string]interface{} { + return p.extraProperties +} + +func (p *PayoutFailedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler PayoutFailedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - var t OrderFulfillmentState - return "", fmt.Errorf("%s is not a valid %T", s, t) + *p = PayoutFailedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *p) + if err != nil { + return err + } + p.extraProperties = extraProperties + + p._rawJSON = json.RawMessage(data) + return nil } -func (o OrderFulfillmentState) Ptr() *OrderFulfillmentState { - return &o +func (p *PayoutFailedEvent) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(p); err == nil { + return value + } + return fmt.Sprintf("%#v", p) } -// The type of fulfillment. -type OrderFulfillmentType string +type PayoutFailedEventData struct { + // The name of the affected object's type, `payout`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The ID of the failed payout. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the failed payout. + Object *PayoutFailedEventObject `json:"object,omitempty" url:"object,omitempty"` -const ( - OrderFulfillmentTypePickup OrderFulfillmentType = "PICKUP" - OrderFulfillmentTypeShipment OrderFulfillmentType = "SHIPMENT" - OrderFulfillmentTypeDelivery OrderFulfillmentType = "DELIVERY" -) + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} -func NewOrderFulfillmentTypeFromString(s string) (OrderFulfillmentType, error) { - switch s { - case "PICKUP": - return OrderFulfillmentTypePickup, nil - case "SHIPMENT": - return OrderFulfillmentTypeShipment, nil - case "DELIVERY": - return OrderFulfillmentTypeDelivery, nil +func (p *PayoutFailedEventData) GetExtraProperties() map[string]interface{} { + return p.extraProperties +} + +func (p *PayoutFailedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler PayoutFailedEventData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - var t OrderFulfillmentType - return "", fmt.Errorf("%s is not a valid %T", s, t) + *p = PayoutFailedEventData(value) + + extraProperties, err := core.ExtractExtraProperties(data, *p) + if err != nil { + return err + } + p.extraProperties = extraProperties + + p._rawJSON = json.RawMessage(data) + return nil } -func (o OrderFulfillmentType) Ptr() *OrderFulfillmentType { - return &o +func (p *PayoutFailedEventData) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(p); err == nil { + return value + } + return fmt.Sprintf("%#v", p) } -type OrderFulfillmentUpdated struct { - // The order's unique ID. - OrderID *string `json:"order_id,omitempty" url:"order_id,omitempty"` - // The version number, which is incremented each time an update is committed to the order. - // Orders that were not created through the API do not include a version number and - // therefore cannot be updated. - // - // [Read more about working with versions.](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders) - Version *int `json:"version,omitempty" url:"version,omitempty"` - // The ID of the seller location that this order is associated with. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` - // The state of the order. - // See [OrderState](#type-orderstate) for possible values - State *OrderState `json:"state,omitempty" url:"state,omitempty"` - // The timestamp for when the order was created, in RFC 3339 format. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The timestamp for when the order was last updated, in RFC 3339 format. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` - // The fulfillments that were updated with this version change. - FulfillmentUpdate []*OrderFulfillmentUpdatedUpdate `json:"fulfillment_update,omitempty" url:"fulfillment_update,omitempty"` +type PayoutFailedEventObject struct { + // The payout that failed. + Payout *Payout `json:"payout,omitempty" url:"payout,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderFulfillmentUpdated) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (p *PayoutFailedEventObject) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (o *OrderFulfillmentUpdated) UnmarshalJSON(data []byte) error { - type unmarshaler OrderFulfillmentUpdated +func (p *PayoutFailedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler PayoutFailedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderFulfillmentUpdated(value) + *p = PayoutFailedEventObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - o.extraProperties = extraProperties + p.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (o *OrderFulfillmentUpdated) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (p *PayoutFailedEventObject) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", p) } -type OrderFulfillmentUpdatedObject struct { - // Information about the updated order fulfillment. - OrderFulfillmentUpdated *OrderFulfillmentUpdated `json:"order_fulfillment_updated,omitempty" url:"order_fulfillment_updated,omitempty"` +// Represents a payout fee that can incur as part of a payout. +type PayoutFee struct { + // The money amount of the payout fee. + AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` + // The timestamp of when the fee takes effect, in RFC 3339 format. + EffectiveAt *string `json:"effective_at,omitempty" url:"effective_at,omitempty"` + // The type of fee assessed as part of the payout. + // See [PayoutFeeType](#type-payoutfeetype) for possible values + Type *PayoutFeeType `json:"type,omitempty" url:"type,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderFulfillmentUpdatedObject) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (p *PayoutFee) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (o *OrderFulfillmentUpdatedObject) UnmarshalJSON(data []byte) error { - type unmarshaler OrderFulfillmentUpdatedObject +func (p *PayoutFee) UnmarshalJSON(data []byte) error { + type unmarshaler PayoutFee var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderFulfillmentUpdatedObject(value) + *p = PayoutFee(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - o.extraProperties = extraProperties + p.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (o *OrderFulfillmentUpdatedObject) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(o); err == nil { - return value - } - return fmt.Sprintf("%#v", o) +func (p *PayoutFee) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(p); err == nil { + return value + } + return fmt.Sprintf("%#v", p) +} + +// Represents the type of payout fee that can incur as part of a payout. +type PayoutFeeType string + +const ( + PayoutFeeTypeUnknownPayoutFeeTypeDoNotUse PayoutFeeType = "UNKNOWN_PAYOUT_FEE_TYPE_DO_NOT_USE" + PayoutFeeTypeTransferFee PayoutFeeType = "TRANSFER_FEE" + PayoutFeeTypeTaxOnTransferFee PayoutFeeType = "TAX_ON_TRANSFER_FEE" +) + +func NewPayoutFeeTypeFromString(s string) (PayoutFeeType, error) { + switch s { + case "UNKNOWN_PAYOUT_FEE_TYPE_DO_NOT_USE": + return PayoutFeeTypeUnknownPayoutFeeTypeDoNotUse, nil + case "TRANSFER_FEE": + return PayoutFeeTypeTransferFee, nil + case "TAX_ON_TRANSFER_FEE": + return PayoutFeeTypeTaxOnTransferFee, nil + } + var t PayoutFeeType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (p PayoutFeeType) Ptr() *PayoutFeeType { + return &p } -// Information about fulfillment updates. -type OrderFulfillmentUpdatedUpdate struct { - // A unique ID that identifies the fulfillment only within this order. - FulfillmentUID *string `json:"fulfillment_uid,omitempty" url:"fulfillment_uid,omitempty"` - // The state of the fulfillment before the change. - // The state is not populated if the fulfillment is created with this new `Order` version. - OldState *FulfillmentState `json:"old_state,omitempty" url:"old_state,omitempty"` - // The state of the fulfillment after the change. The state might be equal to `old_state` if a non-state - // field was changed on the fulfillment (such as the tracking number). - NewState *FulfillmentState `json:"new_state,omitempty" url:"new_state,omitempty"` +// Published when a [Payout](entity:Payout) is complete. +type PayoutPaidEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The ID of the target location associated with the event. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The type of event this represents, `"payout.paid"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was verified, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *PayoutPaidEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderFulfillmentUpdatedUpdate) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (p *PayoutPaidEvent) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (o *OrderFulfillmentUpdatedUpdate) UnmarshalJSON(data []byte) error { - type unmarshaler OrderFulfillmentUpdatedUpdate +func (p *PayoutPaidEvent) UnmarshalJSON(data []byte) error { + type unmarshaler PayoutPaidEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderFulfillmentUpdatedUpdate(value) + *p = PayoutPaidEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - o.extraProperties = extraProperties + p.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (o *OrderFulfillmentUpdatedUpdate) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (p *PayoutPaidEvent) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", p) } -// Represents a line item in an order. Each line item describes a different -// product to purchase, with its own quantity and price details. -type OrderLineItem struct { - // A unique ID that identifies the line item only within this order. - UID *string `json:"uid,omitempty" url:"uid,omitempty"` - // The name of the line item. - Name *string `json:"name,omitempty" url:"name,omitempty"` - // The count, or measurement, of a line item being purchased: - // - // If `quantity` is a whole number, and `quantity_unit` is not specified, then `quantity` denotes an item count. For example: `3` apples. - // - // If `quantity` is a whole or decimal number, and `quantity_unit` is also specified, then `quantity` denotes a measurement. For example: `2.25` pounds of broccoli. - // - // For more information, see [Specify item quantity and measurement unit](https://developer.squareup.com/docs/orders-api/create-orders#specify-item-quantity-and-measurement-unit). - // - // Line items with a quantity of `0` are automatically removed - // when paying for or otherwise completing the order. - Quantity string `json:"quantity" url:"quantity"` - // The measurement unit and decimal precision that this line item's quantity is measured in. - QuantityUnit *OrderQuantityUnit `json:"quantity_unit,omitempty" url:"quantity_unit,omitempty"` - // An optional note associated with the line item. - Note *string `json:"note,omitempty" url:"note,omitempty"` - // The [CatalogItemVariation](entity:CatalogItemVariation) ID applied to this line item. - CatalogObjectID *string `json:"catalog_object_id,omitempty" url:"catalog_object_id,omitempty"` - // The version of the catalog object that this line item references. - CatalogVersion *int64 `json:"catalog_version,omitempty" url:"catalog_version,omitempty"` - // The name of the variation applied to this line item. - VariationName *string `json:"variation_name,omitempty" url:"variation_name,omitempty"` - // The type of line item: an itemized sale, a non-itemized sale (custom amount), or the - // activation or reloading of a gift card. - // See [OrderLineItemItemType](#type-orderlineitemitemtype) for possible values - ItemType *OrderLineItemItemType `json:"item_type,omitempty" url:"item_type,omitempty"` - // Application-defined data attached to this line item. Metadata fields are intended - // to store descriptive references or associations with an entity in another system or store brief - // information about the object. Square does not process this field; it only stores and returns it - // in relevant API calls. Do not use metadata to store any sensitive information (such as personally - // identifiable information or card details). - // - // Keys written by applications must be 60 characters or less and must be in the character set - // `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed - // with a namespace, separated from the key with a ':' character. - // - // Values have a maximum length of 255 characters. - // - // An application can have up to 10 entries per metadata field. - // - // Entries written by applications are private and can only be read or modified by the same - // application. - // - // For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). - Metadata map[string]*string `json:"metadata,omitempty" url:"metadata,omitempty"` - // The [CatalogModifier](entity:CatalogModifier)s applied to this line item. - Modifiers []*OrderLineItemModifier `json:"modifiers,omitempty" url:"modifiers,omitempty"` - // The list of references to taxes applied to this line item. Each - // `OrderLineItemAppliedTax` has a `tax_uid` that references the `uid` of a - // top-level `OrderLineItemTax` applied to the line item. On reads, the - // amount applied is populated. - // - // An `OrderLineItemAppliedTax` is automatically created on every line - // item for all `ORDER` scoped taxes added to the order. `OrderLineItemAppliedTax` - // records for `LINE_ITEM` scoped taxes must be added in requests for the tax - // to apply to any line items. - // - // To change the amount of a tax, modify the referenced top-level tax. - AppliedTaxes []*OrderLineItemAppliedTax `json:"applied_taxes,omitempty" url:"applied_taxes,omitempty"` - // The list of references to discounts applied to this line item. Each - // `OrderLineItemAppliedDiscount` has a `discount_uid` that references the `uid` of a top-level - // `OrderLineItemDiscounts` applied to the line item. On reads, the amount - // applied is populated. - // - // An `OrderLineItemAppliedDiscount` is automatically created on every line item for all - // `ORDER` scoped discounts that are added to the order. `OrderLineItemAppliedDiscount` records - // for `LINE_ITEM` scoped discounts must be added in requests for the discount to apply to any - // line items. - // - // To change the amount of a discount, modify the referenced top-level discount. - AppliedDiscounts []*OrderLineItemAppliedDiscount `json:"applied_discounts,omitempty" url:"applied_discounts,omitempty"` - // The list of references to service charges applied to this line item. Each - // `OrderLineItemAppliedServiceCharge` has a `service_charge_id` that references the `uid` of a - // top-level `OrderServiceCharge` applied to the line item. On reads, the amount applied is - // populated. - // - // To change the amount of a service charge, modify the referenced top-level service charge. - AppliedServiceCharges []*OrderLineItemAppliedServiceCharge `json:"applied_service_charges,omitempty" url:"applied_service_charges,omitempty"` - // The base price for a single unit of the line item. - BasePriceMoney *Money `json:"base_price_money,omitempty" url:"base_price_money,omitempty"` - // The total price of all item variations sold in this line item. - // The price is calculated as `base_price_money` multiplied by `quantity`. - // It does not include modifiers. - VariationTotalPriceMoney *Money `json:"variation_total_price_money,omitempty" url:"variation_total_price_money,omitempty"` - // The amount of money made in gross sales for this line item. - // The amount is calculated as the sum of the variation's total price and each modifier's total price. - // For inclusive tax items in the US, Canada, and Japan, tax is deducted from `gross_sales_money`. For Europe and - // Australia, inclusive tax remains as part of the gross sale calculation. - GrossSalesMoney *Money `json:"gross_sales_money,omitempty" url:"gross_sales_money,omitempty"` - // The total amount of tax money to collect for the line item. - TotalTaxMoney *Money `json:"total_tax_money,omitempty" url:"total_tax_money,omitempty"` - // The total amount of discount money to collect for the line item. - TotalDiscountMoney *Money `json:"total_discount_money,omitempty" url:"total_discount_money,omitempty"` - // The total amount of money to collect for this line item. - TotalMoney *Money `json:"total_money,omitempty" url:"total_money,omitempty"` - // Describes pricing adjustments that are blocked from automatic - // application to a line item. For more information, see - // [Apply Taxes and Discounts](https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts). - PricingBlocklists *OrderLineItemPricingBlocklists `json:"pricing_blocklists,omitempty" url:"pricing_blocklists,omitempty"` - // The total amount of apportioned service charge money to collect for the line item. - TotalServiceChargeMoney *Money `json:"total_service_charge_money,omitempty" url:"total_service_charge_money,omitempty"` +type PayoutPaidEventData struct { + // Name of the affected object’s type, `"payout"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the completed payout. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the completed payout. + Object *PayoutPaidEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderLineItem) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (p *PayoutPaidEventData) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (o *OrderLineItem) UnmarshalJSON(data []byte) error { - type unmarshaler OrderLineItem +func (p *PayoutPaidEventData) UnmarshalJSON(data []byte) error { + type unmarshaler PayoutPaidEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderLineItem(value) + *p = PayoutPaidEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - o.extraProperties = extraProperties + p.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (o *OrderLineItem) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (p *PayoutPaidEventData) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", p) } -// Represents an applied portion of a discount to a line item in an order. -// -// Order scoped discounts have automatically applied discounts present for each line item. -// Line-item scoped discounts must have applied discounts added manually for any applicable line -// items. The corresponding applied money is automatically computed based on participating -// line items. -type OrderLineItemAppliedDiscount struct { - // A unique ID that identifies the applied discount only within this order. - UID *string `json:"uid,omitempty" url:"uid,omitempty"` - // The `uid` of the discount that the applied discount represents. It must - // reference a discount present in the `order.discounts` field. - // - // This field is immutable. To change which discounts apply to a line item, - // you must delete the discount and re-add it as a new `OrderLineItemAppliedDiscount`. - DiscountUID string `json:"discount_uid" url:"discount_uid"` - // The amount of money applied by the discount to the line item. - AppliedMoney *Money `json:"applied_money,omitempty" url:"applied_money,omitempty"` +type PayoutPaidEventObject struct { + // The payout that has completed. + Payout *Payout `json:"payout,omitempty" url:"payout,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderLineItemAppliedDiscount) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (p *PayoutPaidEventObject) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (o *OrderLineItemAppliedDiscount) UnmarshalJSON(data []byte) error { - type unmarshaler OrderLineItemAppliedDiscount +func (p *PayoutPaidEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler PayoutPaidEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderLineItemAppliedDiscount(value) + *p = PayoutPaidEventObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - o.extraProperties = extraProperties + p.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (o *OrderLineItemAppliedDiscount) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (p *PayoutPaidEventObject) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", p) } -type OrderLineItemAppliedServiceCharge struct { - // A unique ID that identifies the applied service charge only within this order. - UID *string `json:"uid,omitempty" url:"uid,omitempty"` - // The `uid` of the service charge that the applied service charge represents. It must - // reference a service charge present in the `order.service_charges` field. - // - // This field is immutable. To change which service charges apply to a line item, - // delete and add a new `OrderLineItemAppliedServiceCharge`. - ServiceChargeUID string `json:"service_charge_uid" url:"service_charge_uid"` - // The amount of money applied by the service charge to the line item. - AppliedMoney *Money `json:"applied_money,omitempty" url:"applied_money,omitempty"` +// Published when a [Payout](entity:Payout) is sent. +type PayoutSentEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The ID of the target location associated with the event. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The type of event this represents, `"payout.sent"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was verified, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *PayoutSentEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderLineItemAppliedServiceCharge) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (p *PayoutSentEvent) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (o *OrderLineItemAppliedServiceCharge) UnmarshalJSON(data []byte) error { - type unmarshaler OrderLineItemAppliedServiceCharge +func (p *PayoutSentEvent) UnmarshalJSON(data []byte) error { + type unmarshaler PayoutSentEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderLineItemAppliedServiceCharge(value) + *p = PayoutSentEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - o.extraProperties = extraProperties + p.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (o *OrderLineItemAppliedServiceCharge) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (p *PayoutSentEvent) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", p) } -// Represents an applied portion of a tax to a line item in an order. -// -// Order-scoped taxes automatically include the applied taxes in each line item. -// Line item taxes must be referenced from any applicable line items. -// The corresponding applied money is automatically computed, based on the -// set of participating line items. -type OrderLineItemAppliedTax struct { - // A unique ID that identifies the applied tax only within this order. - UID *string `json:"uid,omitempty" url:"uid,omitempty"` - // The `uid` of the tax for which this applied tax represents. It must reference - // a tax present in the `order.taxes` field. - // - // This field is immutable. To change which taxes apply to a line item, delete and add a new - // `OrderLineItemAppliedTax`. - TaxUID string `json:"tax_uid" url:"tax_uid"` - // The amount of money applied by the tax to the line item. - AppliedMoney *Money `json:"applied_money,omitempty" url:"applied_money,omitempty"` +type PayoutSentEventData struct { + // Name of the affected object’s type, `"payout"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the sent payout. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the sent payout. + Object *PayoutSentEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderLineItemAppliedTax) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (p *PayoutSentEventData) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (o *OrderLineItemAppliedTax) UnmarshalJSON(data []byte) error { - type unmarshaler OrderLineItemAppliedTax +func (p *PayoutSentEventData) UnmarshalJSON(data []byte) error { + type unmarshaler PayoutSentEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderLineItemAppliedTax(value) + *p = PayoutSentEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - o.extraProperties = extraProperties + p.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (o *OrderLineItemAppliedTax) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (p *PayoutSentEventData) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", p) } -// Represents a discount that applies to one or more line items in an -// order. -// -// Fixed-amount, order-scoped discounts are distributed across all non-zero line item totals. -// The amount distributed to each line item is relative to the -// amount contributed by the item to the order subtotal. -type OrderLineItemDiscount struct { - // A unique ID that identifies the discount only within this order. - UID *string `json:"uid,omitempty" url:"uid,omitempty"` - // The catalog object ID referencing [CatalogDiscount](entity:CatalogDiscount). - CatalogObjectID *string `json:"catalog_object_id,omitempty" url:"catalog_object_id,omitempty"` - // The version of the catalog object that this discount references. - CatalogVersion *int64 `json:"catalog_version,omitempty" url:"catalog_version,omitempty"` - // The discount's name. - Name *string `json:"name,omitempty" url:"name,omitempty"` - // The type of the discount. - // - // Discounts that do not reference a catalog object ID must have a type of - // `FIXED_PERCENTAGE` or `FIXED_AMOUNT`. - // See [OrderLineItemDiscountType](#type-orderlineitemdiscounttype) for possible values - Type *OrderLineItemDiscountType `json:"type,omitempty" url:"type,omitempty"` - // The percentage of the discount, as a string representation of a decimal number. - // A value of `7.25` corresponds to a percentage of 7.25%. - // - // `percentage` is not set for amount-based discounts. - Percentage *string `json:"percentage,omitempty" url:"percentage,omitempty"` - // The total declared monetary amount of the discount. - // - // `amount_money` is not set for percentage-based discounts. - AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` - // The amount of discount actually applied to the line item. - // - // The amount represents the amount of money applied as a line-item scoped discount. - // When an amount-based discount is scoped to the entire order, the value - // of `applied_money` is different than `amount_money` because the total - // amount of the discount is distributed across all line items. - AppliedMoney *Money `json:"applied_money,omitempty" url:"applied_money,omitempty"` - // Application-defined data attached to this discount. Metadata fields are intended - // to store descriptive references or associations with an entity in another system or store brief - // information about the object. Square does not process this field; it only stores and returns it - // in relevant API calls. Do not use metadata to store any sensitive information (such as personally - // identifiable information or card details). - // - // Keys written by applications must be 60 characters or less and must be in the character set - // `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed - // with a namespace, separated from the key with a ':' character. - // - // Values have a maximum length of 255 characters. - // - // An application can have up to 10 entries per metadata field. - // - // Entries written by applications are private and can only be read or modified by the same - // application. - // - // For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). - Metadata map[string]*string `json:"metadata,omitempty" url:"metadata,omitempty"` - // Indicates the level at which the discount applies. For `ORDER` scoped discounts, - // Square generates references in `applied_discounts` on all order line items that do - // not have them. For `LINE_ITEM` scoped discounts, the discount only applies to line items - // with a discount reference in their `applied_discounts` field. - // - // This field is immutable. To change the scope of a discount, you must delete - // the discount and re-add it as a new discount. - // See [OrderLineItemDiscountScope](#type-orderlineitemdiscountscope) for possible values - Scope *OrderLineItemDiscountScope `json:"scope,omitempty" url:"scope,omitempty"` - // The reward IDs corresponding to this discount. The application and - // specification of discounts that have `reward_ids` are completely controlled by the backing - // criteria corresponding to the reward tiers of the rewards that are added to the order - // through the Loyalty API. To manually unapply discounts that are the result of added rewards, - // the rewards must be removed from the order through the Loyalty API. - RewardIDs []string `json:"reward_ids,omitempty" url:"reward_ids,omitempty"` - // The object ID of a [pricing rule](entity:CatalogPricingRule) to be applied - // automatically to this discount. The specification and application of the discounts, to - // which a `pricing_rule_id` is assigned, are completely controlled by the corresponding - // pricing rule. - PricingRuleID *string `json:"pricing_rule_id,omitempty" url:"pricing_rule_id,omitempty"` +type PayoutSentEventObject struct { + // The payout that was sent. + Payout *Payout `json:"payout,omitempty" url:"payout,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderLineItemDiscount) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (p *PayoutSentEventObject) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (o *OrderLineItemDiscount) UnmarshalJSON(data []byte) error { - type unmarshaler OrderLineItemDiscount +func (p *PayoutSentEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler PayoutSentEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderLineItemDiscount(value) + *p = PayoutSentEventObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - o.extraProperties = extraProperties + p.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (o *OrderLineItemDiscount) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (p *PayoutSentEventObject) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", p) } -// Indicates whether this is a line-item or order-level discount. -type OrderLineItemDiscountScope string +// Payout status types +type PayoutStatus string const ( - OrderLineItemDiscountScopeOtherDiscountScope OrderLineItemDiscountScope = "OTHER_DISCOUNT_SCOPE" - OrderLineItemDiscountScopeLineItem OrderLineItemDiscountScope = "LINE_ITEM" - OrderLineItemDiscountScopeOrder OrderLineItemDiscountScope = "ORDER" + PayoutStatusUnknownPayoutStatusDoNotUse PayoutStatus = "UNKNOWN_PAYOUT_STATUS_DO_NOT_USE" + PayoutStatusSent PayoutStatus = "SENT" + PayoutStatusFailed PayoutStatus = "FAILED" + PayoutStatusPaid PayoutStatus = "PAID" + PayoutStatusPending PayoutStatus = "PENDING" ) -func NewOrderLineItemDiscountScopeFromString(s string) (OrderLineItemDiscountScope, error) { +func NewPayoutStatusFromString(s string) (PayoutStatus, error) { switch s { - case "OTHER_DISCOUNT_SCOPE": - return OrderLineItemDiscountScopeOtherDiscountScope, nil - case "LINE_ITEM": - return OrderLineItemDiscountScopeLineItem, nil - case "ORDER": - return OrderLineItemDiscountScopeOrder, nil + case "UNKNOWN_PAYOUT_STATUS_DO_NOT_USE": + return PayoutStatusUnknownPayoutStatusDoNotUse, nil + case "SENT": + return PayoutStatusSent, nil + case "FAILED": + return PayoutStatusFailed, nil + case "PAID": + return PayoutStatusPaid, nil + case "PENDING": + return PayoutStatusPending, nil } - var t OrderLineItemDiscountScope + var t PayoutStatus return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (o OrderLineItemDiscountScope) Ptr() *OrderLineItemDiscountScope { - return &o +func (p PayoutStatus) Ptr() *PayoutStatus { + return &p } -// Indicates how the discount is applied to the associated line item or order. -type OrderLineItemDiscountType string +// The type of payout: “BATCH” or “SIMPLE”. +// BATCH payouts include a list of payout entries that can be considered settled. +// SIMPLE payouts do not have any payout entries associated with them +// and will show up as one of the payout entries in a future BATCH payout. +type PayoutType string const ( - OrderLineItemDiscountTypeUnknownDiscount OrderLineItemDiscountType = "UNKNOWN_DISCOUNT" - OrderLineItemDiscountTypeFixedPercentage OrderLineItemDiscountType = "FIXED_PERCENTAGE" - OrderLineItemDiscountTypeFixedAmount OrderLineItemDiscountType = "FIXED_AMOUNT" - OrderLineItemDiscountTypeVariablePercentage OrderLineItemDiscountType = "VARIABLE_PERCENTAGE" - OrderLineItemDiscountTypeVariableAmount OrderLineItemDiscountType = "VARIABLE_AMOUNT" + PayoutTypeUnknownPayoutTypeDoNotUse PayoutType = "UNKNOWN_PAYOUT_TYPE_DO_NOT_USE" + PayoutTypeBatch PayoutType = "BATCH" + PayoutTypeSimple PayoutType = "SIMPLE" ) -func NewOrderLineItemDiscountTypeFromString(s string) (OrderLineItemDiscountType, error) { +func NewPayoutTypeFromString(s string) (PayoutType, error) { switch s { - case "UNKNOWN_DISCOUNT": - return OrderLineItemDiscountTypeUnknownDiscount, nil - case "FIXED_PERCENTAGE": - return OrderLineItemDiscountTypeFixedPercentage, nil - case "FIXED_AMOUNT": - return OrderLineItemDiscountTypeFixedAmount, nil - case "VARIABLE_PERCENTAGE": - return OrderLineItemDiscountTypeVariablePercentage, nil - case "VARIABLE_AMOUNT": - return OrderLineItemDiscountTypeVariableAmount, nil + case "UNKNOWN_PAYOUT_TYPE_DO_NOT_USE": + return PayoutTypeUnknownPayoutTypeDoNotUse, nil + case "BATCH": + return PayoutTypeBatch, nil + case "SIMPLE": + return PayoutTypeSimple, nil } - var t OrderLineItemDiscountType + var t PayoutType return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (o OrderLineItemDiscountType) Ptr() *OrderLineItemDiscountType { - return &o +func (p PayoutType) Ptr() *PayoutType { + return &p +} + +// Represents a phase, which can override subscription phases as defined by plan_id +type Phase struct { + // id of subscription phase + UID *string `json:"uid,omitempty" url:"uid,omitempty"` + // index of phase in total subscription plan + Ordinal *int64 `json:"ordinal,omitempty" url:"ordinal,omitempty"` + // id of order to be used in billing + OrderTemplateID *string `json:"order_template_id,omitempty" url:"order_template_id,omitempty"` + // the uid from the plan's phase in catalog + PlanPhaseUID *string `json:"plan_phase_uid,omitempty" url:"plan_phase_uid,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (p *Phase) GetExtraProperties() map[string]interface{} { + return p.extraProperties +} + +func (p *Phase) UnmarshalJSON(data []byte) error { + type unmarshaler Phase + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *p = Phase(value) + + extraProperties, err := core.ExtractExtraProperties(data, *p) + if err != nil { + return err + } + p.extraProperties = extraProperties + + p._rawJSON = json.RawMessage(data) + return nil +} + +func (p *Phase) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(p); err == nil { + return value + } + return fmt.Sprintf("%#v", p) +} + +// Represents the arguments used to construct a new phase. +type PhaseInput struct { + // index of phase in total subscription plan + Ordinal int64 `json:"ordinal" url:"ordinal"` + // id of order to be used in billing + OrderTemplateID *string `json:"order_template_id,omitempty" url:"order_template_id,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage } -// Represents the line item type. -type OrderLineItemItemType string +func (p *PhaseInput) GetExtraProperties() map[string]interface{} { + return p.extraProperties +} -const ( - OrderLineItemItemTypeItem OrderLineItemItemType = "ITEM" - OrderLineItemItemTypeCustomAmount OrderLineItemItemType = "CUSTOM_AMOUNT" - OrderLineItemItemTypeGiftCard OrderLineItemItemType = "GIFT_CARD" -) +func (p *PhaseInput) UnmarshalJSON(data []byte) error { + type unmarshaler PhaseInput + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *p = PhaseInput(value) -func NewOrderLineItemItemTypeFromString(s string) (OrderLineItemItemType, error) { - switch s { - case "ITEM": - return OrderLineItemItemTypeItem, nil - case "CUSTOM_AMOUNT": - return OrderLineItemItemTypeCustomAmount, nil - case "GIFT_CARD": - return OrderLineItemItemTypeGiftCard, nil + extraProperties, err := core.ExtractExtraProperties(data, *p) + if err != nil { + return err } - var t OrderLineItemItemType - return "", fmt.Errorf("%s is not a valid %T", s, t) + p.extraProperties = extraProperties + + p._rawJSON = json.RawMessage(data) + return nil } -func (o OrderLineItemItemType) Ptr() *OrderLineItemItemType { - return &o +func (p *PhaseInput) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(p); err == nil { + return value + } + return fmt.Sprintf("%#v", p) } -// A [CatalogModifier]($m/CatalogModifier). -type OrderLineItemModifier struct { - // A unique ID that identifies the modifier only within this order. - UID *string `json:"uid,omitempty" url:"uid,omitempty"` - // The catalog object ID referencing [CatalogModifier](entity:CatalogModifier). - CatalogObjectID *string `json:"catalog_object_id,omitempty" url:"catalog_object_id,omitempty"` - // The version of the catalog object that this modifier references. - CatalogVersion *int64 `json:"catalog_version,omitempty" url:"catalog_version,omitempty"` - // The name of the item modifier. - Name *string `json:"name,omitempty" url:"name,omitempty"` - // The quantity of the line item modifier. The modifier quantity can be 0 or more. - // For example, suppose a restaurant offers a cheeseburger on the menu. When a buyer orders - // this item, the restaurant records the purchase by creating an `Order` object with a line item - // for a burger. The line item includes a line item modifier: the name is cheese and the quantity - // is 1. The buyer has the option to order extra cheese (or no cheese). If the buyer chooses - // the extra cheese option, the modifier quantity increases to 2. If the buyer does not want - // any cheese, the modifier quantity is set to 0. - Quantity *string `json:"quantity,omitempty" url:"quantity,omitempty"` - // The base price for the modifier. - // - // `base_price_money` is required for ad hoc modifiers. - // If both `catalog_object_id` and `base_price_money` are set, `base_price_money` will - // override the predefined [CatalogModifier](entity:CatalogModifier) price. - BasePriceMoney *Money `json:"base_price_money,omitempty" url:"base_price_money,omitempty"` - // The total price of the item modifier for its line item. - // This is the modifier's `base_price_money` multiplied by the line item's quantity. - TotalPriceMoney *Money `json:"total_price_money,omitempty" url:"total_price_money,omitempty"` - // Application-defined data attached to this order. Metadata fields are intended - // to store descriptive references or associations with an entity in another system or store brief - // information about the object. Square does not process this field; it only stores and returns it - // in relevant API calls. Do not use metadata to store any sensitive information (such as personally - // identifiable information or card details). - // - // Keys written by applications must be 60 characters or less and must be in the character set - // `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed - // with a namespace, separated from the key with a ':' character. - // - // Values have a maximum length of 255 characters. - // - // An application can have up to 10 entries per metadata field. - // - // Entries written by applications are private and can only be read or modified by the same - // application. - // - // For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). - Metadata map[string]*string `json:"metadata,omitempty" url:"metadata,omitempty"` +// Describes buyer data to prepopulate in the payment form. +// For more information, +// see [Optional Checkout Configurations](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations). +type PrePopulatedData struct { + // The buyer email to prepopulate in the payment form. + BuyerEmail *string `json:"buyer_email,omitempty" url:"buyer_email,omitempty"` + // The buyer phone number to prepopulate in the payment form. + BuyerPhoneNumber *string `json:"buyer_phone_number,omitempty" url:"buyer_phone_number,omitempty"` + // The buyer address to prepopulate in the payment form. + BuyerAddress *Address `json:"buyer_address,omitempty" url:"buyer_address,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderLineItemModifier) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (p *PrePopulatedData) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (o *OrderLineItemModifier) UnmarshalJSON(data []byte) error { - type unmarshaler OrderLineItemModifier +func (p *PrePopulatedData) UnmarshalJSON(data []byte) error { + type unmarshaler PrePopulatedData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderLineItemModifier(value) + *p = PrePopulatedData(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - o.extraProperties = extraProperties + p.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (o *OrderLineItemModifier) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (p *PrePopulatedData) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", p) } -// Describes pricing adjustments that are blocked from automatic -// application to a line item. For more information, see -// [Apply Taxes and Discounts](https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts). -type OrderLineItemPricingBlocklists struct { - // A list of discounts blocked from applying to the line item. - // Discounts can be blocked by the `discount_uid` (for ad hoc discounts) or - // the `discount_catalog_object_id` (for catalog discounts). - BlockedDiscounts []*OrderLineItemPricingBlocklistsBlockedDiscount `json:"blocked_discounts,omitempty" url:"blocked_discounts,omitempty"` - // A list of taxes blocked from applying to the line item. - // Taxes can be blocked by the `tax_uid` (for ad hoc taxes) or - // the `tax_catalog_object_id` (for catalog taxes). - BlockedTaxes []*OrderLineItemPricingBlocklistsBlockedTax `json:"blocked_taxes,omitempty" url:"blocked_taxes,omitempty"` +// Represents the Square processing fee. +type ProcessingFee struct { + // The timestamp of when the fee takes effect, in RFC 3339 format. + EffectiveAt *string `json:"effective_at,omitempty" url:"effective_at,omitempty"` + // The type of fee assessed or adjusted. The fee type can be `INITIAL` or `ADJUSTMENT`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The fee amount, which might be negative, that is assessed or adjusted by Square. + // + // Positive values represent funds being assessed, while negative values represent + // funds being returned. + AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderLineItemPricingBlocklists) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (p *ProcessingFee) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (o *OrderLineItemPricingBlocklists) UnmarshalJSON(data []byte) error { - type unmarshaler OrderLineItemPricingBlocklists +func (p *ProcessingFee) UnmarshalJSON(data []byte) error { + type unmarshaler ProcessingFee var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderLineItemPricingBlocklists(value) + *p = ProcessingFee(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - o.extraProperties = extraProperties + p.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (o *OrderLineItemPricingBlocklists) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (p *ProcessingFee) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", p) } -// A discount to block from applying to a line item. The discount must be -// identified by either `discount_uid` or `discount_catalog_object_id`, but not both. -type OrderLineItemPricingBlocklistsBlockedDiscount struct { - // A unique ID of the `BlockedDiscount` within the order. - UID *string `json:"uid,omitempty" url:"uid,omitempty"` - // The `uid` of the discount that should be blocked. Use this field to block - // ad hoc discounts. For catalog discounts, use the `discount_catalog_object_id` field. - DiscountUID *string `json:"discount_uid,omitempty" url:"discount_uid,omitempty"` - // The `catalog_object_id` of the discount that should be blocked. - // Use this field to block catalog discounts. For ad hoc discounts, use the - // `discount_uid` field. - DiscountCatalogObjectID *string `json:"discount_catalog_object_id,omitempty" url:"discount_catalog_object_id,omitempty"` +// Indicates the Square product used to generate a change. +type Product string + +const ( + ProductProductDoNotUse Product = "PRODUCT_DO_NOT_USE" + ProductSquarePos Product = "SQUARE_POS" + ProductExternalAPI Product = "EXTERNAL_API" + ProductBilling Product = "BILLING" + ProductAppointments Product = "APPOINTMENTS" + ProductInvoices Product = "INVOICES" + ProductOnlineStore Product = "ONLINE_STORE" + ProductPayroll Product = "PAYROLL" + ProductDashboard Product = "DASHBOARD" + ProductItemLibraryImport Product = "ITEM_LIBRARY_IMPORT" + ProductRetail Product = "RETAIL" + ProductRestaurant Product = "RESTAURANT" + ProductCustomersDirectory Product = "CUSTOMERS_DIRECTORY" + ProductChannels Product = "CHANNELS" + ProductOther Product = "OTHER" +) + +func NewProductFromString(s string) (Product, error) { + switch s { + case "PRODUCT_DO_NOT_USE": + return ProductProductDoNotUse, nil + case "SQUARE_POS": + return ProductSquarePos, nil + case "EXTERNAL_API": + return ProductExternalAPI, nil + case "BILLING": + return ProductBilling, nil + case "APPOINTMENTS": + return ProductAppointments, nil + case "INVOICES": + return ProductInvoices, nil + case "ONLINE_STORE": + return ProductOnlineStore, nil + case "PAYROLL": + return ProductPayroll, nil + case "DASHBOARD": + return ProductDashboard, nil + case "ITEM_LIBRARY_IMPORT": + return ProductItemLibraryImport, nil + case "RETAIL": + return ProductRetail, nil + case "RESTAURANT": + return ProductRestaurant, nil + case "CUSTOMERS_DIRECTORY": + return ProductCustomersDirectory, nil + case "CHANNELS": + return ProductChannels, nil + case "OTHER": + return ProductOther, nil + } + var t Product + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (p Product) Ptr() *Product { + return &p +} + +type ProductType string + +const ( + ProductTypeUnknown ProductType = "UNKNOWN" + ProductTypeRegister ProductType = "REGISTER" + ProductTypeRestaurant ProductType = "RESTAURANT" + ProductTypeRetail ProductType = "RETAIL" + ProductTypePaySdk ProductType = "PAY_SDK" + ProductTypeTerminalAPI ProductType = "TERMINAL_API" + ProductTypeKds ProductType = "KDS" + ProductTypeKdsExpo ProductType = "KDS_EXPO" + ProductTypeRestaurantMobile ProductType = "RESTAURANT_MOBILE" + ProductTypeFnbkiosk ProductType = "FNBKIOSK" +) + +func NewProductTypeFromString(s string) (ProductType, error) { + switch s { + case "UNKNOWN": + return ProductTypeUnknown, nil + case "REGISTER": + return ProductTypeRegister, nil + case "RESTAURANT": + return ProductTypeRestaurant, nil + case "RETAIL": + return ProductTypeRetail, nil + case "PAY_SDK": + return ProductTypePaySdk, nil + case "TERMINAL_API": + return ProductTypeTerminalAPI, nil + case "KDS": + return ProductTypeKds, nil + case "KDS_EXPO": + return ProductTypeKdsExpo, nil + case "RESTAURANT_MOBILE": + return ProductTypeRestaurantMobile, nil + case "FNBKIOSK": + return ProductTypeFnbkiosk, nil + } + var t ProductType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (p ProductType) Ptr() *ProductType { + return &p +} + +// Describes a `PublishInvoice` response. +type PublishInvoiceResponse struct { + // The published invoice. + Invoice *Invoice `json:"invoice,omitempty" url:"invoice,omitempty"` + // Information about errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderLineItemPricingBlocklistsBlockedDiscount) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (p *PublishInvoiceResponse) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (o *OrderLineItemPricingBlocklistsBlockedDiscount) UnmarshalJSON(data []byte) error { - type unmarshaler OrderLineItemPricingBlocklistsBlockedDiscount +func (p *PublishInvoiceResponse) UnmarshalJSON(data []byte) error { + type unmarshaler PublishInvoiceResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderLineItemPricingBlocklistsBlockedDiscount(value) + *p = PublishInvoiceResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *p) if err != nil { return err } - o.extraProperties = extraProperties + p.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + p._rawJSON = json.RawMessage(data) return nil } -func (o *OrderLineItemPricingBlocklistsBlockedDiscount) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (p *PublishInvoiceResponse) String() string { + if len(p._rawJSON) > 0 { + if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", p) } -// A tax to block from applying to a line item. The tax must be -// identified by either `tax_uid` or `tax_catalog_object_id`, but not both. -type OrderLineItemPricingBlocklistsBlockedTax struct { - // A unique ID of the `BlockedTax` within the order. - UID *string `json:"uid,omitempty" url:"uid,omitempty"` - // The `uid` of the tax that should be blocked. Use this field to block - // ad hoc taxes. For catalog, taxes use the `tax_catalog_object_id` field. - TaxUID *string `json:"tax_uid,omitempty" url:"tax_uid,omitempty"` - // The `catalog_object_id` of the tax that should be blocked. - // Use this field to block catalog taxes. For ad hoc taxes, use the - // `tax_uid` field. - TaxCatalogObjectID *string `json:"tax_catalog_object_id,omitempty" url:"tax_catalog_object_id,omitempty"` +// Fields to describe the action that displays QR-Codes. +type QrCodeOptions struct { + // The title text to display in the QR code flow on the Terminal. + Title string `json:"title" url:"title"` + // The body text to display in the QR code flow on the Terminal. + Body string `json:"body" url:"body"` + // The text representation of the data to show in the QR code + // as UTF8-encoded data. + BarcodeContents string `json:"barcode_contents" url:"barcode_contents"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderLineItemPricingBlocklistsBlockedTax) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (q *QrCodeOptions) GetExtraProperties() map[string]interface{} { + return q.extraProperties } -func (o *OrderLineItemPricingBlocklistsBlockedTax) UnmarshalJSON(data []byte) error { - type unmarshaler OrderLineItemPricingBlocklistsBlockedTax +func (q *QrCodeOptions) UnmarshalJSON(data []byte) error { + type unmarshaler QrCodeOptions var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderLineItemPricingBlocklistsBlockedTax(value) + *q = QrCodeOptions(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *q) if err != nil { return err } - o.extraProperties = extraProperties + q.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + q._rawJSON = json.RawMessage(data) return nil } -func (o *OrderLineItemPricingBlocklistsBlockedTax) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (q *QrCodeOptions) String() string { + if len(q._rawJSON) > 0 { + if value, err := core.StringifyJSON(q._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(q); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", q) } -// Represents a tax that applies to one or more line item in the order. -// -// Fixed-amount, order-scoped taxes are distributed across all non-zero line item totals. -// The amount distributed to each line item is relative to the amount the item -// contributes to the order subtotal. -type OrderLineItemTax struct { - // A unique ID that identifies the tax only within this order. - UID *string `json:"uid,omitempty" url:"uid,omitempty"` - // The catalog object ID referencing [CatalogTax](entity:CatalogTax). - CatalogObjectID *string `json:"catalog_object_id,omitempty" url:"catalog_object_id,omitempty"` - // The version of the catalog object that this tax references. - CatalogVersion *int64 `json:"catalog_version,omitempty" url:"catalog_version,omitempty"` - // The tax's name. - Name *string `json:"name,omitempty" url:"name,omitempty"` - // Indicates the calculation method used to apply the tax. - // See [OrderLineItemTaxType](#type-orderlineitemtaxtype) for possible values - Type *OrderLineItemTaxType `json:"type,omitempty" url:"type,omitempty"` - // The percentage of the tax, as a string representation of a decimal - // number. For example, a value of `"7.25"` corresponds to a percentage of - // 7.25%. - Percentage *string `json:"percentage,omitempty" url:"percentage,omitempty"` - // Application-defined data attached to this tax. Metadata fields are intended - // to store descriptive references or associations with an entity in another system or store brief - // information about the object. Square does not process this field; it only stores and returns it - // in relevant API calls. Do not use metadata to store any sensitive information (such as personally - // identifiable information or card details). - // - // Keys written by applications must be 60 characters or less and must be in the character set - // `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed - // with a namespace, separated from the key with a ':' character. - // - // Values have a maximum length of 255 characters. - // - // An application can have up to 10 entries per metadata field. - // - // Entries written by applications are private and can only be read or modified by the same - // application. - // - // For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). - Metadata map[string]*string `json:"metadata,omitempty" url:"metadata,omitempty"` - // The amount of money applied to the order by the tax. - // - // - For percentage-based taxes, `applied_money` is the money - // calculated using the percentage. - AppliedMoney *Money `json:"applied_money,omitempty" url:"applied_money,omitempty"` - // Indicates the level at which the tax applies. For `ORDER` scoped taxes, - // Square generates references in `applied_taxes` on all order line items that do - // not have them. For `LINE_ITEM` scoped taxes, the tax only applies to line items - // with references in their `applied_taxes` field. - // - // This field is immutable. To change the scope, you must delete the tax and - // re-add it as a new tax. - // See [OrderLineItemTaxScope](#type-orderlineitemtaxscope) for possible values - Scope *OrderLineItemTaxScope `json:"scope,omitempty" url:"scope,omitempty"` - // Determines whether the tax was automatically applied to the order based on - // the catalog configuration. For an example, see - // [Automatically Apply Taxes to an Order](https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts/auto-apply-taxes). - AutoApplied *bool `json:"auto_applied,omitempty" url:"auto_applied,omitempty"` +// A whole number or unreduced fractional ratio. +type QuantityRatio struct { + // The whole or fractional quantity as the numerator. + Quantity *int `json:"quantity,omitempty" url:"quantity,omitempty"` + // The whole or fractional quantity as the denominator. + // With fractional quantity this field is the denominator and quantity is the numerator. + // The default value is `1`. For example, when `quantity=3` and `quantity_denominator` is unspecified, + // the quantity ratio is `3` or `3/1`. + QuantityDenominator *int `json:"quantity_denominator,omitempty" url:"quantity_denominator,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderLineItemTax) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (q *QuantityRatio) GetExtraProperties() map[string]interface{} { + return q.extraProperties } -func (o *OrderLineItemTax) UnmarshalJSON(data []byte) error { - type unmarshaler OrderLineItemTax +func (q *QuantityRatio) UnmarshalJSON(data []byte) error { + type unmarshaler QuantityRatio var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderLineItemTax(value) + *q = QuantityRatio(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *q) if err != nil { return err } - o.extraProperties = extraProperties + q.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + q._rawJSON = json.RawMessage(data) return nil } -func (o *OrderLineItemTax) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (q *QuantityRatio) String() string { + if len(q._rawJSON) > 0 { + if value, err := core.StringifyJSON(q._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(q); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", q) } -// Indicates whether this is a line-item or order-level tax. -type OrderLineItemTaxScope string - -const ( - OrderLineItemTaxScopeOtherTaxScope OrderLineItemTaxScope = "OTHER_TAX_SCOPE" - OrderLineItemTaxScopeLineItem OrderLineItemTaxScope = "LINE_ITEM" - OrderLineItemTaxScopeOrder OrderLineItemTaxScope = "ORDER" -) +// Describes an ad hoc item and price to generate a quick pay checkout link. +// For more information, +// see [Quick Pay Checkout](https://developer.squareup.com/docs/checkout-api/quick-pay-checkout). +type QuickPay struct { + // The ad hoc item name. In the resulting `Order`, this name appears as the line item name. + Name string `json:"name" url:"name"` + // The price of the item. + PriceMoney *Money `json:"price_money,omitempty" url:"price_money,omitempty"` + // The ID of the business location the checkout is associated with. + LocationID string `json:"location_id" url:"location_id"` -func NewOrderLineItemTaxScopeFromString(s string) (OrderLineItemTaxScope, error) { - switch s { - case "OTHER_TAX_SCOPE": - return OrderLineItemTaxScopeOtherTaxScope, nil - case "LINE_ITEM": - return OrderLineItemTaxScopeLineItem, nil - case "ORDER": - return OrderLineItemTaxScopeOrder, nil - } - var t OrderLineItemTaxScope - return "", fmt.Errorf("%s is not a valid %T", s, t) + extraProperties map[string]interface{} + _rawJSON json.RawMessage } -func (o OrderLineItemTaxScope) Ptr() *OrderLineItemTaxScope { - return &o +func (q *QuickPay) GetExtraProperties() map[string]interface{} { + return q.extraProperties } -// Indicates how the tax is applied to the associated line item or order. -type OrderLineItemTaxType string - -const ( - OrderLineItemTaxTypeUnknownTax OrderLineItemTaxType = "UNKNOWN_TAX" - OrderLineItemTaxTypeAdditive OrderLineItemTaxType = "ADDITIVE" - OrderLineItemTaxTypeInclusive OrderLineItemTaxType = "INCLUSIVE" -) +func (q *QuickPay) UnmarshalJSON(data []byte) error { + type unmarshaler QuickPay + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *q = QuickPay(value) -func NewOrderLineItemTaxTypeFromString(s string) (OrderLineItemTaxType, error) { - switch s { - case "UNKNOWN_TAX": - return OrderLineItemTaxTypeUnknownTax, nil - case "ADDITIVE": - return OrderLineItemTaxTypeAdditive, nil - case "INCLUSIVE": - return OrderLineItemTaxTypeInclusive, nil + extraProperties, err := core.ExtractExtraProperties(data, *q) + if err != nil { + return err } - var t OrderLineItemTaxType - return "", fmt.Errorf("%s is not a valid %T", s, t) + q.extraProperties = extraProperties + + q._rawJSON = json.RawMessage(data) + return nil } -func (o OrderLineItemTaxType) Ptr() *OrderLineItemTaxType { - return &o +func (q *QuickPay) String() string { + if len(q._rawJSON) > 0 { + if value, err := core.StringifyJSON(q._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(q); err == nil { + return value + } + return fmt.Sprintf("%#v", q) } -// A collection of various money amounts. -type OrderMoneyAmounts struct { - // The total money. - TotalMoney *Money `json:"total_money,omitempty" url:"total_money,omitempty"` - // The money associated with taxes. - TaxMoney *Money `json:"tax_money,omitempty" url:"tax_money,omitempty"` - // The money associated with discounts. - DiscountMoney *Money `json:"discount_money,omitempty" url:"discount_money,omitempty"` - // The money associated with tips. - TipMoney *Money `json:"tip_money,omitempty" url:"tip_money,omitempty"` - // The money associated with service charges. - ServiceChargeMoney *Money `json:"service_charge_money,omitempty" url:"service_charge_money,omitempty"` +// The range of a number value between the specified lower and upper bounds. +type Range struct { + // The lower bound of the number range. At least one of `min` or `max` must be specified. + // If unspecified, the results will have no minimum value. + Min *string `json:"min,omitempty" url:"min,omitempty"` + // The upper bound of the number range. At least one of `min` or `max` must be specified. + // If unspecified, the results will have no maximum value. + Max *string `json:"max,omitempty" url:"max,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderMoneyAmounts) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (r *Range) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (o *OrderMoneyAmounts) UnmarshalJSON(data []byte) error { - type unmarshaler OrderMoneyAmounts +func (r *Range) UnmarshalJSON(data []byte) error { + type unmarshaler Range var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderMoneyAmounts(value) + *r = Range(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - o.extraProperties = extraProperties + r.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (o *OrderMoneyAmounts) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (r *Range) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", r) } -// Pricing options for an order. The options affect how the order's price is calculated. -// They can be used, for example, to apply automatic price adjustments that are based on preconfigured -// [pricing rules]($m/CatalogPricingRule). -type OrderPricingOptions struct { - // The option to determine whether pricing rule-based - // discounts are automatically applied to an order. - AutoApplyDiscounts *bool `json:"auto_apply_discounts,omitempty" url:"auto_apply_discounts,omitempty"` - // The option to determine whether rule-based taxes are automatically - // applied to an order when the criteria of the corresponding rules are met. - AutoApplyTaxes *bool `json:"auto_apply_taxes,omitempty" url:"auto_apply_taxes,omitempty"` +// Describes receipt action fields. +type ReceiptOptions struct { + // The reference to the Square payment ID for the receipt. + PaymentID string `json:"payment_id" url:"payment_id"` + // Instructs the device to print the receipt without displaying the receipt selection screen. + // Requires `printer_enabled` set to true. + // Defaults to false. + PrintOnly *bool `json:"print_only,omitempty" url:"print_only,omitempty"` + // Identify the receipt as a reprint rather than an original receipt. + // Defaults to false. + IsDuplicate *bool `json:"is_duplicate,omitempty" url:"is_duplicate,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderPricingOptions) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (r *ReceiptOptions) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (o *OrderPricingOptions) UnmarshalJSON(data []byte) error { - type unmarshaler OrderPricingOptions +func (r *ReceiptOptions) UnmarshalJSON(data []byte) error { + type unmarshaler ReceiptOptions var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderPricingOptions(value) + *r = ReceiptOptions(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - o.extraProperties = extraProperties + r.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (o *OrderPricingOptions) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (r *ReceiptOptions) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", r) } -// Contains the measurement unit for a quantity and a precision that -// specifies the number of digits after the decimal point for decimal quantities. -type OrderQuantityUnit struct { - // A [MeasurementUnit](entity:MeasurementUnit) that represents the - // unit of measure for the quantity. - MeasurementUnit *MeasurementUnit `json:"measurement_unit,omitempty" url:"measurement_unit,omitempty"` - // For non-integer quantities, represents the number of digits after the decimal point that are - // recorded for this quantity. - // - // For example, a precision of 1 allows quantities such as `"1.0"` and `"1.1"`, but not `"1.01"`. - // - // Min: 0. Max: 5. - Precision *int `json:"precision,omitempty" url:"precision,omitempty"` - // The catalog object ID referencing the - // [CatalogMeasurementUnit](entity:CatalogMeasurementUnit). - // - // This field is set when this is a catalog-backed measurement unit. - CatalogObjectID *string `json:"catalog_object_id,omitempty" url:"catalog_object_id,omitempty"` - // The version of the catalog object that this measurement unit references. - // - // This field is set when this is a catalog-backed measurement unit. - CatalogVersion *int64 `json:"catalog_version,omitempty" url:"catalog_version,omitempty"` +// A response that includes the `LoyaltyEvent` published for redeeming the reward. +type RedeemLoyaltyRewardResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The `LoyaltyEvent` for redeeming the reward. + Event *LoyaltyEvent `json:"event,omitempty" url:"event,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderQuantityUnit) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (r *RedeemLoyaltyRewardResponse) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (o *OrderQuantityUnit) UnmarshalJSON(data []byte) error { - type unmarshaler OrderQuantityUnit +func (r *RedeemLoyaltyRewardResponse) UnmarshalJSON(data []byte) error { + type unmarshaler RedeemLoyaltyRewardResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderQuantityUnit(value) + *r = RedeemLoyaltyRewardResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - o.extraProperties = extraProperties + r.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (o *OrderQuantityUnit) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (r *RedeemLoyaltyRewardResponse) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", r) } -// The set of line items, service charges, taxes, discounts, tips, and other items being returned in an order. -type OrderReturn struct { - // A unique ID that identifies the return only within this order. - UID *string `json:"uid,omitempty" url:"uid,omitempty"` - // An order that contains the original sale of these return line items. This is unset - // for unlinked returns. - SourceOrderID *string `json:"source_order_id,omitempty" url:"source_order_id,omitempty"` - // A collection of line items that are being returned. - ReturnLineItems []*OrderReturnLineItem `json:"return_line_items,omitempty" url:"return_line_items,omitempty"` - // A collection of service charges that are being returned. - ReturnServiceCharges []*OrderReturnServiceCharge `json:"return_service_charges,omitempty" url:"return_service_charges,omitempty"` - // A collection of references to taxes being returned for an order, including the total - // applied tax amount to be returned. The taxes must reference a top-level tax ID from the source - // order. - ReturnTaxes []*OrderReturnTax `json:"return_taxes,omitempty" url:"return_taxes,omitempty"` - // A collection of references to discounts being returned for an order, including the total - // applied discount amount to be returned. The discounts must reference a top-level discount ID - // from the source order. - ReturnDiscounts []*OrderReturnDiscount `json:"return_discounts,omitempty" url:"return_discounts,omitempty"` - // A collection of references to tips being returned for an order. - ReturnTips []*OrderReturnTip `json:"return_tips,omitempty" url:"return_tips,omitempty"` - // A positive or negative rounding adjustment to the total value being returned. Adjustments are commonly - // used to apply cash rounding when the minimum unit of the account is smaller than the lowest - // physical denomination of the currency. - RoundingAdjustment *OrderRoundingAdjustment `json:"rounding_adjustment,omitempty" url:"rounding_adjustment,omitempty"` - // An aggregate monetary value being returned by this return entry. - ReturnAmounts *OrderMoneyAmounts `json:"return_amounts,omitempty" url:"return_amounts,omitempty"` +// Represents a refund processed for a Square transaction. +type Refund struct { + // The refund's unique ID. + ID string `json:"id" url:"id"` + // The ID of the refund's associated location. + LocationID string `json:"location_id" url:"location_id"` + // The ID of the transaction that the refunded tender is part of. + TransactionID *string `json:"transaction_id,omitempty" url:"transaction_id,omitempty"` + // The ID of the refunded tender. + TenderID string `json:"tender_id" url:"tender_id"` + // The timestamp for when the refund was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The reason for the refund being issued. + Reason string `json:"reason" url:"reason"` + // The amount of money refunded to the buyer. + AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` + // The current status of the refund (`PENDING`, `APPROVED`, `REJECTED`, + // or `FAILED`). + // See [RefundStatus](#type-refundstatus) for possible values + Status RefundStatus `json:"status" url:"status"` + // The amount of Square processing fee money refunded to the _merchant_. + ProcessingFeeMoney *Money `json:"processing_fee_money,omitempty" url:"processing_fee_money,omitempty"` + // Additional recipients (other than the merchant) receiving a portion of this refund. + // For example, fees assessed on a refund of a purchase by a third party integration. + AdditionalRecipients []*AdditionalRecipient `json:"additional_recipients,omitempty" url:"additional_recipients,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderReturn) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (r *Refund) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (o *OrderReturn) UnmarshalJSON(data []byte) error { - type unmarshaler OrderReturn +func (r *Refund) UnmarshalJSON(data []byte) error { + type unmarshaler Refund var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderReturn(value) + *r = Refund(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - o.extraProperties = extraProperties + r.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (o *OrderReturn) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (r *Refund) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", r) } -// Represents a discount being returned that applies to one or more return line items in an -// order. -// -// Fixed-amount, order-scoped discounts are distributed across all non-zero return line item totals. -// The amount distributed to each return line item is relative to that item’s contribution to the -// order subtotal. -type OrderReturnDiscount struct { - // A unique ID that identifies the returned discount only within this order. - UID *string `json:"uid,omitempty" url:"uid,omitempty"` - // The discount `uid` from the order that contains the original application of this discount. - SourceDiscountUID *string `json:"source_discount_uid,omitempty" url:"source_discount_uid,omitempty"` - // The catalog object ID referencing [CatalogDiscount](entity:CatalogDiscount). - CatalogObjectID *string `json:"catalog_object_id,omitempty" url:"catalog_object_id,omitempty"` - // The version of the catalog object that this discount references. - CatalogVersion *int64 `json:"catalog_version,omitempty" url:"catalog_version,omitempty"` - // The discount's name. - Name *string `json:"name,omitempty" url:"name,omitempty"` - // The type of the discount. If it is created by the API, it is `FIXED_PERCENTAGE` or `FIXED_AMOUNT`. - // - // Discounts that do not reference a catalog object ID must have a type of - // `FIXED_PERCENTAGE` or `FIXED_AMOUNT`. - // See [OrderLineItemDiscountType](#type-orderlineitemdiscounttype) for possible values - Type *OrderLineItemDiscountType `json:"type,omitempty" url:"type,omitempty"` - // The percentage of the tax, as a string representation of a decimal number. - // A value of `"7.25"` corresponds to a percentage of 7.25%. - // - // `percentage` is not set for amount-based discounts. - Percentage *string `json:"percentage,omitempty" url:"percentage,omitempty"` - // The total declared monetary amount of the discount. - // - // `amount_money` is not set for percentage-based discounts. - AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` - // The amount of discount actually applied to this line item. When an amount-based - // discount is at the order level, this value is different from `amount_money` because the discount - // is distributed across the line items. - AppliedMoney *Money `json:"applied_money,omitempty" url:"applied_money,omitempty"` - // Indicates the level at which the `OrderReturnDiscount` applies. For `ORDER` scoped - // discounts, the server generates references in `applied_discounts` on all - // `OrderReturnLineItem`s. For `LINE_ITEM` scoped discounts, the discount is only applied to - // `OrderReturnLineItem`s with references in their `applied_discounts` field. - // See [OrderLineItemDiscountScope](#type-orderlineitemdiscountscope) for possible values - Scope *OrderLineItemDiscountScope `json:"scope,omitempty" url:"scope,omitempty"` +// Published when a [Refund](entity:PaymentRefund) is created. +type RefundCreatedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents, `"refund.created"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *RefundCreatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderReturnDiscount) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (r *RefundCreatedEvent) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (o *OrderReturnDiscount) UnmarshalJSON(data []byte) error { - type unmarshaler OrderReturnDiscount +func (r *RefundCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler RefundCreatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderReturnDiscount(value) + *r = RefundCreatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - o.extraProperties = extraProperties + r.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (o *OrderReturnDiscount) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (r *RefundCreatedEvent) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", r) } -// The line item being returned in an order. -type OrderReturnLineItem struct { - // A unique ID for this return line-item entry. - UID *string `json:"uid,omitempty" url:"uid,omitempty"` - // The `uid` of the line item in the original sale order. - SourceLineItemUID *string `json:"source_line_item_uid,omitempty" url:"source_line_item_uid,omitempty"` - // The name of the line item. - Name *string `json:"name,omitempty" url:"name,omitempty"` - // The quantity returned, formatted as a decimal number. - // For example, `"3"`. - // - // Line items with a `quantity_unit` can have non-integer quantities. - // For example, `"1.70000"`. - Quantity string `json:"quantity" url:"quantity"` - // The unit and precision that this return line item's quantity is measured in. - QuantityUnit *OrderQuantityUnit `json:"quantity_unit,omitempty" url:"quantity_unit,omitempty"` - // The note of the return line item. - Note *string `json:"note,omitempty" url:"note,omitempty"` - // The [CatalogItemVariation](entity:CatalogItemVariation) ID applied to this return line item. - CatalogObjectID *string `json:"catalog_object_id,omitempty" url:"catalog_object_id,omitempty"` - // The version of the catalog object that this line item references. - CatalogVersion *int64 `json:"catalog_version,omitempty" url:"catalog_version,omitempty"` - // The name of the variation applied to this return line item. - VariationName *string `json:"variation_name,omitempty" url:"variation_name,omitempty"` - // The type of line item: an itemized return, a non-itemized return (custom amount), - // or the return of an unactivated gift card sale. - // See [OrderLineItemItemType](#type-orderlineitemitemtype) for possible values - ItemType *OrderLineItemItemType `json:"item_type,omitempty" url:"item_type,omitempty"` - // The [CatalogModifier](entity:CatalogModifier)s applied to this line item. - ReturnModifiers []*OrderReturnLineItemModifier `json:"return_modifiers,omitempty" url:"return_modifiers,omitempty"` - // The list of references to `OrderReturnTax` entities applied to the return line item. Each - // `OrderLineItemAppliedTax` has a `tax_uid` that references the `uid` of a top-level - // `OrderReturnTax` applied to the return line item. On reads, the applied amount - // is populated. - AppliedTaxes []*OrderLineItemAppliedTax `json:"applied_taxes,omitempty" url:"applied_taxes,omitempty"` - // The list of references to `OrderReturnDiscount` entities applied to the return line item. Each - // `OrderLineItemAppliedDiscount` has a `discount_uid` that references the `uid` of a top-level - // `OrderReturnDiscount` applied to the return line item. On reads, the applied amount - // is populated. - AppliedDiscounts []*OrderLineItemAppliedDiscount `json:"applied_discounts,omitempty" url:"applied_discounts,omitempty"` - // The base price for a single unit of the line item. - BasePriceMoney *Money `json:"base_price_money,omitempty" url:"base_price_money,omitempty"` - // The total price of all item variations returned in this line item. - // The price is calculated as `base_price_money` multiplied by `quantity` and - // does not include modifiers. - VariationTotalPriceMoney *Money `json:"variation_total_price_money,omitempty" url:"variation_total_price_money,omitempty"` - // The gross return amount of money calculated as (item base price + modifiers price) \* quantity. - GrossReturnMoney *Money `json:"gross_return_money,omitempty" url:"gross_return_money,omitempty"` - // The total amount of tax money to return for the line item. - TotalTaxMoney *Money `json:"total_tax_money,omitempty" url:"total_tax_money,omitempty"` - // The total amount of discount money to return for the line item. - TotalDiscountMoney *Money `json:"total_discount_money,omitempty" url:"total_discount_money,omitempty"` - // The total amount of money to return for this line item. - TotalMoney *Money `json:"total_money,omitempty" url:"total_money,omitempty"` - // The list of references to `OrderReturnServiceCharge` entities applied to the return - // line item. Each `OrderLineItemAppliedServiceCharge` has a `service_charge_uid` that - // references the `uid` of a top-level `OrderReturnServiceCharge` applied to the return line - // item. On reads, the applied amount is populated. - AppliedServiceCharges []*OrderLineItemAppliedServiceCharge `json:"applied_service_charges,omitempty" url:"applied_service_charges,omitempty"` - // The total amount of apportioned service charge money to return for the line item. - TotalServiceChargeMoney *Money `json:"total_service_charge_money,omitempty" url:"total_service_charge_money,omitempty"` +type RefundCreatedEventData struct { + // Name of the affected object’s type, `"refund"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the affected refund. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the created refund. + Object *RefundCreatedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderReturnLineItem) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (r *RefundCreatedEventData) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (o *OrderReturnLineItem) UnmarshalJSON(data []byte) error { - type unmarshaler OrderReturnLineItem +func (r *RefundCreatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler RefundCreatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderReturnLineItem(value) + *r = RefundCreatedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - o.extraProperties = extraProperties + r.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (o *OrderReturnLineItem) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (r *RefundCreatedEventData) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", r) } -// A line item modifier being returned. -type OrderReturnLineItemModifier struct { - // A unique ID that identifies the return modifier only within this order. - UID *string `json:"uid,omitempty" url:"uid,omitempty"` - // The modifier `uid` from the order's line item that contains the - // original sale of this line item modifier. - SourceModifierUID *string `json:"source_modifier_uid,omitempty" url:"source_modifier_uid,omitempty"` - // The catalog object ID referencing [CatalogModifier](entity:CatalogModifier). - CatalogObjectID *string `json:"catalog_object_id,omitempty" url:"catalog_object_id,omitempty"` - // The version of the catalog object that this line item modifier references. - CatalogVersion *int64 `json:"catalog_version,omitempty" url:"catalog_version,omitempty"` - // The name of the item modifier. - Name *string `json:"name,omitempty" url:"name,omitempty"` - // The base price for the modifier. - // - // `base_price_money` is required for ad hoc modifiers. - // If both `catalog_object_id` and `base_price_money` are set, `base_price_money` overrides the predefined [CatalogModifier](entity:CatalogModifier) price. - BasePriceMoney *Money `json:"base_price_money,omitempty" url:"base_price_money,omitempty"` - // The total price of the item modifier for its line item. - // This is the modifier's `base_price_money` multiplied by the line item's quantity. - TotalPriceMoney *Money `json:"total_price_money,omitempty" url:"total_price_money,omitempty"` - // The quantity of the line item modifier. The modifier quantity can be 0 or more. - // For example, suppose a restaurant offers a cheeseburger on the menu. When a buyer orders - // this item, the restaurant records the purchase by creating an `Order` object with a line item - // for a burger. The line item includes a line item modifier: the name is cheese and the quantity - // is 1. The buyer has the option to order extra cheese (or no cheese). If the buyer chooses - // the extra cheese option, the modifier quantity increases to 2. If the buyer does not want - // any cheese, the modifier quantity is set to 0. - Quantity *string `json:"quantity,omitempty" url:"quantity,omitempty"` +type RefundCreatedEventObject struct { + // The created refund. + Refund *PaymentRefund `json:"refund,omitempty" url:"refund,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderReturnLineItemModifier) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (r *RefundCreatedEventObject) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (o *OrderReturnLineItemModifier) UnmarshalJSON(data []byte) error { - type unmarshaler OrderReturnLineItemModifier +func (r *RefundCreatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler RefundCreatedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderReturnLineItemModifier(value) + *r = RefundCreatedEventObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - o.extraProperties = extraProperties + r.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (o *OrderReturnLineItemModifier) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (r *RefundCreatedEventObject) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", r) } -// Represents the service charge applied to the original order. -type OrderReturnServiceCharge struct { - // A unique ID that identifies the return service charge only within this order. - UID *string `json:"uid,omitempty" url:"uid,omitempty"` - // The service charge `uid` from the order containing the original - // service charge. `source_service_charge_uid` is `null` for - // unlinked returns. - SourceServiceChargeUID *string `json:"source_service_charge_uid,omitempty" url:"source_service_charge_uid,omitempty"` - // The name of the service charge. - Name *string `json:"name,omitempty" url:"name,omitempty"` - // The catalog object ID of the associated [OrderServiceCharge](entity:OrderServiceCharge). - CatalogObjectID *string `json:"catalog_object_id,omitempty" url:"catalog_object_id,omitempty"` - // The version of the catalog object that this service charge references. - CatalogVersion *int64 `json:"catalog_version,omitempty" url:"catalog_version,omitempty"` - // The percentage of the service charge, as a string representation of - // a decimal number. For example, a value of `"7.25"` corresponds to a - // percentage of 7.25%. - // - // Either `percentage` or `amount_money` should be set, but not both. - Percentage *string `json:"percentage,omitempty" url:"percentage,omitempty"` - // The amount of a non-percentage-based service charge. - // - // Either `percentage` or `amount_money` should be set, but not both. - AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` - // The amount of money applied to the order by the service charge, including - // any inclusive tax amounts, as calculated by Square. - // - // - For fixed-amount service charges, `applied_money` is equal to `amount_money`. - // - For percentage-based service charges, `applied_money` is the money calculated using the percentage. - AppliedMoney *Money `json:"applied_money,omitempty" url:"applied_money,omitempty"` - // The total amount of money to collect for the service charge. - // - // **NOTE**: If an inclusive tax is applied to the service charge, `total_money` - // does not equal `applied_money` plus `total_tax_money` because the inclusive - // tax amount is already included in both `applied_money` and `total_tax_money`. - TotalMoney *Money `json:"total_money,omitempty" url:"total_money,omitempty"` - // The total amount of tax money to collect for the service charge. - TotalTaxMoney *Money `json:"total_tax_money,omitempty" url:"total_tax_money,omitempty"` - // The calculation phase after which to apply the service charge. - // See [OrderServiceChargeCalculationPhase](#type-orderservicechargecalculationphase) for possible values - CalculationPhase *OrderServiceChargeCalculationPhase `json:"calculation_phase,omitempty" url:"calculation_phase,omitempty"` - // Indicates whether the surcharge can be taxed. Service charges - // calculated in the `TOTAL_PHASE` cannot be marked as taxable. - Taxable *bool `json:"taxable,omitempty" url:"taxable,omitempty"` - // The list of references to `OrderReturnTax` entities applied to the - // `OrderReturnServiceCharge`. Each `OrderLineItemAppliedTax` has a `tax_uid` - // that references the `uid` of a top-level `OrderReturnTax` that is being - // applied to the `OrderReturnServiceCharge`. On reads, the applied amount is - // populated. - AppliedTaxes []*OrderLineItemAppliedTax `json:"applied_taxes,omitempty" url:"applied_taxes,omitempty"` - // The treatment type of the service charge. - // See [OrderServiceChargeTreatmentType](#type-orderservicechargetreatmenttype) for possible values - TreatmentType *OrderServiceChargeTreatmentType `json:"treatment_type,omitempty" url:"treatment_type,omitempty"` - // Indicates the level at which the apportioned service charge applies. For `ORDER` - // scoped service charges, Square generates references in `applied_service_charges` on - // all order line items that do not have them. For `LINE_ITEM` scoped service charges, - // the service charge only applies to line items with a service charge reference in their - // `applied_service_charges` field. - // - // This field is immutable. To change the scope of an apportioned service charge, you must delete - // the apportioned service charge and re-add it as a new apportioned service charge. - // See [OrderServiceChargeScope](#type-orderservicechargescope) for possible values - Scope *OrderServiceChargeScope `json:"scope,omitempty" url:"scope,omitempty"` +// Defines the response returned by +// [RefundPayment](api-endpoint:Refunds-RefundPayment). +// +// If there are errors processing the request, the `refund` field might not be +// present, or it might be present with a status of `FAILED`. +type RefundPaymentResponse struct { + // Information about errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The successfully created `PaymentRefund`. + Refund *PaymentRefund `json:"refund,omitempty" url:"refund,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (r *RefundPaymentResponse) GetExtraProperties() map[string]interface{} { + return r.extraProperties +} + +func (r *RefundPaymentResponse) UnmarshalJSON(data []byte) error { + type unmarshaler RefundPaymentResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *r = RefundPaymentResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *r) + if err != nil { + return err + } + r.extraProperties = extraProperties + + r._rawJSON = json.RawMessage(data) + return nil +} + +func (r *RefundPaymentResponse) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(r); err == nil { + return value + } + return fmt.Sprintf("%#v", r) +} + +// Indicates a refund's current status. +type RefundStatus string + +const ( + RefundStatusPending RefundStatus = "PENDING" + RefundStatusApproved RefundStatus = "APPROVED" + RefundStatusRejected RefundStatus = "REJECTED" + RefundStatusFailed RefundStatus = "FAILED" +) + +func NewRefundStatusFromString(s string) (RefundStatus, error) { + switch s { + case "PENDING": + return RefundStatusPending, nil + case "APPROVED": + return RefundStatusApproved, nil + case "REJECTED": + return RefundStatusRejected, nil + case "FAILED": + return RefundStatusFailed, nil + } + var t RefundStatus + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (r RefundStatus) Ptr() *RefundStatus { + return &r +} + +// Published when a [Refund](entity:PaymentRefund) is updated. +// Typically the `refund.status` changes when a refund is completed. +type RefundUpdatedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents, `"refund.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *RefundUpdatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderReturnServiceCharge) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (r *RefundUpdatedEvent) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (o *OrderReturnServiceCharge) UnmarshalJSON(data []byte) error { - type unmarshaler OrderReturnServiceCharge +func (r *RefundUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler RefundUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderReturnServiceCharge(value) + *r = RefundUpdatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - o.extraProperties = extraProperties + r.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (o *OrderReturnServiceCharge) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (r *RefundUpdatedEvent) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", r) } -// Represents a tax being returned that applies to one or more return line items in an order. -// -// Fixed-amount, order-scoped taxes are distributed across all non-zero return line item totals. -// The amount distributed to each return line item is relative to that item’s contribution to the -// order subtotal. -type OrderReturnTax struct { - // A unique ID that identifies the returned tax only within this order. - UID *string `json:"uid,omitempty" url:"uid,omitempty"` - // The tax `uid` from the order that contains the original tax charge. - SourceTaxUID *string `json:"source_tax_uid,omitempty" url:"source_tax_uid,omitempty"` - // The catalog object ID referencing [CatalogTax](entity:CatalogTax). - CatalogObjectID *string `json:"catalog_object_id,omitempty" url:"catalog_object_id,omitempty"` - // The version of the catalog object that this tax references. - CatalogVersion *int64 `json:"catalog_version,omitempty" url:"catalog_version,omitempty"` - // The tax's name. - Name *string `json:"name,omitempty" url:"name,omitempty"` - // Indicates the calculation method used to apply the tax. - // See [OrderLineItemTaxType](#type-orderlineitemtaxtype) for possible values - Type *OrderLineItemTaxType `json:"type,omitempty" url:"type,omitempty"` - // The percentage of the tax, as a string representation of a decimal number. - // For example, a value of `"7.25"` corresponds to a percentage of 7.25%. - Percentage *string `json:"percentage,omitempty" url:"percentage,omitempty"` - // The amount of money applied by the tax in an order. - AppliedMoney *Money `json:"applied_money,omitempty" url:"applied_money,omitempty"` - // Indicates the level at which the `OrderReturnTax` applies. For `ORDER` scoped - // taxes, Square generates references in `applied_taxes` on all - // `OrderReturnLineItem`s. For `LINE_ITEM` scoped taxes, the tax is only applied to - // `OrderReturnLineItem`s with references in their `applied_discounts` field. - // See [OrderLineItemTaxScope](#type-orderlineitemtaxscope) for possible values - Scope *OrderLineItemTaxScope `json:"scope,omitempty" url:"scope,omitempty"` +type RefundUpdatedEventData struct { + // Name of the affected object’s type, `"refund"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the affected refund. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the updated refund. + Object *RefundUpdatedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderReturnTax) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (r *RefundUpdatedEventData) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (o *OrderReturnTax) UnmarshalJSON(data []byte) error { - type unmarshaler OrderReturnTax +func (r *RefundUpdatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler RefundUpdatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderReturnTax(value) + *r = RefundUpdatedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - o.extraProperties = extraProperties + r.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (o *OrderReturnTax) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (r *RefundUpdatedEventData) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", r) } -// A tip being returned. -type OrderReturnTip struct { - // A unique ID that identifies the tip only within this order. - UID *string `json:"uid,omitempty" url:"uid,omitempty"` - // ## The amount of tip being returned - AppliedMoney *Money `json:"applied_money,omitempty" url:"applied_money,omitempty"` - // The tender `uid` from the order that contains the original application of this tip. - SourceTenderUID *string `json:"source_tender_uid,omitempty" url:"source_tender_uid,omitempty"` - // The tender `id` from the order that contains the original application of this tip. - SourceTenderID *string `json:"source_tender_id,omitempty" url:"source_tender_id,omitempty"` +type RefundUpdatedEventObject struct { + // The updated refund. + Refund *PaymentRefund `json:"refund,omitempty" url:"refund,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderReturnTip) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (r *RefundUpdatedEventObject) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (o *OrderReturnTip) UnmarshalJSON(data []byte) error { - type unmarshaler OrderReturnTip +func (r *RefundUpdatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler RefundUpdatedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderReturnTip(value) + *r = RefundUpdatedEventObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - o.extraProperties = extraProperties + r.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (o *OrderReturnTip) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (r *RefundUpdatedEventObject) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", r) } -// Represents a reward that can be applied to an order if the necessary -// reward tier criteria are met. Rewards are created through the Loyalty API. -type OrderReward struct { - // The identifier of the reward. - ID string `json:"id" url:"id"` - // The identifier of the reward tier corresponding to this reward. - RewardTierID string `json:"reward_tier_id" url:"reward_tier_id"` +// Defines the fields that are included in the response body of +// a request to the [RegisterDomain](api-endpoint:ApplePay-RegisterDomain) endpoint. +// +// Either `errors` or `status` are present in a given response (never both). +type RegisterDomainResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The status of the domain registration. + // + // See [RegisterDomainResponseStatus](entity:RegisterDomainResponseStatus) for possible values. + // See [RegisterDomainResponseStatus](#type-registerdomainresponsestatus) for possible values + Status *RegisterDomainResponseStatus `json:"status,omitempty" url:"status,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderReward) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (r *RegisterDomainResponse) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (o *OrderReward) UnmarshalJSON(data []byte) error { - type unmarshaler OrderReward +func (r *RegisterDomainResponse) UnmarshalJSON(data []byte) error { + type unmarshaler RegisterDomainResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderReward(value) + *r = RegisterDomainResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - o.extraProperties = extraProperties + r.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (o *OrderReward) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (r *RegisterDomainResponse) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", r) } -// A rounding adjustment of the money being returned. Commonly used to apply cash rounding -// when the minimum unit of the account is smaller than the lowest physical denomination of the currency. -type OrderRoundingAdjustment struct { - // A unique ID that identifies the rounding adjustment only within this order. - UID *string `json:"uid,omitempty" url:"uid,omitempty"` - // The name of the rounding adjustment from the original sale order. - Name *string `json:"name,omitempty" url:"name,omitempty"` - // The actual rounding adjustment amount. - AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` +// The status of the domain registration. +type RegisterDomainResponseStatus string + +const ( + RegisterDomainResponseStatusPending RegisterDomainResponseStatus = "PENDING" + RegisterDomainResponseStatusVerified RegisterDomainResponseStatus = "VERIFIED" + RegisterDomainResponseStatusDoNotUse RegisterDomainResponseStatus = "DO_NOT_USE" +) + +func NewRegisterDomainResponseStatusFromString(s string) (RegisterDomainResponseStatus, error) { + switch s { + case "PENDING": + return RegisterDomainResponseStatusPending, nil + case "VERIFIED": + return RegisterDomainResponseStatusVerified, nil + case "DO_NOT_USE": + return RegisterDomainResponseStatusDoNotUse, nil + } + var t RegisterDomainResponseStatus + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (r RegisterDomainResponseStatus) Ptr() *RegisterDomainResponseStatus { + return &r +} +// Defines the fields that are included in the request body of +// a request to the [RemoveGroupFromCustomer](api-endpoint:Customers-RemoveGroupFromCustomer) endpoint. +type RemoveGroupFromCustomerRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderRoundingAdjustment) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (r *RemoveGroupFromCustomerRequest) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (o *OrderRoundingAdjustment) UnmarshalJSON(data []byte) error { - type unmarshaler OrderRoundingAdjustment +func (r *RemoveGroupFromCustomerRequest) UnmarshalJSON(data []byte) error { + type unmarshaler RemoveGroupFromCustomerRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderRoundingAdjustment(value) + *r = RemoveGroupFromCustomerRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - o.extraProperties = extraProperties + r.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (o *OrderRoundingAdjustment) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (r *RemoveGroupFromCustomerRequest) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", r) } -// Represents a service charge applied to an order. -type OrderServiceCharge struct { - // A unique ID that identifies the service charge only within this order. - UID *string `json:"uid,omitempty" url:"uid,omitempty"` - // The name of the service charge. - Name *string `json:"name,omitempty" url:"name,omitempty"` - // The catalog object ID referencing the service charge [CatalogObject](entity:CatalogObject). - CatalogObjectID *string `json:"catalog_object_id,omitempty" url:"catalog_object_id,omitempty"` - // The version of the catalog object that this service charge references. - CatalogVersion *int64 `json:"catalog_version,omitempty" url:"catalog_version,omitempty"` - // The service charge percentage as a string representation of a - // decimal number. For example, `"7.25"` indicates a service charge of 7.25%. - // - // Exactly 1 of `percentage` or `amount_money` should be set. - Percentage *string `json:"percentage,omitempty" url:"percentage,omitempty"` - // The amount of a non-percentage-based service charge. - // - // Exactly one of `percentage` or `amount_money` should be set. - AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` - // The amount of money applied to the order by the service charge, - // including any inclusive tax amounts, as calculated by Square. - // - // - For fixed-amount service charges, `applied_money` is equal to `amount_money`. - // - For percentage-based service charges, `applied_money` is the money - // calculated using the percentage. - AppliedMoney *Money `json:"applied_money,omitempty" url:"applied_money,omitempty"` - // The total amount of money to collect for the service charge. - // - // **Note**: If an inclusive tax is applied to the service charge, - // `total_money` does not equal `applied_money` plus `total_tax_money` - // because the inclusive tax amount is already included in both - // `applied_money` and `total_tax_money`. - TotalMoney *Money `json:"total_money,omitempty" url:"total_money,omitempty"` - // The total amount of tax money to collect for the service charge. - TotalTaxMoney *Money `json:"total_tax_money,omitempty" url:"total_tax_money,omitempty"` - // The calculation phase at which to apply the service charge. - // See [OrderServiceChargeCalculationPhase](#type-orderservicechargecalculationphase) for possible values - CalculationPhase *OrderServiceChargeCalculationPhase `json:"calculation_phase,omitempty" url:"calculation_phase,omitempty"` - // Indicates whether the service charge can be taxed. If set to `true`, - // order-level taxes automatically apply to the service charge. Note that - // service charges calculated in the `TOTAL_PHASE` cannot be marked as taxable. - Taxable *bool `json:"taxable,omitempty" url:"taxable,omitempty"` - // The list of references to the taxes applied to this service charge. Each - // `OrderLineItemAppliedTax` has a `tax_uid` that references the `uid` of a top-level - // `OrderLineItemTax` that is being applied to this service charge. On reads, the amount applied - // is populated. - // - // An `OrderLineItemAppliedTax` is automatically created on every taxable service charge - // for all `ORDER` scoped taxes that are added to the order. `OrderLineItemAppliedTax` records - // for `LINE_ITEM` scoped taxes must be added in requests for the tax to apply to any taxable - // service charge. Taxable service charges have the `taxable` field set to `true` and calculated - // in the `SUBTOTAL_PHASE`. - // - // To change the amount of a tax, modify the referenced top-level tax. - AppliedTaxes []*OrderLineItemAppliedTax `json:"applied_taxes,omitempty" url:"applied_taxes,omitempty"` - // Application-defined data attached to this service charge. Metadata fields are intended - // to store descriptive references or associations with an entity in another system or store brief - // information about the object. Square does not process this field; it only stores and returns it - // in relevant API calls. Do not use metadata to store any sensitive information (such as personally - // identifiable information or card details). - // - // Keys written by applications must be 60 characters or less and must be in the character set - // `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed - // with a namespace, separated from the key with a ':' character. - // - // Values have a maximum length of 255 characters. - // - // An application can have up to 10 entries per metadata field. - // - // Entries written by applications are private and can only be read or modified by the same - // application. - // - // For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). - Metadata map[string]*string `json:"metadata,omitempty" url:"metadata,omitempty"` - // The type of the service charge. - // See [OrderServiceChargeType](#type-orderservicechargetype) for possible values - Type *OrderServiceChargeType `json:"type,omitempty" url:"type,omitempty"` - // The treatment type of the service charge. - // See [OrderServiceChargeTreatmentType](#type-orderservicechargetreatmenttype) for possible values - TreatmentType *OrderServiceChargeTreatmentType `json:"treatment_type,omitempty" url:"treatment_type,omitempty"` - // Indicates the level at which the apportioned service charge applies. For `ORDER` - // scoped service charges, Square generates references in `applied_service_charges` on - // all order line items that do not have them. For `LINE_ITEM` scoped service charges, - // the service charge only applies to line items with a service charge reference in their - // `applied_service_charges` field. - // - // This field is immutable. To change the scope of an apportioned service charge, you must delete - // the apportioned service charge and re-add it as a new apportioned service charge. - // See [OrderServiceChargeScope](#type-orderservicechargescope) for possible values - Scope *OrderServiceChargeScope `json:"scope,omitempty" url:"scope,omitempty"` +// Defines the fields that are included in the response body of +// a request to the [RemoveGroupFromCustomer](api-endpoint:Customers-RemoveGroupFromCustomer) +// endpoint. +type RemoveGroupFromCustomerResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderServiceCharge) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (r *RemoveGroupFromCustomerResponse) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (o *OrderServiceCharge) UnmarshalJSON(data []byte) error { - type unmarshaler OrderServiceCharge +func (r *RemoveGroupFromCustomerResponse) UnmarshalJSON(data []byte) error { + type unmarshaler RemoveGroupFromCustomerResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderServiceCharge(value) + *r = RemoveGroupFromCustomerResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - o.extraProperties = extraProperties + r.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (o *OrderServiceCharge) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (r *RemoveGroupFromCustomerResponse) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", r) } -// Represents a phase in the process of calculating order totals. -// Service charges are applied after the indicated phase. -// -// [Read more about how order totals are calculated.](https://developer.squareup.com/docs/orders-api/how-it-works#how-totals-are-calculated) -type OrderServiceChargeCalculationPhase string - -const ( - OrderServiceChargeCalculationPhaseSubtotalPhase OrderServiceChargeCalculationPhase = "SUBTOTAL_PHASE" - OrderServiceChargeCalculationPhaseTotalPhase OrderServiceChargeCalculationPhase = "TOTAL_PHASE" - OrderServiceChargeCalculationPhaseApportionedPercentagePhase OrderServiceChargeCalculationPhase = "APPORTIONED_PERCENTAGE_PHASE" - OrderServiceChargeCalculationPhaseApportionedAmountPhase OrderServiceChargeCalculationPhase = "APPORTIONED_AMOUNT_PHASE" -) +type RenewTokenResponse struct { + // The renewed access token. + // This value might be different from the `access_token` you provided in your request. + // You provide this token in a header with every request to Connect API endpoints. + // See [Request and response headers](https://developer.squareup.com/docs/api/connect/v2/#requestandresponseheaders) for the format of this header. + AccessToken *string `json:"access_token,omitempty" url:"access_token,omitempty"` + // This value is always _bearer_. + TokenType *string `json:"token_type,omitempty" url:"token_type,omitempty"` + // The date when the `access_token` expires, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm) format. + ExpiresAt *string `json:"expires_at,omitempty" url:"expires_at,omitempty"` + // The ID of the authorizing merchant's business. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // **LEGACY FIELD**. The ID of the merchant subscription associated with + // the authorization. The ID is only present if the merchant signed up for a subscription + // during authorization. + SubscriptionID *string `json:"subscription_id,omitempty" url:"subscription_id,omitempty"` + // **LEGACY FIELD**. The ID of the subscription plan the merchant signed + // up for. The ID is only present if the merchant signed up for a subscription plan during + // authorization. + PlanID *string `json:"plan_id,omitempty" url:"plan_id,omitempty"` + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` -func NewOrderServiceChargeCalculationPhaseFromString(s string) (OrderServiceChargeCalculationPhase, error) { - switch s { - case "SUBTOTAL_PHASE": - return OrderServiceChargeCalculationPhaseSubtotalPhase, nil - case "TOTAL_PHASE": - return OrderServiceChargeCalculationPhaseTotalPhase, nil - case "APPORTIONED_PERCENTAGE_PHASE": - return OrderServiceChargeCalculationPhaseApportionedPercentagePhase, nil - case "APPORTIONED_AMOUNT_PHASE": - return OrderServiceChargeCalculationPhaseApportionedAmountPhase, nil - } - var t OrderServiceChargeCalculationPhase - return "", fmt.Errorf("%s is not a valid %T", s, t) + extraProperties map[string]interface{} + _rawJSON json.RawMessage } -func (o OrderServiceChargeCalculationPhase) Ptr() *OrderServiceChargeCalculationPhase { - return &o +func (r *RenewTokenResponse) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -// Indicates whether this is a line-item or order-level apportioned -// service charge. -type OrderServiceChargeScope string - -const ( - OrderServiceChargeScopeOtherServiceChargeScope OrderServiceChargeScope = "OTHER_SERVICE_CHARGE_SCOPE" - OrderServiceChargeScopeLineItem OrderServiceChargeScope = "LINE_ITEM" - OrderServiceChargeScopeOrder OrderServiceChargeScope = "ORDER" -) +func (r *RenewTokenResponse) UnmarshalJSON(data []byte) error { + type unmarshaler RenewTokenResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *r = RenewTokenResponse(value) -func NewOrderServiceChargeScopeFromString(s string) (OrderServiceChargeScope, error) { - switch s { - case "OTHER_SERVICE_CHARGE_SCOPE": - return OrderServiceChargeScopeOtherServiceChargeScope, nil - case "LINE_ITEM": - return OrderServiceChargeScopeLineItem, nil - case "ORDER": - return OrderServiceChargeScopeOrder, nil + extraProperties, err := core.ExtractExtraProperties(data, *r) + if err != nil { + return err } - var t OrderServiceChargeScope - return "", fmt.Errorf("%s is not a valid %T", s, t) -} + r.extraProperties = extraProperties -func (o OrderServiceChargeScope) Ptr() *OrderServiceChargeScope { - return &o + r._rawJSON = json.RawMessage(data) + return nil } -// Indicates whether the service charge will be treated as a value-holding line item or -// apportioned toward a line item. -type OrderServiceChargeTreatmentType string - -const ( - OrderServiceChargeTreatmentTypeLineItemTreatment OrderServiceChargeTreatmentType = "LINE_ITEM_TREATMENT" - OrderServiceChargeTreatmentTypeApportionedTreatment OrderServiceChargeTreatmentType = "APPORTIONED_TREATMENT" -) - -func NewOrderServiceChargeTreatmentTypeFromString(s string) (OrderServiceChargeTreatmentType, error) { - switch s { - case "LINE_ITEM_TREATMENT": - return OrderServiceChargeTreatmentTypeLineItemTreatment, nil - case "APPORTIONED_TREATMENT": - return OrderServiceChargeTreatmentTypeApportionedTreatment, nil +func (r *RenewTokenResponse) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { + return value + } } - var t OrderServiceChargeTreatmentType - return "", fmt.Errorf("%s is not a valid %T", s, t) + if value, err := core.StringifyJSON(r); err == nil { + return value + } + return fmt.Sprintf("%#v", r) } -func (o OrderServiceChargeTreatmentType) Ptr() *OrderServiceChargeTreatmentType { - return &o +// Defines output parameters in a response from the +// [ResumeSubscription](api-endpoint:Subscriptions-ResumeSubscription) endpoint. +type ResumeSubscriptionResponse struct { + // Errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The resumed subscription. + Subscription *Subscription `json:"subscription,omitempty" url:"subscription,omitempty"` + // A list of `RESUME` actions created by the request and scheduled for the subscription. + Actions []*SubscriptionAction `json:"actions,omitempty" url:"actions,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage } -type OrderServiceChargeType string +func (r *ResumeSubscriptionResponse) GetExtraProperties() map[string]interface{} { + return r.extraProperties +} -const ( - OrderServiceChargeTypeAutoGratuity OrderServiceChargeType = "AUTO_GRATUITY" - OrderServiceChargeTypeCustom OrderServiceChargeType = "CUSTOM" -) +func (r *ResumeSubscriptionResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ResumeSubscriptionResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *r = ResumeSubscriptionResponse(value) -func NewOrderServiceChargeTypeFromString(s string) (OrderServiceChargeType, error) { - switch s { - case "AUTO_GRATUITY": - return OrderServiceChargeTypeAutoGratuity, nil - case "CUSTOM": - return OrderServiceChargeTypeCustom, nil + extraProperties, err := core.ExtractExtraProperties(data, *r) + if err != nil { + return err } - var t OrderServiceChargeType - return "", fmt.Errorf("%s is not a valid %T", s, t) + r.extraProperties = extraProperties + + r._rawJSON = json.RawMessage(data) + return nil } -func (o OrderServiceChargeType) Ptr() *OrderServiceChargeType { - return &o +func (r *ResumeSubscriptionResponse) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(r); err == nil { + return value + } + return fmt.Sprintf("%#v", r) } -// Represents the origination details of an order. -type OrderSource struct { - // The name used to identify the place (physical or digital) that an order originates. - // If unset, the name defaults to the name of the application that created the order. - Name *string `json:"name,omitempty" url:"name,omitempty"` +// Represents a [RetrieveBookingCustomAttributeDefinition](api-endpoint:BookingCustomAttributes-RetrieveBookingCustomAttributeDefinition) response. +// Either `custom_attribute_definition` or `errors` is present in the response. +type RetrieveBookingCustomAttributeDefinitionResponse struct { + // The retrieved custom attribute definition. + CustomAttributeDefinition *CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"custom_attribute_definition,omitempty"` + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderSource) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (r *RetrieveBookingCustomAttributeDefinitionResponse) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (o *OrderSource) UnmarshalJSON(data []byte) error { - type unmarshaler OrderSource +func (r *RetrieveBookingCustomAttributeDefinitionResponse) UnmarshalJSON(data []byte) error { + type unmarshaler RetrieveBookingCustomAttributeDefinitionResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderSource(value) + *r = RetrieveBookingCustomAttributeDefinitionResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - o.extraProperties = extraProperties + r.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (o *OrderSource) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (r *RetrieveBookingCustomAttributeDefinitionResponse) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", o) -} - -// The state of the order. -type OrderState string - -const ( - OrderStateOpen OrderState = "OPEN" - OrderStateCompleted OrderState = "COMPLETED" - OrderStateCanceled OrderState = "CANCELED" - OrderStateDraft OrderState = "DRAFT" -) - -func NewOrderStateFromString(s string) (OrderState, error) { - switch s { - case "OPEN": - return OrderStateOpen, nil - case "COMPLETED": - return OrderStateCompleted, nil - case "CANCELED": - return OrderStateCanceled, nil - case "DRAFT": - return OrderStateDraft, nil - } - var t OrderState - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (o OrderState) Ptr() *OrderState { - return &o + return fmt.Sprintf("%#v", r) } -type OrderUpdated struct { - // The order's unique ID. - OrderID *string `json:"order_id,omitempty" url:"order_id,omitempty"` - // The version number, which is incremented each time an update is committed to the order. - // Orders that were not created through the API do not include a version number and - // therefore cannot be updated. - // - // [Read more about working with versions.](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders) - Version *int `json:"version,omitempty" url:"version,omitempty"` - // The ID of the seller location that this order is associated with. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` - // The state of the order. - // See [OrderState](#type-orderstate) for possible values - State *OrderState `json:"state,omitempty" url:"state,omitempty"` - // The timestamp for when the order was created, in RFC 3339 format. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The timestamp for when the order was last updated, in RFC 3339 format. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` +// Represents a [RetrieveBookingCustomAttribute](api-endpoint:BookingCustomAttributes-RetrieveBookingCustomAttribute) response. +// Either `custom_attribute_definition` or `errors` is present in the response. +type RetrieveBookingCustomAttributeResponse struct { + // The retrieved custom attribute. If `with_definition` was set to `true` in the request, + // the custom attribute definition is returned in the `definition` field. + CustomAttribute *CustomAttribute `json:"custom_attribute,omitempty" url:"custom_attribute,omitempty"` + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderUpdated) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (r *RetrieveBookingCustomAttributeResponse) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (o *OrderUpdated) UnmarshalJSON(data []byte) error { - type unmarshaler OrderUpdated +func (r *RetrieveBookingCustomAttributeResponse) UnmarshalJSON(data []byte) error { + type unmarshaler RetrieveBookingCustomAttributeResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderUpdated(value) + *r = RetrieveBookingCustomAttributeResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - o.extraProperties = extraProperties + r.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (o *OrderUpdated) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (r *RetrieveBookingCustomAttributeResponse) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", r) } -type OrderUpdatedObject struct { - // Information about the updated order. - OrderUpdated *OrderUpdated `json:"order_updated,omitempty" url:"order_updated,omitempty"` +type RetrieveCashDrawerShiftRequest struct { + // The ID of the location to retrieve cash drawer shifts from. + LocationID string `json:"location_id" url:"location_id"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (o *OrderUpdatedObject) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (r *RetrieveCashDrawerShiftRequest) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (o *OrderUpdatedObject) UnmarshalJSON(data []byte) error { - type unmarshaler OrderUpdatedObject +func (r *RetrieveCashDrawerShiftRequest) UnmarshalJSON(data []byte) error { + type unmarshaler RetrieveCashDrawerShiftRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *o = OrderUpdatedObject(value) + *r = RetrieveCashDrawerShiftRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *o) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - o.extraProperties = extraProperties + r.extraProperties = extraProperties - o._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (o *OrderUpdatedObject) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (r *RetrieveCashDrawerShiftRequest) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", r) } -// Used _internally_ to encapsulate pagination details. The resulting proto will be base62 encoded -// in order to produce a cursor that can be used externally. -type PaginationCursor struct { - // The ID of the last resource in the current page. The page can be in an ascending or - // descending order - OrderValue *string `json:"order_value,omitempty" url:"order_value,omitempty"` +type RetrieveCatalogObjectRequest struct { + // If `true`, the response will include additional objects that are related to the + // requested objects. Related objects are defined as any objects referenced by ID by the results in the `objects` field + // of the response. These objects are put in the `related_objects` field. Setting this to `true` is + // helpful when the objects are needed for immediate display to a user. + // This process only goes one level deep. Objects referenced by the related objects will not be included. For example, + // + // if the `objects` field of the response contains a CatalogItem, its associated + // CatalogCategory objects, CatalogTax objects, CatalogImage objects and + // CatalogModifierLists will be returned in the `related_objects` field of the + // response. If the `objects` field of the response contains a CatalogItemVariation, + // its parent CatalogItem will be returned in the `related_objects` field of + // the response. + // + // Default value: `false` + IncludeRelatedObjects *bool `json:"include_related_objects,omitempty" url:"include_related_objects,omitempty"` + // Requests objects as of a specific version of the catalog. This allows you to retrieve historical + // versions of objects. The value to retrieve a specific version of an object can be found + // in the version field of [CatalogObject](entity:CatalogObject)s. If not included, results will + // be from the current version of the catalog. + CatalogVersion *int64 `json:"catalog_version,omitempty" url:"catalog_version,omitempty"` + // Specifies whether or not to include the `path_to_root` list for each returned category instance. The `path_to_root` list consists + // of `CategoryPathToRootNode` objects and specifies the path that starts with the immediate parent category of the returned category + // and ends with its root category. If the returned category is a top-level category, the `path_to_root` list is empty and is not returned + // in the response payload. + IncludeCategoryPathToRoot *bool `json:"include_category_path_to_root,omitempty" url:"include_category_path_to_root,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PaginationCursor) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (r *RetrieveCatalogObjectRequest) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (p *PaginationCursor) UnmarshalJSON(data []byte) error { - type unmarshaler PaginationCursor +func (r *RetrieveCatalogObjectRequest) UnmarshalJSON(data []byte) error { + type unmarshaler RetrieveCatalogObjectRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PaginationCursor(value) + *r = RetrieveCatalogObjectRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - p.extraProperties = extraProperties + r.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (p *PaginationCursor) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (r *RetrieveCatalogObjectRequest) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", r) } -// Defines output parameters in a response from the -// [PauseSubscription]($e/Subscriptions/PauseSubscription) endpoint. -type PauseSubscriptionResponse struct { - // Errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The subscription to be paused by the scheduled `PAUSE` action. - Subscription *Subscription `json:"subscription,omitempty" url:"subscription,omitempty"` - // The list of a `PAUSE` action and a possible `RESUME` action created by the request. - Actions []*SubscriptionAction `json:"actions,omitempty" url:"actions,omitempty"` +// Represents a [RetrieveCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-RetrieveCustomerCustomAttributeDefinition) request. +type RetrieveCustomerCustomAttributeDefinitionRequest struct { + // The current version of the custom attribute definition, which is used for strongly consistent + // reads to guarantee that you receive the most up-to-date data. When included in the request, + // Square returns the specified version or a higher version if one exists. If the specified version + // is higher than the current version, Square returns a `BAD_REQUEST` error. + Version *int `json:"version,omitempty" url:"version,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PauseSubscriptionResponse) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (r *RetrieveCustomerCustomAttributeDefinitionRequest) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (p *PauseSubscriptionResponse) UnmarshalJSON(data []byte) error { - type unmarshaler PauseSubscriptionResponse +func (r *RetrieveCustomerCustomAttributeDefinitionRequest) UnmarshalJSON(data []byte) error { + type unmarshaler RetrieveCustomerCustomAttributeDefinitionRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PauseSubscriptionResponse(value) + *r = RetrieveCustomerCustomAttributeDefinitionRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - p.extraProperties = extraProperties + r.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (p *PauseSubscriptionResponse) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (r *RetrieveCustomerCustomAttributeDefinitionRequest) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", r) } -// Defines the fields that are included in the response body of a request to the -// [PayOrder]($e/Orders/PayOrder) endpoint. -type PayOrderResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The paid, updated [order](entity:Order). - Order *Order `json:"order,omitempty" url:"order,omitempty"` +// Represents a [RetrieveCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-RetrieveCustomerCustomAttribute) request. +type RetrieveCustomerCustomAttributeRequest struct { + // Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of + // the custom attribute. Set this parameter to `true` to get the name and description of the custom + // attribute, information about the data type, or other definition details. The default value is `false`. + WithDefinition *bool `json:"with_definition,omitempty" url:"with_definition,omitempty"` + // The current version of the custom attribute, which is used for strongly consistent reads to + // guarantee that you receive the most up-to-date data. When included in the request, Square + // returns the specified version or a higher version if one exists. If the specified version is + // higher than the current version, Square returns a `BAD_REQUEST` error. + Version *int `json:"version,omitempty" url:"version,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PayOrderResponse) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (r *RetrieveCustomerCustomAttributeRequest) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (p *PayOrderResponse) UnmarshalJSON(data []byte) error { - type unmarshaler PayOrderResponse +func (r *RetrieveCustomerCustomAttributeRequest) UnmarshalJSON(data []byte) error { + type unmarshaler RetrieveCustomerCustomAttributeRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PayOrderResponse(value) + *r = RetrieveCustomerCustomAttributeRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - p.extraProperties = extraProperties + r.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (p *PayOrderResponse) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (r *RetrieveCustomerCustomAttributeRequest) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", r) } -// Represents a payment processed by the Square API. -type Payment struct { - // A unique ID for the payment. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The timestamp of when the payment was created, in RFC 3339 format. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The timestamp of when the payment was last updated, in RFC 3339 format. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` - // The amount processed for this payment, not including `tip_money`. - // - // The amount is specified in the smallest denomination of the applicable currency (for example, - // US dollar amounts are specified in cents). For more information, see - // [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts). - AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` - // The amount designated as a tip. - // - // This amount is specified in the smallest denomination of the applicable currency (for example, - // US dollar amounts are specified in cents). For more information, see - // [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts). - TipMoney *Money `json:"tip_money,omitempty" url:"tip_money,omitempty"` - // The total amount for the payment, including `amount_money` and `tip_money`. - // This amount is specified in the smallest denomination of the applicable currency (for example, - // US dollar amounts are specified in cents). For more information, see - // [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts). - TotalMoney *Money `json:"total_money,omitempty" url:"total_money,omitempty"` - // The amount the developer is taking as a fee for facilitating the payment on behalf - // of the seller. This amount is specified in the smallest denomination of the applicable currency - // (for example, US dollar amounts are specified in cents). For more information, - // see [Take Payments and Collect Fees](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees). - // - // The amount cannot be more than 90% of the `total_money` value. - // - // To set this field, `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission is required. - // For more information, see [Permissions](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees#permissions). - AppFeeMoney *Money `json:"app_fee_money,omitempty" url:"app_fee_money,omitempty"` - // The amount of money approved for this payment. This value may change if Square chooses to - // obtain reauthorization as part of a call to [UpdatePayment](api-endpoint:Payments-UpdatePayment). - ApprovedMoney *Money `json:"approved_money,omitempty" url:"approved_money,omitempty"` - // The processing fees and fee adjustments assessed by Square for this payment. - ProcessingFee []*ProcessingFee `json:"processing_fee,omitempty" url:"processing_fee,omitempty"` - // The total amount of the payment refunded to date. - // - // This amount is specified in the smallest denomination of the applicable currency (for example, - // US dollar amounts are specified in cents). - RefundedMoney *Money `json:"refunded_money,omitempty" url:"refunded_money,omitempty"` - // Indicates whether the payment is APPROVED, PENDING, COMPLETED, CANCELED, or FAILED. - Status *string `json:"status,omitempty" url:"status,omitempty"` - // The duration of time after the payment's creation when Square automatically applies the - // `delay_action` to the payment. This automatic `delay_action` applies only to payments that - // do not reach a terminal state (COMPLETED, CANCELED, or FAILED) before the `delay_duration` - // time period. - // - // This field is specified as a time duration, in RFC 3339 format. - // - // Notes: - // This feature is only supported for card payments. - // - // Default: - // - // - Card-present payments: "PT36H" (36 hours) from the creation time. - // - Card-not-present payments: "P7D" (7 days) from the creation time. - DelayDuration *string `json:"delay_duration,omitempty" url:"delay_duration,omitempty"` - // The action to be applied to the payment when the `delay_duration` has elapsed. - // - // Current values include `CANCEL` and `COMPLETE`. - DelayAction *string `json:"delay_action,omitempty" url:"delay_action,omitempty"` - // The read-only timestamp of when the `delay_action` is automatically applied, - // in RFC 3339 format. - // - // Note that this field is calculated by summing the payment's `delay_duration` and `created_at` - // fields. The `created_at` field is generated by Square and might not exactly match the - // time on your local machine. - DelayedUntil *string `json:"delayed_until,omitempty" url:"delayed_until,omitempty"` - // The source type for this payment. - // - // Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `BUY_NOW_PAY_LATER`, `SQUARE_ACCOUNT`, - // `CASH` and `EXTERNAL`. For information about these payment source types, - // see [Take Payments](https://developer.squareup.com/docs/payments-api/take-payments). - SourceType *string `json:"source_type,omitempty" url:"source_type,omitempty"` - // Details about a card payment. These details are only populated if the source_type is `CARD`. - CardDetails *CardPaymentDetails `json:"card_details,omitempty" url:"card_details,omitempty"` - // Details about a cash payment. These details are only populated if the source_type is `CASH`. - CashDetails *CashPaymentDetails `json:"cash_details,omitempty" url:"cash_details,omitempty"` - // Details about a bank account payment. These details are only populated if the source_type is `BANK_ACCOUNT`. - BankAccountDetails *BankAccountPaymentDetails `json:"bank_account_details,omitempty" url:"bank_account_details,omitempty"` - // Details about an external payment. The details are only populated - // if the `source_type` is `EXTERNAL`. - ExternalDetails *ExternalPaymentDetails `json:"external_details,omitempty" url:"external_details,omitempty"` - // Details about an wallet payment. The details are only populated - // if the `source_type` is `WALLET`. - WalletDetails *DigitalWalletDetails `json:"wallet_details,omitempty" url:"wallet_details,omitempty"` - // Details about a Buy Now Pay Later payment. The details are only populated - // if the `source_type` is `BUY_NOW_PAY_LATER`. For more information, see - // [Afterpay Payments](https://developer.squareup.com/docs/payments-api/take-payments/afterpay-payments). - BuyNowPayLaterDetails *BuyNowPayLaterDetails `json:"buy_now_pay_later_details,omitempty" url:"buy_now_pay_later_details,omitempty"` - // Details about a Square Account payment. The details are only populated - // if the `source_type` is `SQUARE_ACCOUNT`. - SquareAccountDetails *SquareAccountDetails `json:"square_account_details,omitempty" url:"square_account_details,omitempty"` - // The ID of the location associated with the payment. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` - // The ID of the order associated with the payment. - OrderID *string `json:"order_id,omitempty" url:"order_id,omitempty"` - // An optional ID that associates the payment with an entity in - // another system. - ReferenceID *string `json:"reference_id,omitempty" url:"reference_id,omitempty"` - // The ID of the customer associated with the payment. If the ID is - // not provided in the `CreatePayment` request that was used to create the `Payment`, - // Square may use information in the request - // (such as the billing and shipping address, email address, and payment source) - // to identify a matching customer profile in the Customer Directory. - // If found, the profile ID is used. If a profile is not found, the - // API attempts to create an - // [instant profile](https://developer.squareup.com/docs/customers-api/what-it-does#instant-profiles). - // If the API cannot create an - // instant profile (either because the seller has disabled it or the - // seller's region prevents creating it), this field remains unset. Note that - // this process is asynchronous and it may take some time before a - // customer ID is added to the payment. - CustomerID *string `json:"customer_id,omitempty" url:"customer_id,omitempty"` - // **Deprecated**: Use `Payment.team_member_id` instead. - // - // An optional ID of the employee associated with taking the payment. - EmployeeID *string `json:"employee_id,omitempty" url:"employee_id,omitempty"` - // An optional ID of the [TeamMember](entity:TeamMember) associated with taking the payment. - TeamMemberID *string `json:"team_member_id,omitempty" url:"team_member_id,omitempty"` - // A list of `refund_id`s identifying refunds for the payment. - RefundIDs []string `json:"refund_ids,omitempty" url:"refund_ids,omitempty"` - // Provides information about the risk associated with the payment, as determined by Square. - // This field is present for payments to sellers that have opted in to receive risk - // evaluations. - RiskEvaluation *RiskEvaluation `json:"risk_evaluation,omitempty" url:"risk_evaluation,omitempty"` - // An optional ID for a Terminal checkout that is associated with the payment. - TerminalCheckoutID *string `json:"terminal_checkout_id,omitempty" url:"terminal_checkout_id,omitempty"` - // The buyer's email address. - BuyerEmailAddress *string `json:"buyer_email_address,omitempty" url:"buyer_email_address,omitempty"` - // The buyer's billing address. - BillingAddress *Address `json:"billing_address,omitempty" url:"billing_address,omitempty"` - // The buyer's shipping address. - ShippingAddress *Address `json:"shipping_address,omitempty" url:"shipping_address,omitempty"` - // An optional note to include when creating a payment. - Note *string `json:"note,omitempty" url:"note,omitempty"` - // Additional payment information that gets added to the customer's card statement - // as part of the statement description. - // - // Note that the `statement_description_identifier` might get truncated on the statement description - // to fit the required information including the Square identifier (SQ \*) and the name of the - // seller taking the payment. - StatementDescriptionIdentifier *string `json:"statement_description_identifier,omitempty" url:"statement_description_identifier,omitempty"` - // Actions that can be performed on this payment: +type RetrieveInventoryChangesRequest struct { + // The [Location](entity:Location) IDs to look up as a comma-separated + // list. An empty list queries all locations. + LocationIDs *string `json:"location_ids,omitempty" 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. // - // - `EDIT_AMOUNT_UP` - The payment amount can be edited up. - // - `EDIT_AMOUNT_DOWN` - The payment amount can be edited down. - // - `EDIT_TIP_AMOUNT_UP` - The tip amount can be edited up. - // - `EDIT_TIP_AMOUNT_DOWN` - The tip amount can be edited down. - // - `EDIT_DELAY_ACTION` - The delay_action can be edited. - Capabilities []string `json:"capabilities,omitempty" url:"capabilities,omitempty"` - // The payment's receipt number. - // The field is missing if a payment is canceled. - ReceiptNumber *string `json:"receipt_number,omitempty" url:"receipt_number,omitempty"` - // The URL for the payment's receipt. - // The field is only populated for COMPLETED payments. - ReceiptURL *string `json:"receipt_url,omitempty" url:"receipt_url,omitempty"` - // Details about the device that took the payment. - DeviceDetails *DeviceDetails `json:"device_details,omitempty" url:"device_details,omitempty"` - // Details about the application that took the payment. - ApplicationDetails *ApplicationDetails `json:"application_details,omitempty" url:"application_details,omitempty"` - // Whether or not this payment was taken offline. - IsOfflinePayment *bool `json:"is_offline_payment,omitempty" url:"is_offline_payment,omitempty"` - // Additional information about the payment if it was taken offline. - OfflinePaymentDetails *OfflinePaymentDetails `json:"offline_payment_details,omitempty" url:"offline_payment_details,omitempty"` - // Used for optimistic concurrency. This opaque token identifies a specific version of the - // `Payment` object. - VersionToken *string `json:"version_token,omitempty" url:"version_token,omitempty"` + // 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 (p *Payment) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (r *RetrieveInventoryChangesRequest) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (p *Payment) UnmarshalJSON(data []byte) error { - type unmarshaler Payment +func (r *RetrieveInventoryChangesRequest) UnmarshalJSON(data []byte) error { + type unmarshaler RetrieveInventoryChangesRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = Payment(value) + *r = RetrieveInventoryChangesRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - p.extraProperties = extraProperties + r.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (p *Payment) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (r *RetrieveInventoryChangesRequest) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", r) } -type PaymentBalanceActivityAppFeeRefundDetail struct { - // The ID of the payment associated with this activity. - PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` - // The ID of the refund associated with this activity. - RefundID *string `json:"refund_id,omitempty" url:"refund_id,omitempty"` - // The ID of the location of the merchant associated with the payment refund activity - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` +type RetrieveInventoryCountRequest struct { + // The [Location](entity:Location) IDs to look up as a comma-separated + // list. An empty list queries all locations. + LocationIDs *string `json:"location_ids,omitempty" 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:"cursor,omitempty" url:"cursor,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PaymentBalanceActivityAppFeeRefundDetail) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (r *RetrieveInventoryCountRequest) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (p *PaymentBalanceActivityAppFeeRefundDetail) UnmarshalJSON(data []byte) error { - type unmarshaler PaymentBalanceActivityAppFeeRefundDetail +func (r *RetrieveInventoryCountRequest) UnmarshalJSON(data []byte) error { + type unmarshaler RetrieveInventoryCountRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PaymentBalanceActivityAppFeeRefundDetail(value) + *r = RetrieveInventoryCountRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - p.extraProperties = extraProperties + r.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (p *PaymentBalanceActivityAppFeeRefundDetail) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (r *RetrieveInventoryCountRequest) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", r) } -type PaymentBalanceActivityAppFeeRevenueDetail struct { - // The ID of the payment associated with this activity. - PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` - // The ID of the location of the merchant associated with the payment activity - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` - +type RetrieveLocationBookingProfileRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PaymentBalanceActivityAppFeeRevenueDetail) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (r *RetrieveLocationBookingProfileRequest) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (p *PaymentBalanceActivityAppFeeRevenueDetail) UnmarshalJSON(data []byte) error { - type unmarshaler PaymentBalanceActivityAppFeeRevenueDetail +func (r *RetrieveLocationBookingProfileRequest) UnmarshalJSON(data []byte) error { + type unmarshaler RetrieveLocationBookingProfileRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PaymentBalanceActivityAppFeeRevenueDetail(value) + *r = RetrieveLocationBookingProfileRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - p.extraProperties = extraProperties + r.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (p *PaymentBalanceActivityAppFeeRevenueDetail) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (r *RetrieveLocationBookingProfileRequest) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", r) } -type PaymentBalanceActivityAutomaticSavingsDetail struct { - // The ID of the payment associated with this activity. - PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` - // The ID of the payout associated with this activity. - PayoutID *string `json:"payout_id,omitempty" url:"payout_id,omitempty"` +type RetrieveLocationBookingProfileResponse struct { + // The requested location booking profile. + LocationBookingProfile *LocationBookingProfile `json:"location_booking_profile,omitempty" url:"location_booking_profile,omitempty"` + // Errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PaymentBalanceActivityAutomaticSavingsDetail) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (r *RetrieveLocationBookingProfileResponse) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (p *PaymentBalanceActivityAutomaticSavingsDetail) UnmarshalJSON(data []byte) error { - type unmarshaler PaymentBalanceActivityAutomaticSavingsDetail +func (r *RetrieveLocationBookingProfileResponse) UnmarshalJSON(data []byte) error { + type unmarshaler RetrieveLocationBookingProfileResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PaymentBalanceActivityAutomaticSavingsDetail(value) + *r = RetrieveLocationBookingProfileResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - p.extraProperties = extraProperties + r.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (p *PaymentBalanceActivityAutomaticSavingsDetail) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (r *RetrieveLocationBookingProfileResponse) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", r) } -type PaymentBalanceActivityAutomaticSavingsReversedDetail struct { - // The ID of the payment associated with this activity. - PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` - // The ID of the payout associated with this activity. - PayoutID *string `json:"payout_id,omitempty" url:"payout_id,omitempty"` +// Represents a [RetrieveLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-RetrieveLocationCustomAttributeDefinition) response. +// Either `custom_attribute_definition` or `errors` is present in the response. +type RetrieveLocationCustomAttributeDefinitionResponse struct { + // The retrieved custom attribute definition. + CustomAttributeDefinition *CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"custom_attribute_definition,omitempty"` + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PaymentBalanceActivityAutomaticSavingsReversedDetail) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (r *RetrieveLocationCustomAttributeDefinitionResponse) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (p *PaymentBalanceActivityAutomaticSavingsReversedDetail) UnmarshalJSON(data []byte) error { - type unmarshaler PaymentBalanceActivityAutomaticSavingsReversedDetail +func (r *RetrieveLocationCustomAttributeDefinitionResponse) UnmarshalJSON(data []byte) error { + type unmarshaler RetrieveLocationCustomAttributeDefinitionResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PaymentBalanceActivityAutomaticSavingsReversedDetail(value) + *r = RetrieveLocationCustomAttributeDefinitionResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - p.extraProperties = extraProperties + r.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (p *PaymentBalanceActivityAutomaticSavingsReversedDetail) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (r *RetrieveLocationCustomAttributeDefinitionResponse) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", r) } -type PaymentBalanceActivityChargeDetail struct { - // The ID of the payment associated with this activity. - PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` +// Represents a [RetrieveLocationCustomAttribute](api-endpoint:LocationCustomAttributes-RetrieveLocationCustomAttribute) response. +// Either `custom_attribute_definition` or `errors` is present in the response. +type RetrieveLocationCustomAttributeResponse struct { + // The retrieved custom attribute. If `with_definition` was set to `true` in the request, + // the custom attribute definition is returned in the `definition` field. + CustomAttribute *CustomAttribute `json:"custom_attribute,omitempty" url:"custom_attribute,omitempty"` + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PaymentBalanceActivityChargeDetail) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (r *RetrieveLocationCustomAttributeResponse) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (p *PaymentBalanceActivityChargeDetail) UnmarshalJSON(data []byte) error { - type unmarshaler PaymentBalanceActivityChargeDetail +func (r *RetrieveLocationCustomAttributeResponse) UnmarshalJSON(data []byte) error { + type unmarshaler RetrieveLocationCustomAttributeResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PaymentBalanceActivityChargeDetail(value) + *r = RetrieveLocationCustomAttributeResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - p.extraProperties = extraProperties + r.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (p *PaymentBalanceActivityChargeDetail) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (r *RetrieveLocationCustomAttributeResponse) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", r) } -type PaymentBalanceActivityDepositFeeDetail struct { - // The ID of the payout that triggered this deposit fee activity. - PayoutID *string `json:"payout_id,omitempty" url:"payout_id,omitempty"` - +type RetrieveLocationSettingsRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PaymentBalanceActivityDepositFeeDetail) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (r *RetrieveLocationSettingsRequest) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (p *PaymentBalanceActivityDepositFeeDetail) UnmarshalJSON(data []byte) error { - type unmarshaler PaymentBalanceActivityDepositFeeDetail +func (r *RetrieveLocationSettingsRequest) UnmarshalJSON(data []byte) error { + type unmarshaler RetrieveLocationSettingsRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PaymentBalanceActivityDepositFeeDetail(value) + *r = RetrieveLocationSettingsRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - p.extraProperties = extraProperties + r.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (p *PaymentBalanceActivityDepositFeeDetail) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (r *RetrieveLocationSettingsRequest) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", r) } -type PaymentBalanceActivityDisputeDetail struct { - // The ID of the payment associated with this activity. - PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` - // The ID of the dispute associated with this activity. - DisputeID *string `json:"dispute_id,omitempty" url:"dispute_id,omitempty"` +type RetrieveLocationSettingsResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The location settings. + LocationSettings *CheckoutLocationSettings `json:"location_settings,omitempty" url:"location_settings,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PaymentBalanceActivityDisputeDetail) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (r *RetrieveLocationSettingsResponse) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (p *PaymentBalanceActivityDisputeDetail) UnmarshalJSON(data []byte) error { - type unmarshaler PaymentBalanceActivityDisputeDetail +func (r *RetrieveLocationSettingsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler RetrieveLocationSettingsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PaymentBalanceActivityDisputeDetail(value) + *r = RetrieveLocationSettingsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - p.extraProperties = extraProperties + r.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (p *PaymentBalanceActivityDisputeDetail) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (r *RetrieveLocationSettingsResponse) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", r) } -type PaymentBalanceActivityFeeDetail struct { - // The ID of the payment associated with this activity - // This will only be populated when a principal LedgerEntryToken is also populated. - // If the fee is independent (there is no principal LedgerEntryToken) then this will likely not - // be populated. - PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` +// Represents a [RetrieveMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-RetrieveMerchantCustomAttributeDefinition) response. +// Either `custom_attribute_definition` or `errors` is present in the response. +type RetrieveMerchantCustomAttributeDefinitionResponse struct { + // The retrieved custom attribute definition. + CustomAttributeDefinition *CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"custom_attribute_definition,omitempty"` + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PaymentBalanceActivityFeeDetail) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (r *RetrieveMerchantCustomAttributeDefinitionResponse) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (p *PaymentBalanceActivityFeeDetail) UnmarshalJSON(data []byte) error { - type unmarshaler PaymentBalanceActivityFeeDetail +func (r *RetrieveMerchantCustomAttributeDefinitionResponse) UnmarshalJSON(data []byte) error { + type unmarshaler RetrieveMerchantCustomAttributeDefinitionResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PaymentBalanceActivityFeeDetail(value) + *r = RetrieveMerchantCustomAttributeDefinitionResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - p.extraProperties = extraProperties + r.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (p *PaymentBalanceActivityFeeDetail) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (r *RetrieveMerchantCustomAttributeDefinitionResponse) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", r) } -type PaymentBalanceActivityFreeProcessingDetail struct { - // The ID of the payment associated with this activity. - PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` +// Represents a [RetrieveMerchantCustomAttribute](api-endpoint:MerchantCustomAttributes-RetrieveMerchantCustomAttribute) response. +// Either `custom_attribute_definition` or `errors` is present in the response. +type RetrieveMerchantCustomAttributeResponse struct { + // The retrieved custom attribute. If `with_definition` was set to `true` in the request, + // the custom attribute definition is returned in the `definition` field. + CustomAttribute *CustomAttribute `json:"custom_attribute,omitempty" url:"custom_attribute,omitempty"` + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PaymentBalanceActivityFreeProcessingDetail) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (r *RetrieveMerchantCustomAttributeResponse) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (p *PaymentBalanceActivityFreeProcessingDetail) UnmarshalJSON(data []byte) error { - type unmarshaler PaymentBalanceActivityFreeProcessingDetail +func (r *RetrieveMerchantCustomAttributeResponse) UnmarshalJSON(data []byte) error { + type unmarshaler RetrieveMerchantCustomAttributeResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PaymentBalanceActivityFreeProcessingDetail(value) + *r = RetrieveMerchantCustomAttributeResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - p.extraProperties = extraProperties + r.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (p *PaymentBalanceActivityFreeProcessingDetail) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (r *RetrieveMerchantCustomAttributeResponse) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", r) } -type PaymentBalanceActivityHoldAdjustmentDetail struct { - // The ID of the payment associated with this activity. - PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` - +type RetrieveMerchantSettingsRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PaymentBalanceActivityHoldAdjustmentDetail) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (r *RetrieveMerchantSettingsRequest) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (p *PaymentBalanceActivityHoldAdjustmentDetail) UnmarshalJSON(data []byte) error { - type unmarshaler PaymentBalanceActivityHoldAdjustmentDetail +func (r *RetrieveMerchantSettingsRequest) UnmarshalJSON(data []byte) error { + type unmarshaler RetrieveMerchantSettingsRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PaymentBalanceActivityHoldAdjustmentDetail(value) + *r = RetrieveMerchantSettingsRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - p.extraProperties = extraProperties + r.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (p *PaymentBalanceActivityHoldAdjustmentDetail) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (r *RetrieveMerchantSettingsRequest) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", r) } -type PaymentBalanceActivityOpenDisputeDetail struct { - // The ID of the payment associated with this activity. - PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` - // The ID of the dispute associated with this activity. - DisputeID *string `json:"dispute_id,omitempty" url:"dispute_id,omitempty"` +type RetrieveMerchantSettingsResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The merchant settings. + MerchantSettings *CheckoutMerchantSettings `json:"merchant_settings,omitempty" url:"merchant_settings,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PaymentBalanceActivityOpenDisputeDetail) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (r *RetrieveMerchantSettingsResponse) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (p *PaymentBalanceActivityOpenDisputeDetail) UnmarshalJSON(data []byte) error { - type unmarshaler PaymentBalanceActivityOpenDisputeDetail +func (r *RetrieveMerchantSettingsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler RetrieveMerchantSettingsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PaymentBalanceActivityOpenDisputeDetail(value) + *r = RetrieveMerchantSettingsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - p.extraProperties = extraProperties + r.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (p *PaymentBalanceActivityOpenDisputeDetail) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (r *RetrieveMerchantSettingsResponse) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", r) } -type PaymentBalanceActivityOtherAdjustmentDetail struct { - // The ID of the payment associated with this activity. - PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` +// Represents a response from getting an order custom attribute definition. +type RetrieveOrderCustomAttributeDefinitionResponse struct { + // The retrieved custom attribute definition. + CustomAttributeDefinition *CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"custom_attribute_definition,omitempty"` + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PaymentBalanceActivityOtherAdjustmentDetail) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (r *RetrieveOrderCustomAttributeDefinitionResponse) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (p *PaymentBalanceActivityOtherAdjustmentDetail) UnmarshalJSON(data []byte) error { - type unmarshaler PaymentBalanceActivityOtherAdjustmentDetail +func (r *RetrieveOrderCustomAttributeDefinitionResponse) UnmarshalJSON(data []byte) error { + type unmarshaler RetrieveOrderCustomAttributeDefinitionResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PaymentBalanceActivityOtherAdjustmentDetail(value) + *r = RetrieveOrderCustomAttributeDefinitionResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - p.extraProperties = extraProperties + r.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (p *PaymentBalanceActivityOtherAdjustmentDetail) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (r *RetrieveOrderCustomAttributeDefinitionResponse) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", r) } -type PaymentBalanceActivityOtherDetail struct { - // The ID of the payment associated with this activity. - PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` +// Represents a response from getting an order custom attribute. +type RetrieveOrderCustomAttributeResponse struct { + // The retrieved custom attribute. If `with_definition` was set to `true` in the request, the custom attribute definition is returned in the `definition field. + CustomAttribute *CustomAttribute `json:"custom_attribute,omitempty" url:"custom_attribute,omitempty"` + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PaymentBalanceActivityOtherDetail) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (r *RetrieveOrderCustomAttributeResponse) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (p *PaymentBalanceActivityOtherDetail) UnmarshalJSON(data []byte) error { - type unmarshaler PaymentBalanceActivityOtherDetail +func (r *RetrieveOrderCustomAttributeResponse) UnmarshalJSON(data []byte) error { + type unmarshaler RetrieveOrderCustomAttributeResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PaymentBalanceActivityOtherDetail(value) + *r = RetrieveOrderCustomAttributeResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - p.extraProperties = extraProperties + r.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (p *PaymentBalanceActivityOtherDetail) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (r *RetrieveOrderCustomAttributeResponse) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", r) } -type PaymentBalanceActivityRefundDetail struct { - // The ID of the payment associated with this activity. - PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` - // The ID of the refund associated with this activity. - RefundID *string `json:"refund_id,omitempty" url:"refund_id,omitempty"` +// Defines input parameters in a request to the +// [RetrieveSubscription](api-endpoint:Subscriptions-RetrieveSubscription) endpoint. +type RetrieveSubscriptionRequest struct { + // A query parameter to specify related information to be included in the response. + // + // The supported query parameter values are: + // + // - `actions`: to include scheduled actions on the targeted subscription. + Include *string `json:"include,omitempty" url:"include,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PaymentBalanceActivityRefundDetail) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (r *RetrieveSubscriptionRequest) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (p *PaymentBalanceActivityRefundDetail) UnmarshalJSON(data []byte) error { - type unmarshaler PaymentBalanceActivityRefundDetail +func (r *RetrieveSubscriptionRequest) UnmarshalJSON(data []byte) error { + type unmarshaler RetrieveSubscriptionRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PaymentBalanceActivityRefundDetail(value) + *r = RetrieveSubscriptionRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - p.extraProperties = extraProperties + r.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (p *PaymentBalanceActivityRefundDetail) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (r *RetrieveSubscriptionRequest) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", r) } -type PaymentBalanceActivityReleaseAdjustmentDetail struct { - // The ID of the payment associated with this activity. - PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` - +// Request object for [RetrieveTokenStatus] endpoint. +type RetrieveTokenStatusRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PaymentBalanceActivityReleaseAdjustmentDetail) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (r *RetrieveTokenStatusRequest) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (p *PaymentBalanceActivityReleaseAdjustmentDetail) UnmarshalJSON(data []byte) error { - type unmarshaler PaymentBalanceActivityReleaseAdjustmentDetail +func (r *RetrieveTokenStatusRequest) UnmarshalJSON(data []byte) error { + type unmarshaler RetrieveTokenStatusRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PaymentBalanceActivityReleaseAdjustmentDetail(value) + *r = RetrieveTokenStatusRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - p.extraProperties = extraProperties + r.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (p *PaymentBalanceActivityReleaseAdjustmentDetail) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (r *RetrieveTokenStatusRequest) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", r) } -type PaymentBalanceActivityReserveHoldDetail struct { - // The ID of the payment associated with this activity. - PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` +// Defines the fields that are included in the response body of +// a request to the `RetrieveTokenStatus` endpoint. +type RetrieveTokenStatusResponse struct { + // The list of scopes associated with an access token. + Scopes []string `json:"scopes,omitempty" url:"scopes,omitempty"` + // The date and time when the `access_token` expires, in RFC 3339 format. Empty if the token never expires. + ExpiresAt *string `json:"expires_at,omitempty" url:"expires_at,omitempty"` + // The Square-issued application ID associated with the access token. This is the same application ID used to obtain the token. + ClientID *string `json:"client_id,omitempty" url:"client_id,omitempty"` + // The ID of the authorizing merchant's business. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PaymentBalanceActivityReserveHoldDetail) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (r *RetrieveTokenStatusResponse) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (p *PaymentBalanceActivityReserveHoldDetail) UnmarshalJSON(data []byte) error { - type unmarshaler PaymentBalanceActivityReserveHoldDetail +func (r *RetrieveTokenStatusResponse) UnmarshalJSON(data []byte) error { + type unmarshaler RetrieveTokenStatusResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PaymentBalanceActivityReserveHoldDetail(value) + *r = RetrieveTokenStatusResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - p.extraProperties = extraProperties + r.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (p *PaymentBalanceActivityReserveHoldDetail) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (r *RetrieveTokenStatusResponse) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", r) } -type PaymentBalanceActivityReserveReleaseDetail struct { - // The ID of the payment associated with this activity. - PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` +type RevokeTokenResponse struct { + // If the request is successful, this is `true`. + Success *bool `json:"success,omitempty" url:"success,omitempty"` + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PaymentBalanceActivityReserveReleaseDetail) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (r *RevokeTokenResponse) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (p *PaymentBalanceActivityReserveReleaseDetail) UnmarshalJSON(data []byte) error { - type unmarshaler PaymentBalanceActivityReserveReleaseDetail +func (r *RevokeTokenResponse) UnmarshalJSON(data []byte) error { + type unmarshaler RevokeTokenResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PaymentBalanceActivityReserveReleaseDetail(value) + *r = RevokeTokenResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - p.extraProperties = extraProperties + r.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (p *PaymentBalanceActivityReserveReleaseDetail) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (r *RevokeTokenResponse) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", r) } -type PaymentBalanceActivitySquareCapitalPaymentDetail struct { - // The ID of the payment associated with this activity. - PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` +// Represents fraud risk information for the associated payment. +// +// When you take a payment through Square's Payments API (using the `CreatePayment` +// endpoint), Square evaluates it and assigns a risk level to the payment. Sellers +// can use this information to determine the course of action (for example, +// provide the goods/services or refund the payment). +type RiskEvaluation struct { + // The timestamp when payment risk was evaluated, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The risk level associated with the payment + // See [RiskEvaluationRiskLevel](#type-riskevaluationrisklevel) for possible values + RiskLevel *RiskEvaluationRiskLevel `json:"risk_level,omitempty" url:"risk_level,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PaymentBalanceActivitySquareCapitalPaymentDetail) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (r *RiskEvaluation) GetExtraProperties() map[string]interface{} { + return r.extraProperties } -func (p *PaymentBalanceActivitySquareCapitalPaymentDetail) UnmarshalJSON(data []byte) error { - type unmarshaler PaymentBalanceActivitySquareCapitalPaymentDetail +func (r *RiskEvaluation) UnmarshalJSON(data []byte) error { + type unmarshaler RiskEvaluation var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PaymentBalanceActivitySquareCapitalPaymentDetail(value) + *r = RiskEvaluation(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *r) if err != nil { return err } - p.extraProperties = extraProperties + r.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + r._rawJSON = json.RawMessage(data) return nil } -func (p *PaymentBalanceActivitySquareCapitalPaymentDetail) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (r *RiskEvaluation) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", r) } -type PaymentBalanceActivitySquareCapitalReversedPaymentDetail struct { - // The ID of the payment associated with this activity. - PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` +type RiskEvaluationRiskLevel string + +const ( + RiskEvaluationRiskLevelDoNotUse RiskEvaluationRiskLevel = "DO_NOT_USE" + RiskEvaluationRiskLevelPending RiskEvaluationRiskLevel = "PENDING" + RiskEvaluationRiskLevelNormal RiskEvaluationRiskLevel = "NORMAL" + RiskEvaluationRiskLevelModerate RiskEvaluationRiskLevel = "MODERATE" + RiskEvaluationRiskLevelHigh RiskEvaluationRiskLevel = "HIGH" +) + +func NewRiskEvaluationRiskLevelFromString(s string) (RiskEvaluationRiskLevel, error) { + switch s { + case "DO_NOT_USE": + return RiskEvaluationRiskLevelDoNotUse, nil + case "PENDING": + return RiskEvaluationRiskLevelPending, nil + case "NORMAL": + return RiskEvaluationRiskLevelNormal, nil + case "MODERATE": + return RiskEvaluationRiskLevelModerate, nil + case "HIGH": + return RiskEvaluationRiskLevelHigh, nil + } + var t RiskEvaluationRiskLevel + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (r RiskEvaluationRiskLevel) Ptr() *RiskEvaluationRiskLevel { + return &r +} + +// Describes save-card action fields. +type SaveCardOptions struct { + // The square-assigned ID of the customer linked to the saved card. + CustomerID string `json:"customer_id" url:"customer_id"` + // The id of the created card-on-file. + CardID *string `json:"card_id,omitempty" url:"card_id,omitempty"` + // An optional user-defined reference ID that can be used to associate + // this `Card` to another entity in an external system. For example, a customer + // ID generated by a third-party system. + ReferenceID *string `json:"reference_id,omitempty" url:"reference_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PaymentBalanceActivitySquareCapitalReversedPaymentDetail) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (s *SaveCardOptions) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (p *PaymentBalanceActivitySquareCapitalReversedPaymentDetail) UnmarshalJSON(data []byte) error { - type unmarshaler PaymentBalanceActivitySquareCapitalReversedPaymentDetail +func (s *SaveCardOptions) UnmarshalJSON(data []byte) error { + type unmarshaler SaveCardOptions var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PaymentBalanceActivitySquareCapitalReversedPaymentDetail(value) + *s = SaveCardOptions(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - p.extraProperties = extraProperties + s.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (p *PaymentBalanceActivitySquareCapitalReversedPaymentDetail) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (s *SaveCardOptions) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", s) } -type PaymentBalanceActivityTaxOnFeeDetail struct { - // The ID of the payment associated with this activity. - PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` - // The description of the tax rate being applied. For example: "GST", "HST". - TaxRateDescription *string `json:"tax_rate_description,omitempty" url:"tax_rate_description,omitempty"` +// A query filter to search for buyer-accessible availabilities by. +type SearchAvailabilityFilter struct { + // The query expression to search for buy-accessible availabilities with their starting times falling within the specified time range. + // The time range must be at least 24 hours and at most 32 days long. + // For waitlist availabilities, the time range can be 0 or more up to 367 days long. + StartAtRange *TimeRange `json:"start_at_range,omitempty" url:"start_at_range,omitempty"` + // The query expression to search for buyer-accessible availabilities with their location IDs matching the specified location ID. + // This query expression cannot be set if `booking_id` is set. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The query expression to search for buyer-accessible availabilities matching the specified list of segment filters. + // If the size of the `segment_filters` list is `n`, the search returns availabilities with `n` segments per availability. + // + // This query expression cannot be set if `booking_id` is set. + SegmentFilters []*SegmentFilter `json:"segment_filters,omitempty" url:"segment_filters,omitempty"` + // The query expression to search for buyer-accessible availabilities for an existing booking by matching the specified `booking_id` value. + // This is commonly used to reschedule an appointment. + // If this expression is set, the `location_id` and `segment_filters` expressions cannot be set. + BookingID *string `json:"booking_id,omitempty" url:"booking_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PaymentBalanceActivityTaxOnFeeDetail) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (s *SearchAvailabilityFilter) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (p *PaymentBalanceActivityTaxOnFeeDetail) UnmarshalJSON(data []byte) error { - type unmarshaler PaymentBalanceActivityTaxOnFeeDetail +func (s *SearchAvailabilityFilter) UnmarshalJSON(data []byte) error { + type unmarshaler SearchAvailabilityFilter var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PaymentBalanceActivityTaxOnFeeDetail(value) + *s = SearchAvailabilityFilter(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - p.extraProperties = extraProperties + s.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (p *PaymentBalanceActivityTaxOnFeeDetail) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (s *SearchAvailabilityFilter) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", s) } -type PaymentBalanceActivityThirdPartyFeeDetail struct { - // The ID of the payment associated with this activity. - PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` +// The query used to search for buyer-accessible availabilities of bookings. +type SearchAvailabilityQuery struct { + // The query filter to search for buyer-accessible availabilities of existing bookings. + Filter *SearchAvailabilityFilter `json:"filter,omitempty" url:"filter,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PaymentBalanceActivityThirdPartyFeeDetail) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (s *SearchAvailabilityQuery) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (p *PaymentBalanceActivityThirdPartyFeeDetail) UnmarshalJSON(data []byte) error { - type unmarshaler PaymentBalanceActivityThirdPartyFeeDetail +func (s *SearchAvailabilityQuery) UnmarshalJSON(data []byte) error { + type unmarshaler SearchAvailabilityQuery var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PaymentBalanceActivityThirdPartyFeeDetail(value) + *s = SearchAvailabilityQuery(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - p.extraProperties = extraProperties + s.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (p *PaymentBalanceActivityThirdPartyFeeDetail) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (s *SearchAvailabilityQuery) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", s) } -type PaymentBalanceActivityThirdPartyFeeRefundDetail struct { - // The ID of the payment associated with this activity. - PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` - // The public refund id associated with this activity. - RefundID *string `json:"refund_id,omitempty" url:"refund_id,omitempty"` +type SearchAvailabilityResponse struct { + // List of appointment slots available for booking. + Availabilities []*Availability `json:"availabilities,omitempty" url:"availabilities,omitempty"` + // Errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PaymentBalanceActivityThirdPartyFeeRefundDetail) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (s *SearchAvailabilityResponse) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (p *PaymentBalanceActivityThirdPartyFeeRefundDetail) UnmarshalJSON(data []byte) error { - type unmarshaler PaymentBalanceActivityThirdPartyFeeRefundDetail +func (s *SearchAvailabilityResponse) UnmarshalJSON(data []byte) error { + type unmarshaler SearchAvailabilityResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PaymentBalanceActivityThirdPartyFeeRefundDetail(value) + *s = SearchAvailabilityResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - p.extraProperties = extraProperties + s.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (p *PaymentBalanceActivityThirdPartyFeeRefundDetail) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (s *SearchAvailabilityResponse) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", s) } -type PaymentLink struct { - // The Square-assigned ID of the payment link. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The Square-assigned version number, which is incremented each time an update is committed to the payment link. - Version int `json:"version" url:"version"` - // The optional description of the `payment_link` object. - // It is primarily for use by your application and is not used anywhere. - Description *string `json:"description,omitempty" url:"description,omitempty"` - // The ID of the order associated with the payment link. - OrderID *string `json:"order_id,omitempty" url:"order_id,omitempty"` - // The checkout options configured for the payment link. - // For more information, see [Optional Checkout Configurations](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations). - CheckoutOptions *CheckoutOptions `json:"checkout_options,omitempty" url:"checkout_options,omitempty"` - // Describes buyer data to prepopulate - // on the checkout page. - PrePopulatedData *PrePopulatedData `json:"pre_populated_data,omitempty" url:"pre_populated_data,omitempty"` - // The shortened URL of the payment link. - URL *string `json:"url,omitempty" url:"url,omitempty"` - // The long URL of the payment link. - LongURL *string `json:"long_url,omitempty" url:"long_url,omitempty"` - // The timestamp when the payment link was created, in RFC 3339 format. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The timestamp when the payment link was last updated, in RFC 3339 format. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` - // An optional note. After Square processes the payment, this note is added to the - // resulting `Payment`. - PaymentNote *string `json:"payment_note,omitempty" url:"payment_note,omitempty"` +// Defines supported stock levels of the item inventory. +type SearchCatalogItemsRequestStockLevel string + +const ( + SearchCatalogItemsRequestStockLevelStockLevelDoNotUse SearchCatalogItemsRequestStockLevel = "STOCK_LEVEL_DO_NOT_USE" + SearchCatalogItemsRequestStockLevelOut SearchCatalogItemsRequestStockLevel = "OUT" + SearchCatalogItemsRequestStockLevelLow SearchCatalogItemsRequestStockLevel = "LOW" +) + +func NewSearchCatalogItemsRequestStockLevelFromString(s string) (SearchCatalogItemsRequestStockLevel, error) { + switch s { + case "STOCK_LEVEL_DO_NOT_USE": + return SearchCatalogItemsRequestStockLevelStockLevelDoNotUse, nil + case "OUT": + return SearchCatalogItemsRequestStockLevelOut, nil + case "LOW": + return SearchCatalogItemsRequestStockLevelLow, nil + } + var t SearchCatalogItemsRequestStockLevel + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SearchCatalogItemsRequestStockLevel) Ptr() *SearchCatalogItemsRequestStockLevel { + return &s +} + +// Defines the response body returned from the [SearchCatalogItems](api-endpoint:Catalog-SearchCatalogItems) endpoint. +type SearchCatalogItemsResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // Returned items matching the specified query expressions. + Items []*CatalogObject `json:"items,omitempty" url:"items,omitempty"` + // Pagination token used in the next request to return more of the search result. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // Ids of returned item variations matching the specified query expression. + MatchedVariationIDs []string `json:"matched_variation_ids,omitempty" url:"matched_variation_ids,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PaymentLink) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (s *SearchCatalogItemsResponse) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (p *PaymentLink) UnmarshalJSON(data []byte) error { - type unmarshaler PaymentLink +func (s *SearchCatalogItemsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler SearchCatalogItemsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PaymentLink(value) + *s = SearchCatalogItemsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - p.extraProperties = extraProperties + s.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (p *PaymentLink) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (s *SearchCatalogItemsResponse) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", s) } -type PaymentLinkRelatedResources struct { - // The order associated with the payment link. - Orders []*Order `json:"orders,omitempty" url:"orders,omitempty"` - // The subscription plan associated with the payment link. - SubscriptionPlans []*CatalogObject `json:"subscription_plans,omitempty" url:"subscription_plans,omitempty"` +type SearchCatalogObjectsResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The pagination cursor to be used in a subsequent request. If unset, this is the final response. + // See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // The CatalogObjects returned. + Objects []*CatalogObject `json:"objects,omitempty" url:"objects,omitempty"` + // A list of CatalogObjects referenced by the objects in the `objects` field. + RelatedObjects []*CatalogObject `json:"related_objects,omitempty" url:"related_objects,omitempty"` + // When the associated product catalog was last updated. Will + // match the value for `end_time` or `cursor` if either field is included in the `SearchCatalog` request. + LatestTime *string `json:"latest_time,omitempty" url:"latest_time,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PaymentLinkRelatedResources) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (s *SearchCatalogObjectsResponse) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (p *PaymentLinkRelatedResources) UnmarshalJSON(data []byte) error { - type unmarshaler PaymentLinkRelatedResources +func (s *SearchCatalogObjectsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler SearchCatalogObjectsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PaymentLinkRelatedResources(value) + *s = SearchCatalogObjectsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - p.extraProperties = extraProperties + s.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (p *PaymentLinkRelatedResources) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (s *SearchCatalogObjectsResponse) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", s) } -type PaymentOptions struct { - // Indicates whether the `Payment` objects created from this `TerminalCheckout` are automatically - // `COMPLETED` or left in an `APPROVED` state for later modification. - Autocomplete *bool `json:"autocomplete,omitempty" url:"autocomplete,omitempty"` - // The duration of time after the payment's creation when Square automatically cancels the - // payment. This automatic cancellation applies only to payments that do not reach a terminal state - // (COMPLETED or CANCELED) before the `delay_duration` time period. - // - // This parameter should be specified as a time duration, in RFC 3339 format, with a minimum value - // of 1 minute. - // - // Note: This feature is only supported for card payments. This parameter can only be set for a delayed - // capture payment (`autocomplete=false`). - // Default: - // - // - Card-present payments: "PT36H" (36 hours) from the creation time. - // - Card-not-present payments: "P7D" (7 days) from the creation time. - DelayDuration *string `json:"delay_duration,omitempty" url:"delay_duration,omitempty"` - // If set to `true` and charging a Square Gift Card, a payment might be returned with - // `amount_money` equal to less than what was requested. For example, a request for $20 when charging - // a Square Gift Card with a balance of $5 results in an APPROVED payment of $5. You might choose - // to prompt the buyer for an additional payment to cover the remainder or cancel the Gift Card - // payment. - // - // This field cannot be `true` when `autocomplete = true`. - // This field cannot be `true` when an `order_id` isn't specified. - // - // For more information, see - // [Take Partial Payments](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/partial-payments-with-gift-cards). - // - // Default: false - AcceptPartialAuthorization *bool `json:"accept_partial_authorization,omitempty" url:"accept_partial_authorization,omitempty"` - // The action to be applied to the payment when the delay_duration has elapsed. - // The action must be CANCEL or COMPLETE. +// Defines the fields that are included in the response body of +// a request to the `SearchCustomers` endpoint. +// +// Either `errors` or `customers` is present in a given response (never both). +type SearchCustomersResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The customer profiles that match the search query. If any search condition is not met, the result is an empty object (`{}`). + // Only customer profiles with public information (`given_name`, `family_name`, `company_name`, `email_address`, or `phone_number`) + // are included in the response. + Customers []*Customer `json:"customers,omitempty" url:"customers,omitempty"` + // A pagination cursor that can be used during subsequent calls + // to `SearchCustomers` to retrieve the next set of results associated + // with the original query. Pagination cursors are only present when + // a request succeeds and additional results are available. // - // This parameter can only be set for a delayed capture payment (when `autocomplete` is `false`). - // See [DelayAction](#type-delayaction) for possible values - DelayAction *PaymentOptionsDelayAction `json:"delay_action,omitempty" url:"delay_action,omitempty"` + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // The total count of customers associated with the Square account that match the search query. Only customer profiles with + // public information (`given_name`, `family_name`, `company_name`, `email_address`, or `phone_number`) are counted. This field is + // present only if `count` is set to `true` in the request. + Count *int64 `json:"count,omitempty" url:"count,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } - -func (p *PaymentOptions) GetExtraProperties() map[string]interface{} { - return p.extraProperties + +func (s *SearchCustomersResponse) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (p *PaymentOptions) UnmarshalJSON(data []byte) error { - type unmarshaler PaymentOptions +func (s *SearchCustomersResponse) UnmarshalJSON(data []byte) error { + type unmarshaler SearchCustomersResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PaymentOptions(value) + *s = SearchCustomersResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - p.extraProperties = extraProperties + s.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (p *PaymentOptions) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (s *SearchCustomersResponse) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", p) -} - -// Describes the action to be applied to a delayed capture payment when the delay_duration -// has elapsed. -type PaymentOptionsDelayAction string - -const ( - PaymentOptionsDelayActionCancel PaymentOptionsDelayAction = "CANCEL" - PaymentOptionsDelayActionComplete PaymentOptionsDelayAction = "COMPLETE" -) - -func NewPaymentOptionsDelayActionFromString(s string) (PaymentOptionsDelayAction, error) { - switch s { - case "CANCEL": - return PaymentOptionsDelayActionCancel, nil - case "COMPLETE": - return PaymentOptionsDelayActionComplete, nil - } - var t PaymentOptionsDelayAction - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (p PaymentOptionsDelayAction) Ptr() *PaymentOptionsDelayAction { - return &p + return fmt.Sprintf("%#v", s) } -// Represents a refund of a payment made using Square. Contains information about -// the original payment and the amount of money refunded. -type PaymentRefund struct { - // The unique ID for this refund, generated by Square. - ID string `json:"id" url:"id"` - // The refund's status: - // - // - `PENDING` - Awaiting approval. - // - `COMPLETED` - Successfully completed. - // - `REJECTED` - The refund was rejected. - // - `FAILED` - An error occurred. - Status *string `json:"status,omitempty" url:"status,omitempty"` - // The location ID associated with the payment this refund is attached to. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` - // Flag indicating whether or not the refund is linked to an existing payment in Square. - Unlinked *bool `json:"unlinked,omitempty" url:"unlinked,omitempty"` - // The destination type for this refund. - // - // Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `BUY_NOW_PAY_LATER`, `CASH`, - // `EXTERNAL`, and `SQUARE_ACCOUNT`. - DestinationType *string `json:"destination_type,omitempty" url:"destination_type,omitempty"` - // Contains information about the refund destination. This field is populated only if - // `destination_id` is defined in the `RefundPayment` request. - DestinationDetails *DestinationDetails `json:"destination_details,omitempty" url:"destination_details,omitempty"` - // The amount of money refunded. This amount is specified in the smallest denomination - // of the applicable currency (for example, US dollar amounts are specified in cents). - AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` - // The amount of money the application developer contributed to help cover the refunded amount. - // This amount is specified in the smallest denomination of the applicable currency (for example, - // US dollar amounts are specified in cents). For more information, see - // [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts). - AppFeeMoney *Money `json:"app_fee_money,omitempty" url:"app_fee_money,omitempty"` - // Processing fees and fee adjustments assessed by Square for this refund. - ProcessingFee []*ProcessingFee `json:"processing_fee,omitempty" url:"processing_fee,omitempty"` - // The ID of the payment associated with this refund. - PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` - // The ID of the order associated with the refund. - OrderID *string `json:"order_id,omitempty" url:"order_id,omitempty"` - // The reason for the refund. - Reason *string `json:"reason,omitempty" url:"reason,omitempty"` - // The timestamp of when the refund was created, in RFC 3339 format. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The timestamp of when the refund was last updated, in RFC 3339 format. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` - // An optional ID of the team member associated with taking the payment. - TeamMemberID *string `json:"team_member_id,omitempty" url:"team_member_id,omitempty"` +// Criteria to filter events by. +type SearchEventsFilter struct { + // Filter events by event types. + EventTypes []string `json:"event_types,omitempty" url:"event_types,omitempty"` + // Filter events by merchant. + MerchantIDs []string `json:"merchant_ids,omitempty" url:"merchant_ids,omitempty"` + // Filter events by location. + LocationIDs []string `json:"location_ids,omitempty" url:"location_ids,omitempty"` + // Filter events by when they were created. + CreatedAt *TimeRange `json:"created_at,omitempty" url:"created_at,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PaymentRefund) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (s *SearchEventsFilter) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (p *PaymentRefund) UnmarshalJSON(data []byte) error { - type unmarshaler PaymentRefund +func (s *SearchEventsFilter) UnmarshalJSON(data []byte) error { + type unmarshaler SearchEventsFilter var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PaymentRefund(value) + *s = SearchEventsFilter(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - p.extraProperties = extraProperties + s.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (p *PaymentRefund) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (s *SearchEventsFilter) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", s) } -// An accounting of the amount owed the seller and record of the actual transfer to their -// external bank account or to the Square balance. -type Payout struct { - // A unique ID for the payout. - ID string `json:"id" url:"id"` - // Indicates the payout status. - // See [PayoutStatus](#type-payoutstatus) for possible values - Status *PayoutStatus `json:"status,omitempty" url:"status,omitempty"` - // The ID of the location associated with the payout. - LocationID string `json:"location_id" url:"location_id"` - // The timestamp of when the payout was created and submitted for deposit to the seller's banking destination, in RFC 3339 format. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The timestamp of when the payout was last updated, in RFC 3339 format. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` - // The amount of money involved in the payout. A positive amount indicates a deposit, and a negative amount indicates a withdrawal. This amount is never zero. - AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` - // Information about the banking destination (such as a bank account, Square checking account, or debit card) - // against which the payout was made. - Destination *Destination `json:"destination,omitempty" url:"destination,omitempty"` - // The version number, which is incremented each time an update is made to this payout record. - // The version number helps developers receive event notifications or feeds out of order. - Version *int `json:"version,omitempty" url:"version,omitempty"` - // Indicates the payout type. - // See [PayoutType](#type-payouttype) for possible values - Type *PayoutType `json:"type,omitempty" url:"type,omitempty"` - // A list of transfer fees and any taxes on the fees assessed by Square for this payout. - PayoutFee []*PayoutFee `json:"payout_fee,omitempty" url:"payout_fee,omitempty"` - // The calendar date, in ISO 8601 format (YYYY-MM-DD), when the payout is due to arrive in the seller’s banking destination. - ArrivalDate *string `json:"arrival_date,omitempty" url:"arrival_date,omitempty"` - // A unique ID for each `Payout` object that might also appear on the seller’s bank statement. You can use this ID to automate the process of reconciling each payout with the corresponding line item on the bank statement. - EndToEndID *string `json:"end_to_end_id,omitempty" url:"end_to_end_id,omitempty"` +// Contains query criteria for the search. +type SearchEventsQuery struct { + // Criteria to filter events by. + Filter *SearchEventsFilter `json:"filter,omitempty" url:"filter,omitempty"` + // Criteria to sort events by. + Sort *SearchEventsSort `json:"sort,omitempty" url:"sort,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *Payout) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (s *SearchEventsQuery) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (p *Payout) UnmarshalJSON(data []byte) error { - type unmarshaler Payout +func (s *SearchEventsQuery) UnmarshalJSON(data []byte) error { + type unmarshaler SearchEventsQuery var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = Payout(value) + *s = SearchEventsQuery(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - p.extraProperties = extraProperties + s.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (p *Payout) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (s *SearchEventsQuery) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", s) } -// One or more PayoutEntries that make up a Payout. Each one has a date, amount, and type of activity. -// The total amount of the payout will equal the sum of the payout entries for a batch payout -type PayoutEntry struct { - // A unique ID for the payout entry. - ID string `json:"id" url:"id"` - // The ID of the payout entries’ associated payout. - PayoutID string `json:"payout_id" url:"payout_id"` - // The timestamp of when the payout entry affected the balance, in RFC 3339 format. - EffectiveAt *string `json:"effective_at,omitempty" url:"effective_at,omitempty"` - // The type of activity associated with this payout entry. - // See [ActivityType](#type-activitytype) for possible values - Type *ActivityType `json:"type,omitempty" url:"type,omitempty"` - // The amount of money involved in this payout entry. - GrossAmountMoney *Money `json:"gross_amount_money,omitempty" url:"gross_amount_money,omitempty"` - // The amount of Square fees associated with this payout entry. - FeeAmountMoney *Money `json:"fee_amount_money,omitempty" url:"fee_amount_money,omitempty"` - // The net proceeds from this transaction after any fees. - NetAmountMoney *Money `json:"net_amount_money,omitempty" url:"net_amount_money,omitempty"` - // Details of any developer app fee revenue generated on a payment. - TypeAppFeeRevenueDetails *PaymentBalanceActivityAppFeeRevenueDetail `json:"type_app_fee_revenue_details,omitempty" url:"type_app_fee_revenue_details,omitempty"` - // Details of a refund for an app fee on a payment. - TypeAppFeeRefundDetails *PaymentBalanceActivityAppFeeRefundDetail `json:"type_app_fee_refund_details,omitempty" url:"type_app_fee_refund_details,omitempty"` - // Details of any automatic transfer from the payment processing balance to the Square Savings account. These are, generally, proportional to the merchant's sales. - TypeAutomaticSavingsDetails *PaymentBalanceActivityAutomaticSavingsDetail `json:"type_automatic_savings_details,omitempty" url:"type_automatic_savings_details,omitempty"` - // Details of any automatic transfer from the Square Savings account back to the processing balance. These are, generally, proportional to the merchant's refunds. - TypeAutomaticSavingsReversedDetails *PaymentBalanceActivityAutomaticSavingsReversedDetail `json:"type_automatic_savings_reversed_details,omitempty" url:"type_automatic_savings_reversed_details,omitempty"` - // Details of credit card payment captures. - TypeChargeDetails *PaymentBalanceActivityChargeDetail `json:"type_charge_details,omitempty" url:"type_charge_details,omitempty"` - // Details of any fees involved with deposits such as for instant deposits. - TypeDepositFeeDetails *PaymentBalanceActivityDepositFeeDetail `json:"type_deposit_fee_details,omitempty" url:"type_deposit_fee_details,omitempty"` - // Details of any balance change due to a dispute event. - TypeDisputeDetails *PaymentBalanceActivityDisputeDetail `json:"type_dispute_details,omitempty" url:"type_dispute_details,omitempty"` - // Details of adjustments due to the Square processing fee. - TypeFeeDetails *PaymentBalanceActivityFeeDetail `json:"type_fee_details,omitempty" url:"type_fee_details,omitempty"` - // Square offers Free Payments Processing for a variety of business scenarios including seller referral or when Square wants to apologize for a bug, customer service, repricing complication, and so on. This entry represents details of any credit to the merchant for the purposes of Free Processing. - TypeFreeProcessingDetails *PaymentBalanceActivityFreeProcessingDetail `json:"type_free_processing_details,omitempty" url:"type_free_processing_details,omitempty"` - // Details of any adjustment made by Square related to the holding or releasing of a payment. - TypeHoldAdjustmentDetails *PaymentBalanceActivityHoldAdjustmentDetail `json:"type_hold_adjustment_details,omitempty" url:"type_hold_adjustment_details,omitempty"` - // Details of any open disputes. - TypeOpenDisputeDetails *PaymentBalanceActivityOpenDisputeDetail `json:"type_open_dispute_details,omitempty" url:"type_open_dispute_details,omitempty"` - // Details of any other type that does not belong in the rest of the types. - TypeOtherDetails *PaymentBalanceActivityOtherDetail `json:"type_other_details,omitempty" url:"type_other_details,omitempty"` - // Details of any other type of adjustments that don't fall under existing types. - TypeOtherAdjustmentDetails *PaymentBalanceActivityOtherAdjustmentDetail `json:"type_other_adjustment_details,omitempty" url:"type_other_adjustment_details,omitempty"` - // Details of a refund for an existing card payment. - TypeRefundDetails *PaymentBalanceActivityRefundDetail `json:"type_refund_details,omitempty" url:"type_refund_details,omitempty"` - // Details of fees released for adjustments. - TypeReleaseAdjustmentDetails *PaymentBalanceActivityReleaseAdjustmentDetail `json:"type_release_adjustment_details,omitempty" url:"type_release_adjustment_details,omitempty"` - // Details of fees paid for funding risk reserve. - TypeReserveHoldDetails *PaymentBalanceActivityReserveHoldDetail `json:"type_reserve_hold_details,omitempty" url:"type_reserve_hold_details,omitempty"` - // Details of fees released from risk reserve. - TypeReserveReleaseDetails *PaymentBalanceActivityReserveReleaseDetail `json:"type_reserve_release_details,omitempty" url:"type_reserve_release_details,omitempty"` - // Details of capital merchant cash advance (MCA) assessments. These are, generally, proportional to the merchant's sales but may be issued for other reasons related to the MCA. - TypeSquareCapitalPaymentDetails *PaymentBalanceActivitySquareCapitalPaymentDetail `json:"type_square_capital_payment_details,omitempty" url:"type_square_capital_payment_details,omitempty"` - // Details of capital merchant cash advance (MCA) assessment refunds. These are, generally, proportional to the merchant's refunds but may be issued for other reasons related to the MCA. - TypeSquareCapitalReversedPaymentDetails *PaymentBalanceActivitySquareCapitalReversedPaymentDetail `json:"type_square_capital_reversed_payment_details,omitempty" url:"type_square_capital_reversed_payment_details,omitempty"` - // Details of tax paid on fee amounts. - TypeTaxOnFeeDetails *PaymentBalanceActivityTaxOnFeeDetail `json:"type_tax_on_fee_details,omitempty" url:"type_tax_on_fee_details,omitempty"` - // Details of fees collected by a 3rd party platform. - TypeThirdPartyFeeDetails *PaymentBalanceActivityThirdPartyFeeDetail `json:"type_third_party_fee_details,omitempty" url:"type_third_party_fee_details,omitempty"` - // Details of refunded fees from a 3rd party platform. - TypeThirdPartyFeeRefundDetails *PaymentBalanceActivityThirdPartyFeeRefundDetail `json:"type_third_party_fee_refund_details,omitempty" url:"type_third_party_fee_refund_details,omitempty"` +// Defines the fields that are included in the response body of +// a request to the [SearchEvents](api-endpoint:Events-SearchEvents) endpoint. +// +// Note: if there are errors processing the request, the events field will not be +// present. +type SearchEventsResponse struct { + // Information on errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The list of [Event](entity:Event)s returned by the search. + Events []*Event `json:"events,omitempty" url:"events,omitempty"` + // Contains the metadata of an event. For more information, see [Event](entity:Event). + Metadata []*EventMetadata `json:"metadata,omitempty" url:"metadata,omitempty"` + // When a response is truncated, it includes a cursor that you can use in a subsequent request to fetch the next set of events. If empty, this is the final response. + // + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PayoutEntry) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (s *SearchEventsResponse) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (p *PayoutEntry) UnmarshalJSON(data []byte) error { - type unmarshaler PayoutEntry +func (s *SearchEventsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler SearchEventsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PayoutEntry(value) + *s = SearchEventsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - p.extraProperties = extraProperties + s.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (p *PayoutEntry) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (s *SearchEventsResponse) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", s) } -// Represents a payout fee that can incur as part of a payout. -type PayoutFee struct { - // The money amount of the payout fee. - AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` - // The timestamp of when the fee takes effect, in RFC 3339 format. - EffectiveAt *string `json:"effective_at,omitempty" url:"effective_at,omitempty"` - // The type of fee assessed as part of the payout. - // See [PayoutFeeType](#type-payoutfeetype) for possible values - Type *PayoutFeeType `json:"type,omitempty" url:"type,omitempty"` +// Criteria to sort events by. +type SearchEventsSort struct { + // Sort events by event types. + // See [SearchEventsSortField](#type-searcheventssortfield) for possible values + Field *SearchEventsSortField `json:"field,omitempty" url:"field,omitempty"` + // The order to use for sorting the events. + // See [SortOrder](#type-sortorder) for possible values + Order *SortOrder `json:"order,omitempty" url:"order,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PayoutFee) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (s *SearchEventsSort) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (p *PayoutFee) UnmarshalJSON(data []byte) error { - type unmarshaler PayoutFee +func (s *SearchEventsSort) UnmarshalJSON(data []byte) error { + type unmarshaler SearchEventsSort var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PayoutFee(value) + *s = SearchEventsSort(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - p.extraProperties = extraProperties + s.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (p *PayoutFee) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (s *SearchEventsSort) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", s) } -// Represents the type of payout fee that can incur as part of a payout. -type PayoutFeeType string +// Specifies the sort key for events returned from a search. +type SearchEventsSortField = string -const ( - PayoutFeeTypeTransferFee PayoutFeeType = "TRANSFER_FEE" - PayoutFeeTypeTaxOnTransferFee PayoutFeeType = "TAX_ON_TRANSFER_FEE" -) +// Describes a `SearchInvoices` response. +type SearchInvoicesResponse struct { + // The list of invoices returned by the search. + Invoices []*Invoice `json:"invoices,omitempty" url:"invoices,omitempty"` + // When a response is truncated, it includes a cursor that you can use in a + // subsequent request to fetch the next set of invoices. If empty, this is the final + // response. + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // Information about errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` -func NewPayoutFeeTypeFromString(s string) (PayoutFeeType, error) { - switch s { - case "TRANSFER_FEE": - return PayoutFeeTypeTransferFee, nil - case "TAX_ON_TRANSFER_FEE": - return PayoutFeeTypeTaxOnTransferFee, nil - } - var t PayoutFeeType - return "", fmt.Errorf("%s is not a valid %T", s, t) + extraProperties map[string]interface{} + _rawJSON json.RawMessage } -func (p PayoutFeeType) Ptr() *PayoutFeeType { - return &p +func (s *SearchInvoicesResponse) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -// Payout status types -type PayoutStatus string - -const ( - PayoutStatusSent PayoutStatus = "SENT" - PayoutStatusFailed PayoutStatus = "FAILED" - PayoutStatusPaid PayoutStatus = "PAID" -) +func (s *SearchInvoicesResponse) UnmarshalJSON(data []byte) error { + type unmarshaler SearchInvoicesResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SearchInvoicesResponse(value) -func NewPayoutStatusFromString(s string) (PayoutStatus, error) { - switch s { - case "SENT": - return PayoutStatusSent, nil - case "FAILED": - return PayoutStatusFailed, nil - case "PAID": - return PayoutStatusPaid, nil + extraProperties, err := core.ExtractExtraProperties(data, *s) + if err != nil { + return err } - var t PayoutStatus - return "", fmt.Errorf("%s is not a valid %T", s, t) -} + s.extraProperties = extraProperties -func (p PayoutStatus) Ptr() *PayoutStatus { - return &p + s._rawJSON = json.RawMessage(data) + return nil } -// The type of payout: “BATCH” or “SIMPLE”. -// BATCH payouts include a list of payout entries that can be considered settled. -// SIMPLE payouts do not have any payout entries associated with them -// and will show up as one of the payout entries in a future BATCH payout. -type PayoutType string - -const ( - PayoutTypeBatch PayoutType = "BATCH" - PayoutTypeSimple PayoutType = "SIMPLE" -) - -func NewPayoutTypeFromString(s string) (PayoutType, error) { - switch s { - case "BATCH": - return PayoutTypeBatch, nil - case "SIMPLE": - return PayoutTypeSimple, nil +func (s *SearchInvoicesResponse) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { + return value + } } - var t PayoutType - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (p PayoutType) Ptr() *PayoutType { - return &p + if value, err := core.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) } -// Represents a phase, which can override subscription phases as defined by plan_id -type Phase struct { - // id of subscription phase - UID *string `json:"uid,omitempty" url:"uid,omitempty"` - // index of phase in total subscription plan - Ordinal *int64 `json:"ordinal,omitempty" url:"ordinal,omitempty"` - // id of order to be used in billing - OrderTemplateID *string `json:"order_template_id,omitempty" url:"order_template_id,omitempty"` - // the uid from the plan's phase in catalog - PlanPhaseUID *string `json:"plan_phase_uid,omitempty" url:"plan_phase_uid,omitempty"` +// The search criteria for the loyalty accounts. +type SearchLoyaltyAccountsRequestLoyaltyAccountQuery struct { + // The set of mappings to use in the loyalty account search. + // + // This cannot be combined with `customer_ids`. + // + // Max: 30 mappings + Mappings []*LoyaltyAccountMapping `json:"mappings,omitempty" url:"mappings,omitempty"` + // The set of customer IDs to use in the loyalty account search. + // + // This cannot be combined with `mappings`. + // + // Max: 30 customer IDs + CustomerIDs []string `json:"customer_ids,omitempty" url:"customer_ids,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *Phase) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (s *SearchLoyaltyAccountsRequestLoyaltyAccountQuery) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (p *Phase) UnmarshalJSON(data []byte) error { - type unmarshaler Phase +func (s *SearchLoyaltyAccountsRequestLoyaltyAccountQuery) UnmarshalJSON(data []byte) error { + type unmarshaler SearchLoyaltyAccountsRequestLoyaltyAccountQuery var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = Phase(value) + *s = SearchLoyaltyAccountsRequestLoyaltyAccountQuery(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - p.extraProperties = extraProperties + s.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (p *Phase) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (s *SearchLoyaltyAccountsRequestLoyaltyAccountQuery) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", s) } -// Represents the arguments used to construct a new phase. -type PhaseInput struct { - // index of phase in total subscription plan - Ordinal int64 `json:"ordinal" url:"ordinal"` - // id of order to be used in billing - OrderTemplateID *string `json:"order_template_id,omitempty" url:"order_template_id,omitempty"` +// A response that includes loyalty accounts that satisfy the search criteria. +type SearchLoyaltyAccountsResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The loyalty accounts that met the search criteria, + // in order of creation date. + LoyaltyAccounts []*LoyaltyAccount `json:"loyalty_accounts,omitempty" url:"loyalty_accounts,omitempty"` + // The pagination cursor to use in a subsequent + // request. If empty, this is the final response. + // For more information, + // see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PhaseInput) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (s *SearchLoyaltyAccountsResponse) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (p *PhaseInput) UnmarshalJSON(data []byte) error { - type unmarshaler PhaseInput +func (s *SearchLoyaltyAccountsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler SearchLoyaltyAccountsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PhaseInput(value) + *s = SearchLoyaltyAccountsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - p.extraProperties = extraProperties + s.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (p *PhaseInput) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (s *SearchLoyaltyAccountsResponse) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", s) } -// Describes buyer data to prepopulate in the payment form. -// For more information, -// see [Optional Checkout Configurations](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations). -type PrePopulatedData struct { - // The buyer email to prepopulate in the payment form. - BuyerEmail *string `json:"buyer_email,omitempty" url:"buyer_email,omitempty"` - // The buyer phone number to prepopulate in the payment form. - BuyerPhoneNumber *string `json:"buyer_phone_number,omitempty" url:"buyer_phone_number,omitempty"` - // The buyer address to prepopulate in the payment form. - BuyerAddress *Address `json:"buyer_address,omitempty" url:"buyer_address,omitempty"` +// A response that contains loyalty events that satisfy the search +// criteria, in order by the `created_at` date. +type SearchLoyaltyEventsResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The loyalty events that satisfy the search criteria. + Events []*LoyaltyEvent `json:"events,omitempty" url:"events,omitempty"` + // The pagination cursor to be used in a subsequent + // request. If empty, this is the final response. + // For more information, + // see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PrePopulatedData) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (s *SearchLoyaltyEventsResponse) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (p *PrePopulatedData) UnmarshalJSON(data []byte) error { - type unmarshaler PrePopulatedData +func (s *SearchLoyaltyEventsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler SearchLoyaltyEventsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PrePopulatedData(value) + *s = SearchLoyaltyEventsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - p.extraProperties = extraProperties + s.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (p *PrePopulatedData) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (s *SearchLoyaltyEventsResponse) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", s) } -// Represents the Square processing fee. -type ProcessingFee struct { - // The timestamp of when the fee takes effect, in RFC 3339 format. - EffectiveAt *string `json:"effective_at,omitempty" url:"effective_at,omitempty"` - // The type of fee assessed or adjusted. The fee type can be `INITIAL` or `ADJUSTMENT`. - Type *string `json:"type,omitempty" url:"type,omitempty"` - // The fee amount, which might be negative, that is assessed or adjusted by Square. - // - // Positive values represent funds being assessed, while negative values represent - // funds being returned. - AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` +// The set of search requirements. +type SearchLoyaltyRewardsRequestLoyaltyRewardQuery struct { + // The ID of the [loyalty account](entity:LoyaltyAccount) to which the loyalty reward belongs. + LoyaltyAccountID string `json:"loyalty_account_id" url:"loyalty_account_id"` + // The status of the loyalty reward. + // See [LoyaltyRewardStatus](#type-loyaltyrewardstatus) for possible values + Status *LoyaltyRewardStatus `json:"status,omitempty" url:"status,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *ProcessingFee) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (s *SearchLoyaltyRewardsRequestLoyaltyRewardQuery) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (p *ProcessingFee) UnmarshalJSON(data []byte) error { - type unmarshaler ProcessingFee +func (s *SearchLoyaltyRewardsRequestLoyaltyRewardQuery) UnmarshalJSON(data []byte) error { + type unmarshaler SearchLoyaltyRewardsRequestLoyaltyRewardQuery var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = ProcessingFee(value) + *s = SearchLoyaltyRewardsRequestLoyaltyRewardQuery(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - p.extraProperties = extraProperties + s.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (p *ProcessingFee) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (s *SearchLoyaltyRewardsRequestLoyaltyRewardQuery) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", p) -} - -// Indicates the Square product used to generate a change. -type Product string - -const ( - ProductSquarePos Product = "SQUARE_POS" - ProductExternalAPI Product = "EXTERNAL_API" - ProductBilling Product = "BILLING" - ProductAppointments Product = "APPOINTMENTS" - ProductInvoices Product = "INVOICES" - ProductOnlineStore Product = "ONLINE_STORE" - ProductPayroll Product = "PAYROLL" - ProductDashboard Product = "DASHBOARD" - ProductItemLibraryImport Product = "ITEM_LIBRARY_IMPORT" - ProductOther Product = "OTHER" -) - -func NewProductFromString(s string) (Product, error) { - switch s { - case "SQUARE_POS": - return ProductSquarePos, nil - case "EXTERNAL_API": - return ProductExternalAPI, nil - case "BILLING": - return ProductBilling, nil - case "APPOINTMENTS": - return ProductAppointments, nil - case "INVOICES": - return ProductInvoices, nil - case "ONLINE_STORE": - return ProductOnlineStore, nil - case "PAYROLL": - return ProductPayroll, nil - case "DASHBOARD": - return ProductDashboard, nil - case "ITEM_LIBRARY_IMPORT": - return ProductItemLibraryImport, nil - case "OTHER": - return ProductOther, nil - } - var t Product - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (p Product) Ptr() *Product { - return &p + return fmt.Sprintf("%#v", s) } -type ProductType = string - -// Describes a `PublishInvoice` response. -type PublishInvoiceResponse struct { - // The published invoice. - Invoice *Invoice `json:"invoice,omitempty" url:"invoice,omitempty"` - // Information about errors encountered during the request. +// A response that includes the loyalty rewards satisfying the search criteria. +type SearchLoyaltyRewardsResponse struct { + // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The loyalty rewards that satisfy the search criteria. + // These are returned in descending order by `updated_at`. + Rewards []*LoyaltyReward `json:"rewards,omitempty" url:"rewards,omitempty"` + // The pagination cursor to be used in a subsequent + // request. If empty, this is the final response. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (p *PublishInvoiceResponse) GetExtraProperties() map[string]interface{} { - return p.extraProperties +func (s *SearchLoyaltyRewardsResponse) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (p *PublishInvoiceResponse) UnmarshalJSON(data []byte) error { - type unmarshaler PublishInvoiceResponse +func (s *SearchLoyaltyRewardsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler SearchLoyaltyRewardsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PublishInvoiceResponse(value) + *s = SearchLoyaltyRewardsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *p) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - p.extraProperties = extraProperties + s.extraProperties = extraProperties - p._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (p *PublishInvoiceResponse) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { +func (s *SearchLoyaltyRewardsResponse) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(p); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", p) + return fmt.Sprintf("%#v", s) } -// Fields to describe the action that displays QR-Codes. -type QrCodeOptions struct { - // The title text to display in the QR code flow on the Terminal. - Title string `json:"title" url:"title"` - // The body text to display in the QR code flow on the Terminal. - Body string `json:"body" url:"body"` - // The text representation of the data to show in the QR code - // as UTF8-encoded data. - BarcodeContents string `json:"barcode_contents" url:"barcode_contents"` +// A filter based on the order `customer_id` and any tender `customer_id` +// associated with the order. It does not filter based on the +// [FulfillmentRecipient](entity:FulfillmentRecipient) `customer_id`. +type SearchOrdersCustomerFilter struct { + // A list of customer IDs to filter by. + // + // Max: 10 customer ids. + CustomerIDs []string `json:"customer_ids,omitempty" url:"customer_ids,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (q *QrCodeOptions) GetExtraProperties() map[string]interface{} { - return q.extraProperties +func (s *SearchOrdersCustomerFilter) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (q *QrCodeOptions) UnmarshalJSON(data []byte) error { - type unmarshaler QrCodeOptions +func (s *SearchOrdersCustomerFilter) UnmarshalJSON(data []byte) error { + type unmarshaler SearchOrdersCustomerFilter var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *q = QrCodeOptions(value) + *s = SearchOrdersCustomerFilter(value) - extraProperties, err := core.ExtractExtraProperties(data, *q) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - q.extraProperties = extraProperties + s.extraProperties = extraProperties - q._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (q *QrCodeOptions) String() string { - if len(q._rawJSON) > 0 { - if value, err := core.StringifyJSON(q._rawJSON); err == nil { +func (s *SearchOrdersCustomerFilter) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(q); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", q) + return fmt.Sprintf("%#v", s) } -// A whole number or unreduced fractional ratio. -type QuantityRatio struct { - // The whole or fractional quantity as the numerator. - Quantity *int `json:"quantity,omitempty" url:"quantity,omitempty"` - // The whole or fractional quantity as the denominator. - // With fractional quantity this field is the denominator and quantity is the numerator. - // The default value is `1`. For example, when `quantity=3` and `quantity_denominator` is unspecified, - // the quantity ratio is `3` or `3/1`. - QuantityDenominator *int `json:"quantity_denominator,omitempty" url:"quantity_denominator,omitempty"` +// Filter for `Order` objects based on whether their `CREATED_AT`, +// `CLOSED_AT`, or `UPDATED_AT` timestamps fall within a specified time range. +// You can specify the time range and which timestamp to filter for. You can filter +// for only one time range at a time. +// +// For each time range, the start time and end time are inclusive. If the end time +// is absent, it defaults to the time of the first request for the cursor. +// +// **Important:** If you use the `DateTimeFilter` in a `SearchOrders` query, +// you must set the `sort_field` in [OrdersSort](entity:SearchOrdersSort) +// to the same field you filter for. For example, if you set the `CLOSED_AT` field +// in `DateTimeFilter`, you must set the `sort_field` in `SearchOrdersSort` to +// `CLOSED_AT`. Otherwise, `SearchOrders` throws an error. +// [Learn more about filtering orders by time range.](https://developer.squareup.com/docs/orders-api/manage-orders/search-orders#important-note-about-filtering-orders-by-time-range) +type SearchOrdersDateTimeFilter struct { + // The time range for filtering on the `created_at` timestamp. If you use this + // value, you must set the `sort_field` in the `OrdersSearchSort` object to + // `CREATED_AT`. + CreatedAt *TimeRange `json:"created_at,omitempty" url:"created_at,omitempty"` + // The time range for filtering on the `updated_at` timestamp. If you use this + // value, you must set the `sort_field` in the `OrdersSearchSort` object to + // `UPDATED_AT`. + UpdatedAt *TimeRange `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // The time range for filtering on the `closed_at` timestamp. If you use this + // value, you must set the `sort_field` in the `OrdersSearchSort` object to + // `CLOSED_AT`. + ClosedAt *TimeRange `json:"closed_at,omitempty" url:"closed_at,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (q *QuantityRatio) GetExtraProperties() map[string]interface{} { - return q.extraProperties +func (s *SearchOrdersDateTimeFilter) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (q *QuantityRatio) UnmarshalJSON(data []byte) error { - type unmarshaler QuantityRatio +func (s *SearchOrdersDateTimeFilter) UnmarshalJSON(data []byte) error { + type unmarshaler SearchOrdersDateTimeFilter var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *q = QuantityRatio(value) + *s = SearchOrdersDateTimeFilter(value) - extraProperties, err := core.ExtractExtraProperties(data, *q) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - q.extraProperties = extraProperties + s.extraProperties = extraProperties - q._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (q *QuantityRatio) String() string { - if len(q._rawJSON) > 0 { - if value, err := core.StringifyJSON(q._rawJSON); err == nil { +func (s *SearchOrdersDateTimeFilter) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(q); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", q) + return fmt.Sprintf("%#v", s) } -// Describes an ad hoc item and price to generate a quick pay checkout link. -// For more information, -// see [Quick Pay Checkout](https://developer.squareup.com/docs/checkout-api/quick-pay-checkout). -type QuickPay struct { - // The ad hoc item name. In the resulting `Order`, this name appears as the line item name. - Name string `json:"name" url:"name"` - // The price of the item. - PriceMoney *Money `json:"price_money,omitempty" url:"price_money,omitempty"` - // The ID of the business location the checkout is associated with. - LocationID string `json:"location_id" url:"location_id"` +// Filtering criteria to use for a `SearchOrders` request. Multiple filters +// are ANDed together. +type SearchOrdersFilter struct { + // Filter by [OrderState](entity:OrderState). + StateFilter *SearchOrdersStateFilter `json:"state_filter,omitempty" url:"state_filter,omitempty"` + // Filter for results within a time range. + // + // **Important:** If you filter for orders by time range, you must set `SearchOrdersSort` + // to sort by the same field. + // [Learn more about filtering orders by time range.](https://developer.squareup.com/docs/orders-api/manage-orders/search-orders#important-note-about-filtering-orders-by-time-range) + DateTimeFilter *SearchOrdersDateTimeFilter `json:"date_time_filter,omitempty" url:"date_time_filter,omitempty"` + // Filter by the fulfillment type or state. + FulfillmentFilter *SearchOrdersFulfillmentFilter `json:"fulfillment_filter,omitempty" url:"fulfillment_filter,omitempty"` + // Filter by the source of the order. + SourceFilter *SearchOrdersSourceFilter `json:"source_filter,omitempty" url:"source_filter,omitempty"` + // Filter by customers associated with the order. + CustomerFilter *SearchOrdersCustomerFilter `json:"customer_filter,omitempty" url:"customer_filter,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (q *QuickPay) GetExtraProperties() map[string]interface{} { - return q.extraProperties +func (s *SearchOrdersFilter) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (q *QuickPay) UnmarshalJSON(data []byte) error { - type unmarshaler QuickPay +func (s *SearchOrdersFilter) UnmarshalJSON(data []byte) error { + type unmarshaler SearchOrdersFilter var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *q = QuickPay(value) + *s = SearchOrdersFilter(value) - extraProperties, err := core.ExtractExtraProperties(data, *q) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - q.extraProperties = extraProperties + s.extraProperties = extraProperties - q._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (q *QuickPay) String() string { - if len(q._rawJSON) > 0 { - if value, err := core.StringifyJSON(q._rawJSON); err == nil { +func (s *SearchOrdersFilter) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(q); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", q) + return fmt.Sprintf("%#v", s) } -// The range of a number value between the specified lower and upper bounds. -type Range struct { - // The lower bound of the number range. At least one of `min` or `max` must be specified. - // If unspecified, the results will have no minimum value. - Min *string `json:"min,omitempty" url:"min,omitempty"` - // The upper bound of the number range. At least one of `min` or `max` must be specified. - // If unspecified, the results will have no maximum value. - Max *string `json:"max,omitempty" url:"max,omitempty"` +// Filter based on [order fulfillment](entity:Fulfillment) information. +type SearchOrdersFulfillmentFilter struct { + // A list of [fulfillment types](entity:FulfillmentType) to filter + // for. The list returns orders if any of its fulfillments match any of the fulfillment types + // listed in this field. + // See [FulfillmentType](#type-fulfillmenttype) for possible values + FulfillmentTypes []FulfillmentType `json:"fulfillment_types,omitempty" url:"fulfillment_types,omitempty"` + // A list of [fulfillment states](entity:FulfillmentState) to filter + // for. The list returns orders if any of its fulfillments match any of the + // fulfillment states listed in this field. + // See [FulfillmentState](#type-fulfillmentstate) for possible values + FulfillmentStates []FulfillmentState `json:"fulfillment_states,omitempty" url:"fulfillment_states,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (r *Range) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *SearchOrdersFulfillmentFilter) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *Range) UnmarshalJSON(data []byte) error { - type unmarshaler Range +func (s *SearchOrdersFulfillmentFilter) UnmarshalJSON(data []byte) error { + type unmarshaler SearchOrdersFulfillmentFilter var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = Range(value) + *s = SearchOrdersFulfillmentFilter(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *Range) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *SearchOrdersFulfillmentFilter) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", s) } -// Describes receipt action fields. -type ReceiptOptions struct { - // The reference to the Square payment ID for the receipt. - PaymentID string `json:"payment_id" url:"payment_id"` - // Instructs the device to print the receipt without displaying the receipt selection screen. - // Requires `printer_enabled` set to true. - // Defaults to false. - PrintOnly *bool `json:"print_only,omitempty" url:"print_only,omitempty"` - // Identify the receipt as a reprint rather than an original receipt. - // Defaults to false. - IsDuplicate *bool `json:"is_duplicate,omitempty" url:"is_duplicate,omitempty"` +// Contains query criteria for the search. +type SearchOrdersQuery struct { + // Criteria to filter results by. + Filter *SearchOrdersFilter `json:"filter,omitempty" url:"filter,omitempty"` + // Criteria to sort results by. + Sort *SearchOrdersSort `json:"sort,omitempty" url:"sort,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (r *ReceiptOptions) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *SearchOrdersQuery) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *ReceiptOptions) UnmarshalJSON(data []byte) error { - type unmarshaler ReceiptOptions +func (s *SearchOrdersQuery) UnmarshalJSON(data []byte) error { + type unmarshaler SearchOrdersQuery var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = ReceiptOptions(value) + *s = SearchOrdersQuery(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *ReceiptOptions) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *SearchOrdersQuery) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", s) } -// A response that includes the `LoyaltyEvent` published for redeeming the reward. -type RedeemLoyaltyRewardResponse struct { - // Any errors that occurred during the request. +// Either the `order_entries` or `orders` field is set, depending on whether +// `return_entries` is set on the [SearchOrdersRequest](api-endpoint:Orders-SearchOrders). +type SearchOrdersResponse struct { + // A list of [OrderEntries](entity:OrderEntry) that fit the query + // conditions. The list is populated only if `return_entries` is set to `true` in the request. + OrderEntries []*OrderEntry `json:"order_entries,omitempty" url:"order_entries,omitempty"` + // A list of + // [Order](entity:Order) objects that match the query conditions. The list is populated only if + // `return_entries` is set to `false` in the request. + Orders []*Order `json:"orders,omitempty" url:"orders,omitempty"` + // The pagination cursor to be used in a subsequent request. If unset, + // this is the final response. + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // [Errors](entity:Error) encountered during the search. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The `LoyaltyEvent` for redeeming the reward. - Event *LoyaltyEvent `json:"event,omitempty" url:"event,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (r *RedeemLoyaltyRewardResponse) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *SearchOrdersResponse) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *RedeemLoyaltyRewardResponse) UnmarshalJSON(data []byte) error { - type unmarshaler RedeemLoyaltyRewardResponse +func (s *SearchOrdersResponse) UnmarshalJSON(data []byte) error { + type unmarshaler SearchOrdersResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RedeemLoyaltyRewardResponse(value) + *s = SearchOrdersResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *RedeemLoyaltyRewardResponse) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *SearchOrdersResponse) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", s) } -// Represents a refund processed for a Square transaction. -type Refund struct { - // The refund's unique ID. - ID string `json:"id" url:"id"` - // The ID of the refund's associated location. - LocationID string `json:"location_id" url:"location_id"` - // The ID of the transaction that the refunded tender is part of. - TransactionID *string `json:"transaction_id,omitempty" url:"transaction_id,omitempty"` - // The ID of the refunded tender. - TenderID string `json:"tender_id" url:"tender_id"` - // The timestamp for when the refund was created, in RFC 3339 format. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The reason for the refund being issued. - Reason string `json:"reason" url:"reason"` - // The amount of money refunded to the buyer. - AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` - // The current status of the refund (`PENDING`, `APPROVED`, `REJECTED`, - // or `FAILED`). - // See [RefundStatus](#type-refundstatus) for possible values - Status RefundStatus `json:"status" url:"status"` - // The amount of Square processing fee money refunded to the _merchant_. - ProcessingFeeMoney *Money `json:"processing_fee_money,omitempty" url:"processing_fee_money,omitempty"` - // Additional recipients (other than the merchant) receiving a portion of this refund. - // For example, fees assessed on a refund of a purchase by a third party integration. - AdditionalRecipients []*AdditionalRecipient `json:"additional_recipients,omitempty" url:"additional_recipients,omitempty"` +// Sorting criteria for a `SearchOrders` request. Results can only be sorted +// by a timestamp field. +type SearchOrdersSort struct { + // The field to sort by. + // + // **Important:** When using a [DateTimeFilter](entity:SearchOrdersFilter), + // `sort_field` must match the timestamp field that the `DateTimeFilter` uses to + // filter. For example, if you set your `sort_field` to `CLOSED_AT` and you use a + // `DateTimeFilter`, your `DateTimeFilter` must filter for orders by their `CLOSED_AT` date. + // If this field does not match the timestamp field in `DateTimeFilter`, + // `SearchOrders` returns an error. + // + // Default: `CREATED_AT`. + // See [SearchOrdersSortField](#type-searchorderssortfield) for possible values + SortField SearchOrdersSortField `json:"sort_field" url:"sort_field"` + // The chronological order in which results are returned. Defaults to `DESC`. + // See [SortOrder](#type-sortorder) for possible values + SortOrder *SortOrder `json:"sort_order,omitempty" url:"sort_order,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (r *Refund) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *SearchOrdersSort) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *Refund) UnmarshalJSON(data []byte) error { - type unmarshaler Refund +func (s *SearchOrdersSort) UnmarshalJSON(data []byte) error { + type unmarshaler SearchOrdersSort var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = Refund(value) + *s = SearchOrdersSort(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *Refund) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *SearchOrdersSort) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", s) } -// Defines the response returned by -// [RefundPayment]($e/Refunds/RefundPayment). -// -// If there are errors processing the request, the `refund` field might not be -// present, or it might be present with a status of `FAILED`. -type RefundPaymentResponse struct { - // Information about errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The successfully created `PaymentRefund`. - Refund *PaymentRefund `json:"refund,omitempty" url:"refund,omitempty"` +// Specifies which timestamp to use to sort `SearchOrder` results. +type SearchOrdersSortField string + +const ( + SearchOrdersSortFieldDoNotUse SearchOrdersSortField = "DO_NOT_USE" + SearchOrdersSortFieldCreatedAt SearchOrdersSortField = "CREATED_AT" + SearchOrdersSortFieldUpdatedAt SearchOrdersSortField = "UPDATED_AT" + SearchOrdersSortFieldClosedAt SearchOrdersSortField = "CLOSED_AT" + SearchOrdersSortFieldPaidAt SearchOrdersSortField = "PAID_AT" + SearchOrdersSortFieldScore SearchOrdersSortField = "SCORE" + SearchOrdersSortFieldDueAt SearchOrdersSortField = "DUE_AT" +) + +func NewSearchOrdersSortFieldFromString(s string) (SearchOrdersSortField, error) { + switch s { + case "DO_NOT_USE": + return SearchOrdersSortFieldDoNotUse, nil + case "CREATED_AT": + return SearchOrdersSortFieldCreatedAt, nil + case "UPDATED_AT": + return SearchOrdersSortFieldUpdatedAt, nil + case "CLOSED_AT": + return SearchOrdersSortFieldClosedAt, nil + case "PAID_AT": + return SearchOrdersSortFieldPaidAt, nil + case "SCORE": + return SearchOrdersSortFieldScore, nil + case "DUE_AT": + return SearchOrdersSortFieldDueAt, nil + } + var t SearchOrdersSortField + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SearchOrdersSortField) Ptr() *SearchOrdersSortField { + return &s +} + +// A filter based on order `source` information. +type SearchOrdersSourceFilter struct { + // Filters by the [Source](entity:OrderSource) `name`. The filter returns any orders + // with a `source.name` that matches any of the listed source names. + // + // Max: 10 source names. + SourceNames []string `json:"source_names,omitempty" url:"source_names,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (r *RefundPaymentResponse) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *SearchOrdersSourceFilter) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *RefundPaymentResponse) UnmarshalJSON(data []byte) error { - type unmarshaler RefundPaymentResponse +func (s *SearchOrdersSourceFilter) UnmarshalJSON(data []byte) error { + type unmarshaler SearchOrdersSourceFilter var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RefundPaymentResponse(value) + *s = SearchOrdersSourceFilter(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *RefundPaymentResponse) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *SearchOrdersSourceFilter) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) -} - -// Indicates a refund's current status. -type RefundStatus string - -const ( - RefundStatusPending RefundStatus = "PENDING" - RefundStatusApproved RefundStatus = "APPROVED" - RefundStatusRejected RefundStatus = "REJECTED" - RefundStatusFailed RefundStatus = "FAILED" -) - -func NewRefundStatusFromString(s string) (RefundStatus, error) { - switch s { - case "PENDING": - return RefundStatusPending, nil - case "APPROVED": - return RefundStatusApproved, nil - case "REJECTED": - return RefundStatusRejected, nil - case "FAILED": - return RefundStatusFailed, nil - } - var t RefundStatus - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (r RefundStatus) Ptr() *RefundStatus { - return &r + return fmt.Sprintf("%#v", s) } -// Defines the fields that are included in the response body of -// a request to the [RegisterDomain]($e/ApplePay/RegisterDomain) endpoint. -// -// Either `errors` or `status` are present in a given response (never both). -type RegisterDomainResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The status of the domain registration. - // - // See [RegisterDomainResponseStatus](entity:RegisterDomainResponseStatus) for possible values. - // See [RegisterDomainResponseStatus](#type-registerdomainresponsestatus) for possible values - Status *RegisterDomainResponseStatus `json:"status,omitempty" url:"status,omitempty"` +// Filter by the current order `state`. +type SearchOrdersStateFilter struct { + // States to filter for. + // See [OrderState](#type-orderstate) for possible values + States []OrderState `json:"states,omitempty" url:"states,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (r *RegisterDomainResponse) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *SearchOrdersStateFilter) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *RegisterDomainResponse) UnmarshalJSON(data []byte) error { - type unmarshaler RegisterDomainResponse +func (s *SearchOrdersStateFilter) UnmarshalJSON(data []byte) error { + type unmarshaler SearchOrdersStateFilter var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RegisterDomainResponse(value) + *s = SearchOrdersStateFilter(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *RegisterDomainResponse) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *SearchOrdersStateFilter) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) -} - -// The status of the domain registration. -type RegisterDomainResponseStatus string - -const ( - RegisterDomainResponseStatusPending RegisterDomainResponseStatus = "PENDING" - RegisterDomainResponseStatusVerified RegisterDomainResponseStatus = "VERIFIED" -) - -func NewRegisterDomainResponseStatusFromString(s string) (RegisterDomainResponseStatus, error) { - switch s { - case "PENDING": - return RegisterDomainResponseStatusPending, nil - case "VERIFIED": - return RegisterDomainResponseStatusVerified, nil - } - var t RegisterDomainResponseStatus - return "", fmt.Errorf("%s is not a valid %T", s, t) + return fmt.Sprintf("%#v", s) } -func (r RegisterDomainResponseStatus) Ptr() *RegisterDomainResponseStatus { - return &r -} +// The response to a request for `Shift` objects. The response contains +// the requested `Shift` objects and might contain a set of `Error` objects if +// the request resulted in errors. +type SearchShiftsResponse struct { + // Shifts. + Shifts []*Shift `json:"shifts,omitempty" url:"shifts,omitempty"` + // An opaque cursor for fetching the next page. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` -// Defines the fields that are included in the request body of -// a request to the [RemoveGroupFromCustomer]($e/Customers/RemoveGroupFromCustomer) endpoint. -type RemoveGroupFromCustomerRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (r *RemoveGroupFromCustomerRequest) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *SearchShiftsResponse) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *RemoveGroupFromCustomerRequest) UnmarshalJSON(data []byte) error { - type unmarshaler RemoveGroupFromCustomerRequest +func (s *SearchShiftsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler SearchShiftsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RemoveGroupFromCustomerRequest(value) + *s = SearchShiftsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *RemoveGroupFromCustomerRequest) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *SearchShiftsResponse) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", s) } -// Defines the fields that are included in the response body of -// a request to the [RemoveGroupFromCustomer]($e/Customers/RemoveGroupFromCustomer) -// endpoint. -type RemoveGroupFromCustomerResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Represents a set of query expressions (filters) to narrow the scope of targeted subscriptions returned by +// the [SearchSubscriptions](api-endpoint:Subscriptions-SearchSubscriptions) endpoint. +type SearchSubscriptionsFilter struct { + // A filter to select subscriptions based on the subscribing customer IDs. + CustomerIDs []string `json:"customer_ids,omitempty" url:"customer_ids,omitempty"` + // A filter to select subscriptions based on the location. + LocationIDs []string `json:"location_ids,omitempty" url:"location_ids,omitempty"` + // A filter to select subscriptions based on the source application. + SourceNames []string `json:"source_names,omitempty" url:"source_names,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (r *RemoveGroupFromCustomerResponse) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *SearchSubscriptionsFilter) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *RemoveGroupFromCustomerResponse) UnmarshalJSON(data []byte) error { - type unmarshaler RemoveGroupFromCustomerResponse +func (s *SearchSubscriptionsFilter) UnmarshalJSON(data []byte) error { + type unmarshaler SearchSubscriptionsFilter var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RemoveGroupFromCustomerResponse(value) + *s = SearchSubscriptionsFilter(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *RemoveGroupFromCustomerResponse) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *SearchSubscriptionsFilter) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", s) } -// Defines output parameters in a response from the -// [ResumeSubscription]($e/Subscriptions/ResumeSubscription) endpoint. -type ResumeSubscriptionResponse struct { - // Errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The resumed subscription. - Subscription *Subscription `json:"subscription,omitempty" url:"subscription,omitempty"` - // A list of `RESUME` actions created by the request and scheduled for the subscription. - Actions []*SubscriptionAction `json:"actions,omitempty" url:"actions,omitempty"` +// Represents a query, consisting of specified query expressions, used to search for subscriptions. +type SearchSubscriptionsQuery struct { + // A list of query expressions. + Filter *SearchSubscriptionsFilter `json:"filter,omitempty" url:"filter,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (r *ResumeSubscriptionResponse) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *SearchSubscriptionsQuery) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *ResumeSubscriptionResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ResumeSubscriptionResponse +func (s *SearchSubscriptionsQuery) UnmarshalJSON(data []byte) error { + type unmarshaler SearchSubscriptionsQuery var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = ResumeSubscriptionResponse(value) + *s = SearchSubscriptionsQuery(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *ResumeSubscriptionResponse) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *SearchSubscriptionsQuery) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", s) } -// Represents a [RetrieveBookingCustomAttributeDefinition]($e/BookingCustomAttributes/RetrieveBookingCustomAttributeDefinition) response. -// Either `custom_attribute_definition` or `errors` is present in the response. -type RetrieveBookingCustomAttributeDefinitionResponse struct { - // The retrieved custom attribute definition. - CustomAttributeDefinition *CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"custom_attribute_definition,omitempty"` - // Any errors that occurred during the request. +// Defines output parameters in a response from the +// [SearchSubscriptions](api-endpoint:Subscriptions-SearchSubscriptions) endpoint. +type SearchSubscriptionsResponse struct { + // Errors encountered during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The subscriptions matching the specified query expressions. + Subscriptions []*Subscription `json:"subscriptions,omitempty" url:"subscriptions,omitempty"` + // When the total number of resulting subscription exceeds the limit of a paged response, + // the response includes a cursor for you to use in a subsequent request to fetch the next set of results. + // If the cursor is unset, the response contains the last page of the results. + // + // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (r *RetrieveBookingCustomAttributeDefinitionResponse) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *SearchSubscriptionsResponse) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *RetrieveBookingCustomAttributeDefinitionResponse) UnmarshalJSON(data []byte) error { - type unmarshaler RetrieveBookingCustomAttributeDefinitionResponse +func (s *SearchSubscriptionsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler SearchSubscriptionsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RetrieveBookingCustomAttributeDefinitionResponse(value) + *s = SearchSubscriptionsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *RetrieveBookingCustomAttributeDefinitionResponse) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *SearchSubscriptionsResponse) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", s) } -// Represents a [RetrieveBookingCustomAttribute]($e/BookingCustomAttributes/RetrieveBookingCustomAttribute) response. -// Either `custom_attribute_definition` or `errors` is present in the response. -type RetrieveBookingCustomAttributeResponse struct { - // The retrieved custom attribute. If `with_definition` was set to `true` in the request, - // the custom attribute definition is returned in the `definition` field. - CustomAttribute *CustomAttribute `json:"custom_attribute,omitempty" url:"custom_attribute,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Represents a filter used in a search for `TeamMember` objects. `AND` logic is applied +// between the individual fields, and `OR` logic is applied within list-based fields. +// For example, setting this filter value: +// +// ``` +// filter = (locations_ids = ["A", "B"], status = ACTIVE) +// ``` +// +// returns only active team members assigned to either location "A" or "B". +type SearchTeamMembersFilter struct { + // When present, filters by team members assigned to the specified locations. + // When empty, includes team members assigned to any location. + LocationIDs []string `json:"location_ids,omitempty" url:"location_ids,omitempty"` + // When present, filters by team members who match the given status. + // When empty, includes team members of all statuses. + // See [TeamMemberStatus](#type-teammemberstatus) for possible values + Status *TeamMemberStatus `json:"status,omitempty" url:"status,omitempty"` + // When present and set to true, returns the team member who is the owner of the Square account. + IsOwner *bool `json:"is_owner,omitempty" url:"is_owner,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (r *RetrieveBookingCustomAttributeResponse) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *SearchTeamMembersFilter) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *RetrieveBookingCustomAttributeResponse) UnmarshalJSON(data []byte) error { - type unmarshaler RetrieveBookingCustomAttributeResponse +func (s *SearchTeamMembersFilter) UnmarshalJSON(data []byte) error { + type unmarshaler SearchTeamMembersFilter var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RetrieveBookingCustomAttributeResponse(value) + *s = SearchTeamMembersFilter(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *RetrieveBookingCustomAttributeResponse) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *SearchTeamMembersFilter) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", s) } -type RetrieveCashDrawerShiftRequest struct { - // The ID of the location to retrieve cash drawer shifts from. - LocationID string `json:"location_id" url:"location_id"` +// Represents the parameters in a search for `TeamMember` objects. +type SearchTeamMembersQuery struct { + // The options to filter by. + Filter *SearchTeamMembersFilter `json:"filter,omitempty" url:"filter,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (r *RetrieveCashDrawerShiftRequest) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *SearchTeamMembersQuery) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *RetrieveCashDrawerShiftRequest) UnmarshalJSON(data []byte) error { - type unmarshaler RetrieveCashDrawerShiftRequest +func (s *SearchTeamMembersQuery) UnmarshalJSON(data []byte) error { + type unmarshaler SearchTeamMembersQuery var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RetrieveCashDrawerShiftRequest(value) + *s = SearchTeamMembersQuery(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *RetrieveCashDrawerShiftRequest) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *SearchTeamMembersQuery) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", s) } -type RetrieveCatalogObjectRequest struct { - // If `true`, the response will include additional objects that are related to the - // requested objects. Related objects are defined as any objects referenced by ID by the results in the `objects` field - // of the response. These objects are put in the `related_objects` field. Setting this to `true` is - // helpful when the objects are needed for immediate display to a user. - // This process only goes one level deep. Objects referenced by the related objects will not be included. For example, - // - // if the `objects` field of the response contains a CatalogItem, its associated - // CatalogCategory objects, CatalogTax objects, CatalogImage objects and - // CatalogModifierLists will be returned in the `related_objects` field of the - // response. If the `objects` field of the response contains a CatalogItemVariation, - // its parent CatalogItem will be returned in the `related_objects` field of - // the response. - // - // Default value: `false` - IncludeRelatedObjects *bool `json:"include_related_objects,omitempty" url:"include_related_objects,omitempty"` - // Requests objects as of a specific version of the catalog. This allows you to retrieve historical - // versions of objects. The value to retrieve a specific version of an object can be found - // in the version field of [CatalogObject]($m/CatalogObject)s. If not included, results will - // be from the current version of the catalog. - CatalogVersion *int64 `json:"catalog_version,omitempty" url:"catalog_version,omitempty"` - // Specifies whether or not to include the `path_to_root` list for each returned category instance. The `path_to_root` list consists - // of `CategoryPathToRootNode` objects and specifies the path that starts with the immediate parent category of the returned category - // and ends with its root category. If the returned category is a top-level category, the `path_to_root` list is empty and is not returned - // in the response payload. - IncludeCategoryPathToRoot *bool `json:"include_category_path_to_root,omitempty" url:"include_category_path_to_root,omitempty"` +// Represents a response from a search request containing a filtered list of `TeamMember` objects. +type SearchTeamMembersResponse struct { + // The filtered list of `TeamMember` objects. + TeamMembers []*TeamMember `json:"team_members,omitempty" url:"team_members,omitempty"` + // The opaque cursor for fetching the next page. For more information, see + // [pagination](https://developer.squareup.com/docs/working-with-apis/pagination). + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + // The errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (r *RetrieveCatalogObjectRequest) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *SearchTeamMembersResponse) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *RetrieveCatalogObjectRequest) UnmarshalJSON(data []byte) error { - type unmarshaler RetrieveCatalogObjectRequest +func (s *SearchTeamMembersResponse) UnmarshalJSON(data []byte) error { + type unmarshaler SearchTeamMembersResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RetrieveCatalogObjectRequest(value) + *s = SearchTeamMembersResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *RetrieveCatalogObjectRequest) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *SearchTeamMembersResponse) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", s) } -// Represents a [RetrieveCustomerCustomAttributeDefinition]($e/CustomerCustomAttributes/RetrieveCustomerCustomAttributeDefinition) request. -type RetrieveCustomerCustomAttributeDefinitionRequest struct { - // The current version of the custom attribute definition, which is used for strongly consistent - // reads to guarantee that you receive the most up-to-date data. When included in the request, - // Square returns the specified version or a higher version if one exists. If the specified version - // is higher than the current version, Square returns a `BAD_REQUEST` error. - Version *int `json:"version,omitempty" url:"version,omitempty"` +type SearchTerminalActionsResponse struct { + // Information on errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The requested search result of `TerminalAction`s. + Action []*TerminalAction `json:"action,omitempty" url:"action,omitempty"` + // The pagination cursor to be used in a subsequent request. If empty, + // this is the final response. + // + // See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more + // information. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } - -func (r *RetrieveCustomerCustomAttributeDefinitionRequest) GetExtraProperties() map[string]interface{} { - return r.extraProperties + +func (s *SearchTerminalActionsResponse) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *RetrieveCustomerCustomAttributeDefinitionRequest) UnmarshalJSON(data []byte) error { - type unmarshaler RetrieveCustomerCustomAttributeDefinitionRequest +func (s *SearchTerminalActionsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler SearchTerminalActionsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RetrieveCustomerCustomAttributeDefinitionRequest(value) + *s = SearchTerminalActionsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *RetrieveCustomerCustomAttributeDefinitionRequest) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *SearchTerminalActionsResponse) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", s) } -// Represents a [RetrieveCustomerCustomAttribute]($e/CustomerCustomAttributes/RetrieveCustomerCustomAttribute) request. -type RetrieveCustomerCustomAttributeRequest struct { - // Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of - // the custom attribute. Set this parameter to `true` to get the name and description of the custom - // attribute, information about the data type, or other definition details. The default value is `false`. - WithDefinition *bool `json:"with_definition,omitempty" url:"with_definition,omitempty"` - // The current version of the custom attribute, which is used for strongly consistent reads to - // guarantee that you receive the most up-to-date data. When included in the request, Square - // returns the specified version or a higher version if one exists. If the specified version is - // higher than the current version, Square returns a `BAD_REQUEST` error. - Version *int `json:"version,omitempty" url:"version,omitempty"` +type SearchTerminalCheckoutsResponse struct { + // Information about errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The requested search result of `TerminalCheckout` objects. + Checkouts []*TerminalCheckout `json:"checkouts,omitempty" url:"checkouts,omitempty"` + // The pagination cursor to be used in a subsequent request. If empty, + // this is the final response. + // + // See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. + Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (r *RetrieveCustomerCustomAttributeRequest) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *SearchTerminalCheckoutsResponse) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *RetrieveCustomerCustomAttributeRequest) UnmarshalJSON(data []byte) error { - type unmarshaler RetrieveCustomerCustomAttributeRequest +func (s *SearchTerminalCheckoutsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler SearchTerminalCheckoutsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RetrieveCustomerCustomAttributeRequest(value) + *s = SearchTerminalCheckoutsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *RetrieveCustomerCustomAttributeRequest) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *SearchTerminalCheckoutsResponse) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", s) } -type RetrieveInventoryChangesRequest struct { - // The [Location](entity:Location) IDs to look up as a comma-separated - // list. An empty list queries all locations. - LocationIDs *string `json:"location_ids,omitempty" 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. +type SearchTerminalRefundsResponse struct { + // Information about errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The requested search result of `TerminalRefund` objects. + Refunds []*TerminalRefund `json:"refunds,omitempty" url:"refunds,omitempty"` + // The pagination cursor to be used in a subsequent request. If empty, + // this is the final response. // - // See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. + // See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (r *RetrieveInventoryChangesRequest) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *SearchTerminalRefundsResponse) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *RetrieveInventoryChangesRequest) UnmarshalJSON(data []byte) error { - type unmarshaler RetrieveInventoryChangesRequest +func (s *SearchTerminalRefundsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler SearchTerminalRefundsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RetrieveInventoryChangesRequest(value) + *s = SearchTerminalRefundsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *RetrieveInventoryChangesRequest) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *SearchTerminalRefundsResponse) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", s) } -type RetrieveInventoryCountRequest struct { - // The [Location](entity:Location) IDs to look up as a comma-separated - // list. An empty list queries all locations. - LocationIDs *string `json:"location_ids,omitempty" 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:"cursor,omitempty" url:"cursor,omitempty"` +// Defines supported query expressions to search for vendors by. +type SearchVendorsRequestFilter struct { + // The names of the [Vendor](entity:Vendor) objects to retrieve. + Name []string `json:"name,omitempty" url:"name,omitempty"` + // The statuses of the [Vendor](entity:Vendor) objects to retrieve. + // See [VendorStatus](#type-vendorstatus) for possible values + Status []VendorStatus `json:"status,omitempty" url:"status,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (r *RetrieveInventoryCountRequest) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *SearchVendorsRequestFilter) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *RetrieveInventoryCountRequest) UnmarshalJSON(data []byte) error { - type unmarshaler RetrieveInventoryCountRequest +func (s *SearchVendorsRequestFilter) UnmarshalJSON(data []byte) error { + type unmarshaler SearchVendorsRequestFilter var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RetrieveInventoryCountRequest(value) + *s = SearchVendorsRequestFilter(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *RetrieveInventoryCountRequest) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *SearchVendorsRequestFilter) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", s) } -type RetrieveLocationBookingProfileRequest struct { +// Defines a sorter used to sort results from [SearchVendors](api-endpoint:Vendors-SearchVendors). +type SearchVendorsRequestSort struct { + // Specifies the sort key to sort the returned vendors. + // See [Field](#type-field) for possible values + Field *SearchVendorsRequestSortField `json:"field,omitempty" url:"field,omitempty"` + // Specifies the sort order for the returned vendors. + // See [SortOrder](#type-sortorder) for possible values + Order *SortOrder `json:"order,omitempty" url:"order,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (r *RetrieveLocationBookingProfileRequest) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *SearchVendorsRequestSort) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *RetrieveLocationBookingProfileRequest) UnmarshalJSON(data []byte) error { - type unmarshaler RetrieveLocationBookingProfileRequest +func (s *SearchVendorsRequestSort) UnmarshalJSON(data []byte) error { + type unmarshaler SearchVendorsRequestSort var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RetrieveLocationBookingProfileRequest(value) + *s = SearchVendorsRequestSort(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *RetrieveLocationBookingProfileRequest) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *SearchVendorsRequestSort) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", s) } -type RetrieveLocationBookingProfileResponse struct { - // The requested location booking profile. - LocationBookingProfile *LocationBookingProfile `json:"location_booking_profile,omitempty" url:"location_booking_profile,omitempty"` - // Errors that occurred during the request. +// The field to sort the returned [Vendor](entity:Vendor) objects by. +type SearchVendorsRequestSortField string + +const ( + SearchVendorsRequestSortFieldName SearchVendorsRequestSortField = "NAME" + SearchVendorsRequestSortFieldCreatedAt SearchVendorsRequestSortField = "CREATED_AT" +) + +func NewSearchVendorsRequestSortFieldFromString(s string) (SearchVendorsRequestSortField, error) { + switch s { + case "NAME": + return SearchVendorsRequestSortFieldName, nil + case "CREATED_AT": + return SearchVendorsRequestSortFieldCreatedAt, nil + } + var t SearchVendorsRequestSortField + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SearchVendorsRequestSortField) Ptr() *SearchVendorsRequestSortField { + return &s +} + +// Represents an output from a call to [SearchVendors](api-endpoint:Vendors-SearchVendors). +type SearchVendorsResponse struct { + // Errors encountered when the request fails. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The [Vendor](entity:Vendor) objects matching the specified search filter. + Vendors []*Vendor `json:"vendors,omitempty" url:"vendors,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 (r *RetrieveLocationBookingProfileResponse) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *SearchVendorsResponse) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *RetrieveLocationBookingProfileResponse) UnmarshalJSON(data []byte) error { - type unmarshaler RetrieveLocationBookingProfileResponse +func (s *SearchVendorsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler SearchVendorsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RetrieveLocationBookingProfileResponse(value) + *s = SearchVendorsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *RetrieveLocationBookingProfileResponse) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *SearchVendorsResponse) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", s) } -// Represents a [RetrieveLocationCustomAttributeDefinition]($e/LocationCustomAttributes/RetrieveLocationCustomAttributeDefinition) response. -// Either `custom_attribute_definition` or `errors` is present in the response. -type RetrieveLocationCustomAttributeDefinitionResponse struct { - // The retrieved custom attribute definition. - CustomAttributeDefinition *CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"custom_attribute_definition,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// A query filter to search for buyer-accessible appointment segments by. +type SegmentFilter struct { + // The ID of the [CatalogItemVariation](entity:CatalogItemVariation) object representing the service booked in this segment. + ServiceVariationID string `json:"service_variation_id" url:"service_variation_id"` + // A query filter to search for buyer-accessible appointment segments with service-providing team members matching the specified list of team member IDs. Supported query expressions are + // + // - `ANY`: return the appointment segments with team members whose IDs match any member in this list. + // - `NONE`: return the appointment segments with team members whose IDs are not in this list. + // - `ALL`: not supported. + // + // When no expression is specified, any service-providing team member is eligible to fulfill the Booking. + TeamMemberIDFilter *FilterValue `json:"team_member_id_filter,omitempty" url:"team_member_id_filter,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (r *RetrieveLocationCustomAttributeDefinitionResponse) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *SegmentFilter) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *RetrieveLocationCustomAttributeDefinitionResponse) UnmarshalJSON(data []byte) error { - type unmarshaler RetrieveLocationCustomAttributeDefinitionResponse +func (s *SegmentFilter) UnmarshalJSON(data []byte) error { + type unmarshaler SegmentFilter var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RetrieveLocationCustomAttributeDefinitionResponse(value) + *s = SegmentFilter(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *RetrieveLocationCustomAttributeDefinitionResponse) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *SegmentFilter) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", s) } -// Represents a [RetrieveLocationCustomAttribute]($e/LocationCustomAttributes/RetrieveLocationCustomAttribute) response. -// Either `custom_attribute_definition` or `errors` is present in the response. -type RetrieveLocationCustomAttributeResponse struct { - // The retrieved custom attribute. If `with_definition` was set to `true` in the request, - // the custom attribute definition is returned in the `definition` field. - CustomAttribute *CustomAttribute `json:"custom_attribute,omitempty" url:"custom_attribute,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +type SelectOption struct { + // The reference id for the option. + ReferenceID string `json:"reference_id" url:"reference_id"` + // The title text that displays in the select option button. + Title string `json:"title" url:"title"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (r *RetrieveLocationCustomAttributeResponse) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *SelectOption) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *RetrieveLocationCustomAttributeResponse) UnmarshalJSON(data []byte) error { - type unmarshaler RetrieveLocationCustomAttributeResponse +func (s *SelectOption) UnmarshalJSON(data []byte) error { + type unmarshaler SelectOption var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RetrieveLocationCustomAttributeResponse(value) + *s = SelectOption(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *RetrieveLocationCustomAttributeResponse) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *SelectOption) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", s) } -type RetrieveLocationSettingsRequest struct { +type SelectOptions struct { + // The title text to display in the select flow on the Terminal. + Title string `json:"title" url:"title"` + // The body text to display in the select flow on the Terminal. + Body string `json:"body" url:"body"` + // Represents the buttons/options that should be displayed in the select flow on the Terminal. + Options []*SelectOption `json:"options,omitempty" url:"options,omitempty"` + // The buyer’s selected option. + SelectedOption *SelectOption `json:"selected_option,omitempty" url:"selected_option,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (r *RetrieveLocationSettingsRequest) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *SelectOptions) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *RetrieveLocationSettingsRequest) UnmarshalJSON(data []byte) error { - type unmarshaler RetrieveLocationSettingsRequest +func (s *SelectOptions) UnmarshalJSON(data []byte) error { + type unmarshaler SelectOptions var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RetrieveLocationSettingsRequest(value) + *s = SelectOptions(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *RetrieveLocationSettingsRequest) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *SelectOptions) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", s) } -type RetrieveLocationSettingsResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The location settings. - LocationSettings *CheckoutLocationSettings `json:"location_settings,omitempty" url:"location_settings,omitempty"` +// A record of the hourly rate, start, and end times for a single work shift +// for an employee. This might include a record of the start and end times for breaks +// taken during the shift. +type Shift struct { + // The UUID for this object. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The ID of the employee this shift belongs to. DEPRECATED at version 2020-08-26. Use `team_member_id` instead. + EmployeeID *string `json:"employee_id,omitempty" url:"employee_id,omitempty"` + // The ID of the location this shift occurred at. The location should be based on + // where the employee clocked in. + LocationID string `json:"location_id" url:"location_id"` + // The read-only convenience value that is calculated from the location based + // on the `location_id`. Format: the IANA timezone database identifier for the + // location timezone. + Timezone *string `json:"timezone,omitempty" url:"timezone,omitempty"` + // RFC 3339; shifted to the location timezone + offset. Precision up to the + // minute is respected; seconds are truncated. + StartAt string `json:"start_at" url:"start_at"` + // RFC 3339; shifted to the timezone + offset. Precision up to the minute is + // respected; seconds are truncated. + EndAt *string `json:"end_at,omitempty" url:"end_at,omitempty"` + // Job and pay related information. If the wage is not set on create, it defaults to a wage + // of zero. If the title is not set on create, it defaults to the name of the role the employee + // is assigned to, if any. + Wage *ShiftWage `json:"wage,omitempty" url:"wage,omitempty"` + // A list of all the paid or unpaid breaks that were taken during this shift. + Breaks []*Break `json:"breaks,omitempty" url:"breaks,omitempty"` + // Describes the working state of the current `Shift`. + // See [ShiftStatus](#type-shiftstatus) for possible values + Status *ShiftStatus `json:"status,omitempty" url:"status,omitempty"` + // Used for resolving concurrency issues. The request fails if the version + // provided does not match the server version at the time of the request. If not provided, + // Square executes a blind write; potentially overwriting data from another + // write. + Version *int `json:"version,omitempty" url:"version,omitempty"` + // A read-only timestamp in RFC 3339 format; presented in UTC. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // A read-only timestamp in RFC 3339 format; presented in UTC. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // The ID of the team member this shift belongs to. Replaced `employee_id` at version "2020-08-26". + TeamMemberID *string `json:"team_member_id,omitempty" url:"team_member_id,omitempty"` + // The tips declared by the team member for the shift. + DeclaredCashTipMoney *Money `json:"declared_cash_tip_money,omitempty" url:"declared_cash_tip_money,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (r *RetrieveLocationSettingsResponse) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *Shift) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *RetrieveLocationSettingsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler RetrieveLocationSettingsResponse +func (s *Shift) UnmarshalJSON(data []byte) error { + type unmarshaler Shift var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RetrieveLocationSettingsResponse(value) + *s = Shift(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *RetrieveLocationSettingsResponse) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *Shift) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", s) } -// Represents a [RetrieveMerchantCustomAttributeDefinition]($e/MerchantCustomAttributes/RetrieveMerchantCustomAttributeDefinition) response. -// Either `custom_attribute_definition` or `errors` is present in the response. -type RetrieveMerchantCustomAttributeDefinitionResponse struct { - // The retrieved custom attribute definition. - CustomAttributeDefinition *CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"custom_attribute_definition,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Defines a filter used in a search for `Shift` records. `AND` logic is +// used by Square's servers to apply each filter property specified. +type ShiftFilter struct { + // Fetch shifts for the specified location. + LocationIDs []string `json:"location_ids,omitempty" url:"location_ids,omitempty"` + // Fetch shifts for the specified employees. DEPRECATED at version 2020-08-26. Use `team_member_ids` instead. + EmployeeIDs []string `json:"employee_ids,omitempty" url:"employee_ids,omitempty"` + // Fetch a `Shift` instance by `Shift.status`. + // See [ShiftFilterStatus](#type-shiftfilterstatus) for possible values + Status *ShiftFilterStatus `json:"status,omitempty" url:"status,omitempty"` + // Fetch `Shift` instances that start in the time range - Inclusive. + Start *TimeRange `json:"start,omitempty" url:"start,omitempty"` + // Fetch the `Shift` instances that end in the time range - Inclusive. + End *TimeRange `json:"end,omitempty" url:"end,omitempty"` + // Fetch the `Shift` instances based on the workday date range. + Workday *ShiftWorkday `json:"workday,omitempty" url:"workday,omitempty"` + // Fetch shifts for the specified team members. Replaced `employee_ids` at version "2020-08-26". + TeamMemberIDs []string `json:"team_member_ids,omitempty" url:"team_member_ids,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (r *RetrieveMerchantCustomAttributeDefinitionResponse) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *ShiftFilter) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *RetrieveMerchantCustomAttributeDefinitionResponse) UnmarshalJSON(data []byte) error { - type unmarshaler RetrieveMerchantCustomAttributeDefinitionResponse +func (s *ShiftFilter) UnmarshalJSON(data []byte) error { + type unmarshaler ShiftFilter var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RetrieveMerchantCustomAttributeDefinitionResponse(value) + *s = ShiftFilter(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *RetrieveMerchantCustomAttributeDefinitionResponse) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *ShiftFilter) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", s) +} + +// Specifies the `status` of `Shift` records to be returned. +type ShiftFilterStatus string + +const ( + ShiftFilterStatusDoNotUse ShiftFilterStatus = "DO_NOT_USE" + ShiftFilterStatusOpen ShiftFilterStatus = "OPEN" + ShiftFilterStatusClosed ShiftFilterStatus = "CLOSED" +) + +func NewShiftFilterStatusFromString(s string) (ShiftFilterStatus, error) { + switch s { + case "DO_NOT_USE": + return ShiftFilterStatusDoNotUse, nil + case "OPEN": + return ShiftFilterStatusOpen, nil + case "CLOSED": + return ShiftFilterStatusClosed, nil + } + var t ShiftFilterStatus + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s ShiftFilterStatus) Ptr() *ShiftFilterStatus { + return &s } -// Represents a [RetrieveMerchantCustomAttribute]($e/MerchantCustomAttributes/RetrieveMerchantCustomAttribute) response. -// Either `custom_attribute_definition` or `errors` is present in the response. -type RetrieveMerchantCustomAttributeResponse struct { - // The retrieved custom attribute. If `with_definition` was set to `true` in the request, - // the custom attribute definition is returned in the `definition` field. - CustomAttribute *CustomAttribute `json:"custom_attribute,omitempty" url:"custom_attribute,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// The parameters of a `Shift` search query, which includes filter and sort options. +type ShiftQuery struct { + // Query filter options. + Filter *ShiftFilter `json:"filter,omitempty" url:"filter,omitempty"` + // Sort order details. + Sort *ShiftSort `json:"sort,omitempty" url:"sort,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (r *RetrieveMerchantCustomAttributeResponse) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *ShiftQuery) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *RetrieveMerchantCustomAttributeResponse) UnmarshalJSON(data []byte) error { - type unmarshaler RetrieveMerchantCustomAttributeResponse +func (s *ShiftQuery) UnmarshalJSON(data []byte) error { + type unmarshaler ShiftQuery var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RetrieveMerchantCustomAttributeResponse(value) + *s = ShiftQuery(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *RetrieveMerchantCustomAttributeResponse) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *ShiftQuery) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", s) } -type RetrieveMerchantSettingsRequest struct { +// Sets the sort order of search results. +type ShiftSort struct { + // The field to sort on. + // See [ShiftSortField](#type-shiftsortfield) for possible values + Field *ShiftSortField `json:"field,omitempty" url:"field,omitempty"` + // The order in which results are returned. Defaults to DESC. + // See [SortOrder](#type-sortorder) for possible values + Order *SortOrder `json:"order,omitempty" url:"order,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (r *RetrieveMerchantSettingsRequest) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *ShiftSort) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *RetrieveMerchantSettingsRequest) UnmarshalJSON(data []byte) error { - type unmarshaler RetrieveMerchantSettingsRequest +func (s *ShiftSort) UnmarshalJSON(data []byte) error { + type unmarshaler ShiftSort var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RetrieveMerchantSettingsRequest(value) + *s = ShiftSort(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *RetrieveMerchantSettingsRequest) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *ShiftSort) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", s) } -type RetrieveMerchantSettingsResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The merchant settings. - MerchantSettings *CheckoutMerchantSettings `json:"merchant_settings,omitempty" url:"merchant_settings,omitempty"` +// Enumerates the `Shift` fields to sort on. +type ShiftSortField string + +const ( + ShiftSortFieldDoNotUse ShiftSortField = "DO_NOT_USE" + ShiftSortFieldStartAt ShiftSortField = "START_AT" + ShiftSortFieldEndAt ShiftSortField = "END_AT" + ShiftSortFieldCreatedAt ShiftSortField = "CREATED_AT" + ShiftSortFieldUpdatedAt ShiftSortField = "UPDATED_AT" +) + +func NewShiftSortFieldFromString(s string) (ShiftSortField, error) { + switch s { + case "DO_NOT_USE": + return ShiftSortFieldDoNotUse, nil + case "START_AT": + return ShiftSortFieldStartAt, nil + case "END_AT": + return ShiftSortFieldEndAt, nil + case "CREATED_AT": + return ShiftSortFieldCreatedAt, nil + case "UPDATED_AT": + return ShiftSortFieldUpdatedAt, nil + } + var t ShiftSortField + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s ShiftSortField) Ptr() *ShiftSortField { + return &s +} + +// Enumerates the possible status of a `Shift`. +type ShiftStatus string + +const ( + ShiftStatusUnknownStatus ShiftStatus = "UNKNOWN_STATUS" + ShiftStatusOpen ShiftStatus = "OPEN" + ShiftStatusClosed ShiftStatus = "CLOSED" +) + +func NewShiftStatusFromString(s string) (ShiftStatus, error) { + switch s { + case "UNKNOWN_STATUS": + return ShiftStatusUnknownStatus, nil + case "OPEN": + return ShiftStatusOpen, nil + case "CLOSED": + return ShiftStatusClosed, nil + } + var t ShiftStatus + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s ShiftStatus) Ptr() *ShiftStatus { + return &s +} + +// The hourly wage rate used to compensate an employee for this shift. +type ShiftWage struct { + // The name of the job performed during this shift. + Title *string `json:"title,omitempty" url:"title,omitempty"` + // Can be a custom-set hourly wage or the calculated effective hourly + // wage based on the annual wage and hours worked per week. + HourlyRate *Money `json:"hourly_rate,omitempty" url:"hourly_rate,omitempty"` + // The id of the job performed during this shift. Square + // labor-reporting UIs might group shifts together by id. This cannot be used to retrieve the job. + JobID *string `json:"job_id,omitempty" url:"job_id,omitempty"` + // Whether team members are eligible for tips when working this job. + TipEligible *bool `json:"tip_eligible,omitempty" url:"tip_eligible,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (r *RetrieveMerchantSettingsResponse) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *ShiftWage) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *RetrieveMerchantSettingsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler RetrieveMerchantSettingsResponse +func (s *ShiftWage) UnmarshalJSON(data []byte) error { + type unmarshaler ShiftWage var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RetrieveMerchantSettingsResponse(value) + *s = ShiftWage(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *RetrieveMerchantSettingsResponse) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *ShiftWage) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", s) } -// Represents a response from getting an order custom attribute definition. -type RetrieveOrderCustomAttributeDefinitionResponse struct { - // The retrieved custom attribute definition. - CustomAttributeDefinition *CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"custom_attribute_definition,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// A `Shift` search query filter parameter that sets a range of days that +// a `Shift` must start or end in before passing the filter condition. +type ShiftWorkday struct { + // Dates for fetching the shifts. + DateRange *DateRange `json:"date_range,omitempty" url:"date_range,omitempty"` + // The strategy on which the dates are applied. + // See [ShiftWorkdayMatcher](#type-shiftworkdaymatcher) for possible values + MatchShiftsBy *ShiftWorkdayMatcher `json:"match_shifts_by,omitempty" url:"match_shifts_by,omitempty"` + // Location-specific timezones convert workdays to datetime filters. + // Every location included in the query must have a timezone or this field + // must be provided as a fallback. Format: the IANA timezone database + // identifier for the relevant timezone. + DefaultTimezone *string `json:"default_timezone,omitempty" url:"default_timezone,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (r *RetrieveOrderCustomAttributeDefinitionResponse) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *ShiftWorkday) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *RetrieveOrderCustomAttributeDefinitionResponse) UnmarshalJSON(data []byte) error { - type unmarshaler RetrieveOrderCustomAttributeDefinitionResponse +func (s *ShiftWorkday) UnmarshalJSON(data []byte) error { + type unmarshaler ShiftWorkday var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RetrieveOrderCustomAttributeDefinitionResponse(value) + *s = ShiftWorkday(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *RetrieveOrderCustomAttributeDefinitionResponse) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *ShiftWorkday) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", s) } -// Represents a response from getting an order custom attribute. -type RetrieveOrderCustomAttributeResponse struct { - // The retrieved custom attribute. If `with_definition` was set to `true` in the request, the custom attribute definition is returned in the `definition field. - CustomAttribute *CustomAttribute `json:"custom_attribute,omitempty" url:"custom_attribute,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Defines the logic used to apply a workday filter. +type ShiftWorkdayMatcher string + +const ( + ShiftWorkdayMatcherDoNotUse ShiftWorkdayMatcher = "DO_NOT_USE" + ShiftWorkdayMatcherStartAt ShiftWorkdayMatcher = "START_AT" + ShiftWorkdayMatcherEndAt ShiftWorkdayMatcher = "END_AT" + ShiftWorkdayMatcherIntersection ShiftWorkdayMatcher = "INTERSECTION" +) + +func NewShiftWorkdayMatcherFromString(s string) (ShiftWorkdayMatcher, error) { + switch s { + case "DO_NOT_USE": + return ShiftWorkdayMatcherDoNotUse, nil + case "START_AT": + return ShiftWorkdayMatcherStartAt, nil + case "END_AT": + return ShiftWorkdayMatcherEndAt, nil + case "INTERSECTION": + return ShiftWorkdayMatcherIntersection, nil + } + var t ShiftWorkdayMatcher + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s ShiftWorkdayMatcher) Ptr() *ShiftWorkdayMatcher { + return &s +} + +type ShippingFee struct { + // The name for the shipping fee. + Name *string `json:"name,omitempty" url:"name,omitempty"` + // The amount and currency for the shipping fee. + Charge *Money `json:"charge,omitempty" url:"charge,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (r *RetrieveOrderCustomAttributeResponse) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *ShippingFee) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *RetrieveOrderCustomAttributeResponse) UnmarshalJSON(data []byte) error { - type unmarshaler RetrieveOrderCustomAttributeResponse +func (s *ShippingFee) UnmarshalJSON(data []byte) error { + type unmarshaler ShippingFee var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RetrieveOrderCustomAttributeResponse(value) + *s = ShippingFee(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *RetrieveOrderCustomAttributeResponse) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *ShippingFee) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", s) } -// Defines input parameters in a request to the -// [RetrieveSubscription]($e/Subscriptions/RetrieveSubscription) endpoint. -type RetrieveSubscriptionRequest struct { - // A query parameter to specify related information to be included in the response. - // - // The supported query parameter values are: - // - // - `actions`: to include scheduled actions on the targeted subscription. - Include *string `json:"include,omitempty" url:"include,omitempty"` +type SignatureImage struct { + // The mime/type of the image data. + // Use `image/png;base64` for png. + ImageType *string `json:"image_type,omitempty" url:"image_type,omitempty"` + // The base64 representation of the image. + Data *string `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (r *RetrieveSubscriptionRequest) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *SignatureImage) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *RetrieveSubscriptionRequest) UnmarshalJSON(data []byte) error { - type unmarshaler RetrieveSubscriptionRequest +func (s *SignatureImage) UnmarshalJSON(data []byte) error { + type unmarshaler SignatureImage var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RetrieveSubscriptionRequest(value) + *s = SignatureImage(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *RetrieveSubscriptionRequest) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *SignatureImage) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", s) } -// Request object for [RetrieveTokenStatus] endpoint. -type RetrieveTokenStatusRequest struct { +type SignatureOptions struct { + // The title text to display in the signature capture flow on the Terminal. + Title string `json:"title" url:"title"` + // The body text to display in the signature capture flow on the Terminal. + Body string `json:"body" url:"body"` + // An image representation of the collected signature. + Signature []*SignatureImage `json:"signature,omitempty" url:"signature,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (r *RetrieveTokenStatusRequest) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *SignatureOptions) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *RetrieveTokenStatusRequest) UnmarshalJSON(data []byte) error { - type unmarshaler RetrieveTokenStatusRequest +func (s *SignatureOptions) UnmarshalJSON(data []byte) error { + type unmarshaler SignatureOptions var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RetrieveTokenStatusRequest(value) + *s = SignatureOptions(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *RetrieveTokenStatusRequest) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *SignatureOptions) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", s) } -// Defines the fields that are included in the response body of -// a request to the `RetrieveTokenStatus` endpoint. -type RetrieveTokenStatusResponse struct { - // The list of scopes associated with an access token. - Scopes []string `json:"scopes,omitempty" url:"scopes,omitempty"` - // The date and time when the `access_token` expires, in RFC 3339 format. Empty if the token never expires. - ExpiresAt *string `json:"expires_at,omitempty" url:"expires_at,omitempty"` - // The Square-issued application ID associated with the access token. This is the same application ID used to obtain the token. - ClientID *string `json:"client_id,omitempty" url:"client_id,omitempty"` - // The ID of the authorizing merchant's business. - MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Represents a Square Online site, which is an online store for a Square seller. +type Site struct { + // The Square-assigned ID of the site. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The title of the site. + SiteTitle *string `json:"site_title,omitempty" url:"site_title,omitempty"` + // The domain of the site (without the protocol). For example, `mysite1.square.site`. + Domain *string `json:"domain,omitempty" url:"domain,omitempty"` + // Indicates whether the site is published. + IsPublished *bool `json:"is_published,omitempty" url:"is_published,omitempty"` + // The timestamp of when the site was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The timestamp of when the site was last updated, in RFC 3339 format. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (r *RetrieveTokenStatusResponse) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *Site) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *RetrieveTokenStatusResponse) UnmarshalJSON(data []byte) error { - type unmarshaler RetrieveTokenStatusResponse +func (s *Site) UnmarshalJSON(data []byte) error { + type unmarshaler Site var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RetrieveTokenStatusResponse(value) + *s = Site(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *RetrieveTokenStatusResponse) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *Site) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", s) } -type RevokeTokenResponse struct { - // If the request is successful, this is `true`. - Success *bool `json:"success,omitempty" url:"success,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Represents the snippet that is added to a Square Online site. The snippet code is injected into the `head` element of all pages on the site, except for checkout pages. +type Snippet struct { + // The Square-assigned ID for the snippet. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The ID of the site that contains the snippet. + SiteID *string `json:"site_id,omitempty" url:"site_id,omitempty"` + // The snippet code, which can contain valid HTML, JavaScript, or both. + Content string `json:"content" url:"content"` + // The timestamp of when the snippet was initially added to the site, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The timestamp of when the snippet was last updated on the site, in RFC 3339 format. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (r *RevokeTokenResponse) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *Snippet) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *RevokeTokenResponse) UnmarshalJSON(data []byte) error { - type unmarshaler RevokeTokenResponse +func (s *Snippet) UnmarshalJSON(data []byte) error { + type unmarshaler Snippet var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RevokeTokenResponse(value) + *s = Snippet(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *RevokeTokenResponse) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *Snippet) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", s) } -// Represents fraud risk information for the associated payment. -// -// When you take a payment through Square's Payments API (using the `CreatePayment` -// endpoint), Square evaluates it and assigns a risk level to the payment. Sellers -// can use this information to determine the course of action (for example, -// provide the goods/services or refund the payment). -type RiskEvaluation struct { - // The timestamp when payment risk was evaluated, in RFC 3339 format. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The risk level associated with the payment - // See [RiskEvaluationRiskLevel](#type-riskevaluationrisklevel) for possible values - RiskLevel *RiskEvaluationRiskLevel `json:"risk_level,omitempty" url:"risk_level,omitempty"` +type SnippetResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The snippet. + Snippet *Snippet `json:"snippet,omitempty" url:"snippet,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (r *RiskEvaluation) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (s *SnippetResponse) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (r *RiskEvaluation) UnmarshalJSON(data []byte) error { - type unmarshaler RiskEvaluation +func (s *SnippetResponse) UnmarshalJSON(data []byte) error { + type unmarshaler SnippetResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RiskEvaluation(value) + *s = SnippetResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { return err } - r.extraProperties = extraProperties + s.extraProperties = extraProperties - r._rawJSON = json.RawMessage(data) + s._rawJSON = json.RawMessage(data) return nil } -func (r *RiskEvaluation) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (s *SnippetResponse) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := core.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", s) } -type RiskEvaluationRiskLevel string +// The order (e.g., chronological or alphabetical) in which results from a request are returned. +type SortOrder string const ( - RiskEvaluationRiskLevelPending RiskEvaluationRiskLevel = "PENDING" - RiskEvaluationRiskLevelNormal RiskEvaluationRiskLevel = "NORMAL" - RiskEvaluationRiskLevelModerate RiskEvaluationRiskLevel = "MODERATE" - RiskEvaluationRiskLevelHigh RiskEvaluationRiskLevel = "HIGH" + SortOrderDesc SortOrder = "DESC" + SortOrderAsc SortOrder = "ASC" ) -func NewRiskEvaluationRiskLevelFromString(s string) (RiskEvaluationRiskLevel, error) { +func NewSortOrderFromString(s string) (SortOrder, error) { switch s { - case "PENDING": - return RiskEvaluationRiskLevelPending, nil - case "NORMAL": - return RiskEvaluationRiskLevelNormal, nil - case "MODERATE": - return RiskEvaluationRiskLevelModerate, nil - case "HIGH": - return RiskEvaluationRiskLevelHigh, nil + case "DESC": + return SortOrderDesc, nil + case "ASC": + return SortOrderAsc, nil } - var t RiskEvaluationRiskLevel + var t SortOrder return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (r RiskEvaluationRiskLevel) Ptr() *RiskEvaluationRiskLevel { - return &r +func (s SortOrder) Ptr() *SortOrder { + return &s } -// Describes save-card action fields. -type SaveCardOptions struct { - // The square-assigned ID of the customer linked to the saved card. - CustomerID string `json:"customer_id" url:"customer_id"` - // The id of the created card-on-file. - CardID *string `json:"card_id,omitempty" url:"card_id,omitempty"` - // An optional user-defined reference ID that can be used to associate - // this `Card` to another entity in an external system. For example, a customer - // ID generated by a third-party system. - ReferenceID *string `json:"reference_id,omitempty" url:"reference_id,omitempty"` +// Represents information about the application used to generate a change. +type SourceApplication struct { + // **Read only** The [product](entity:Product) type of the application. + // See [Product](#type-product) for possible values + Product *Product `json:"product,omitempty" url:"product,omitempty"` + // **Read only** The Square-assigned ID of the application. This field is used only if the + // [product](entity:Product) type is `EXTERNAL_API`. + ApplicationID *string `json:"application_id,omitempty" url:"application_id,omitempty"` + // **Read only** The display name of the application + // (for example, `"Custom Application"` or `"Square POS 4.74 for Android"`). + Name *string `json:"name,omitempty" url:"name,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SaveCardOptions) GetExtraProperties() map[string]interface{} { +func (s *SourceApplication) GetExtraProperties() map[string]interface{} { return s.extraProperties } -func (s *SaveCardOptions) UnmarshalJSON(data []byte) error { - type unmarshaler SaveCardOptions +func (s *SourceApplication) UnmarshalJSON(data []byte) error { + type unmarshaler SourceApplication var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SaveCardOptions(value) + *s = SourceApplication(value) extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { @@ -46931,7 +63660,7 @@ func (s *SaveCardOptions) UnmarshalJSON(data []byte) error { return nil } -func (s *SaveCardOptions) String() string { +func (s *SourceApplication) String() string { if len(s._rawJSON) > 0 { if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value @@ -46943,40 +63672,28 @@ func (s *SaveCardOptions) String() string { return fmt.Sprintf("%#v", s) } -// A query filter to search for buyer-accessible availabilities by. -type SearchAvailabilityFilter struct { - // The query expression to search for buy-accessible availabilities with their starting times falling within the specified time range. - // The time range must be at least 24 hours and at most 32 days long. - // For waitlist availabilities, the time range can be 0 or more up to 367 days long. - StartAtRange *TimeRange `json:"start_at_range,omitempty" url:"start_at_range,omitempty"` - // The query expression to search for buyer-accessible availabilities with their location IDs matching the specified location ID. - // This query expression cannot be set if `booking_id` is set. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` - // The query expression to search for buyer-accessible availabilities matching the specified list of segment filters. - // If the size of the `segment_filters` list is `n`, the search returns availabilities with `n` segments per availability. - // - // This query expression cannot be set if `booking_id` is set. - SegmentFilters []*SegmentFilter `json:"segment_filters,omitempty" url:"segment_filters,omitempty"` - // The query expression to search for buyer-accessible availabilities for an existing booking by matching the specified `booking_id` value. - // This is commonly used to reschedule an appointment. - // If this expression is set, the `location_id` and `segment_filters` expressions cannot be set. - BookingID *string `json:"booking_id,omitempty" url:"booking_id,omitempty"` +// Additional details about Square Account payments. +type SquareAccountDetails struct { + // Unique identifier for the payment source used for this payment. + PaymentSourceToken *string `json:"payment_source_token,omitempty" url:"payment_source_token,omitempty"` + // Information about errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchAvailabilityFilter) GetExtraProperties() map[string]interface{} { +func (s *SquareAccountDetails) GetExtraProperties() map[string]interface{} { return s.extraProperties } -func (s *SearchAvailabilityFilter) UnmarshalJSON(data []byte) error { - type unmarshaler SearchAvailabilityFilter +func (s *SquareAccountDetails) UnmarshalJSON(data []byte) error { + type unmarshaler SquareAccountDetails var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchAvailabilityFilter(value) + *s = SquareAccountDetails(value) extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { @@ -46988,7 +63705,7 @@ func (s *SearchAvailabilityFilter) UnmarshalJSON(data []byte) error { return nil } -func (s *SearchAvailabilityFilter) String() string { +func (s *SquareAccountDetails) String() string { if len(s._rawJSON) > 0 { if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value @@ -47000,26 +63717,30 @@ func (s *SearchAvailabilityFilter) String() string { return fmt.Sprintf("%#v", s) } -// The query used to search for buyer-accessible availabilities of bookings. -type SearchAvailabilityQuery struct { - // The query filter to search for buyer-accessible availabilities of existing bookings. - Filter *SearchAvailabilityFilter `json:"filter,omitempty" url:"filter,omitempty"` +// Contains the name and abbreviation for standard measurement unit. +type StandardUnitDescription struct { + // Identifies the measurement unit being described. + Unit *MeasurementUnit `json:"unit,omitempty" url:"unit,omitempty"` + // UI display name of the measurement unit. For example, 'Pound'. + Name *string `json:"name,omitempty" url:"name,omitempty"` + // UI display abbreviation for the measurement unit. For example, 'lb'. + Abbreviation *string `json:"abbreviation,omitempty" url:"abbreviation,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchAvailabilityQuery) GetExtraProperties() map[string]interface{} { +func (s *StandardUnitDescription) GetExtraProperties() map[string]interface{} { return s.extraProperties } -func (s *SearchAvailabilityQuery) UnmarshalJSON(data []byte) error { - type unmarshaler SearchAvailabilityQuery +func (s *StandardUnitDescription) UnmarshalJSON(data []byte) error { + type unmarshaler StandardUnitDescription var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchAvailabilityQuery(value) + *s = StandardUnitDescription(value) extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { @@ -47031,7 +63752,7 @@ func (s *SearchAvailabilityQuery) UnmarshalJSON(data []byte) error { return nil } -func (s *SearchAvailabilityQuery) String() string { +func (s *StandardUnitDescription) String() string { if len(s._rawJSON) > 0 { if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value @@ -47043,27 +63764,28 @@ func (s *SearchAvailabilityQuery) String() string { return fmt.Sprintf("%#v", s) } -type SearchAvailabilityResponse struct { - // List of appointment slots available for booking. - Availabilities []*Availability `json:"availabilities,omitempty" url:"availabilities,omitempty"` - // Errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Group of standard measurement units. +type StandardUnitDescriptionGroup struct { + // List of standard (non-custom) measurement units in this description group. + StandardUnitDescriptions []*StandardUnitDescription `json:"standard_unit_descriptions,omitempty" url:"standard_unit_descriptions,omitempty"` + // IETF language tag. + LanguageCode *string `json:"language_code,omitempty" url:"language_code,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchAvailabilityResponse) GetExtraProperties() map[string]interface{} { +func (s *StandardUnitDescriptionGroup) GetExtraProperties() map[string]interface{} { return s.extraProperties } -func (s *SearchAvailabilityResponse) UnmarshalJSON(data []byte) error { - type unmarshaler SearchAvailabilityResponse +func (s *StandardUnitDescriptionGroup) UnmarshalJSON(data []byte) error { + type unmarshaler StandardUnitDescriptionGroup var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchAvailabilityResponse(value) + *s = StandardUnitDescriptionGroup(value) extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { @@ -47075,7 +63797,7 @@ func (s *SearchAvailabilityResponse) UnmarshalJSON(data []byte) error { return nil } -func (s *SearchAvailabilityResponse) String() string { +func (s *StandardUnitDescriptionGroup) String() string { if len(s._rawJSON) > 0 { if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value @@ -47087,55 +63809,23 @@ func (s *SearchAvailabilityResponse) String() string { return fmt.Sprintf("%#v", s) } -// Defines supported stock levels of the item inventory. -type SearchCatalogItemsRequestStockLevel string - -const ( - SearchCatalogItemsRequestStockLevelOut SearchCatalogItemsRequestStockLevel = "OUT" - SearchCatalogItemsRequestStockLevelLow SearchCatalogItemsRequestStockLevel = "LOW" -) - -func NewSearchCatalogItemsRequestStockLevelFromString(s string) (SearchCatalogItemsRequestStockLevel, error) { - switch s { - case "OUT": - return SearchCatalogItemsRequestStockLevelOut, nil - case "LOW": - return SearchCatalogItemsRequestStockLevelLow, nil - } - var t SearchCatalogItemsRequestStockLevel - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (s SearchCatalogItemsRequestStockLevel) Ptr() *SearchCatalogItemsRequestStockLevel { - return &s -} - -// Defines the response body returned from the [SearchCatalogItems]($e/Catalog/SearchCatalogItems) endpoint. -type SearchCatalogItemsResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // Returned items matching the specified query expressions. - Items []*CatalogObject `json:"items,omitempty" url:"items,omitempty"` - // Pagination token used in the next request to return more of the search result. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // Ids of returned item variations matching the specified query expression. - MatchedVariationIDs []string `json:"matched_variation_ids,omitempty" url:"matched_variation_ids,omitempty"` - +// Defines the parameters for a `SubmitEvidence` request. +type SubmitEvidenceRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchCatalogItemsResponse) GetExtraProperties() map[string]interface{} { +func (s *SubmitEvidenceRequest) GetExtraProperties() map[string]interface{} { return s.extraProperties } -func (s *SearchCatalogItemsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler SearchCatalogItemsResponse +func (s *SubmitEvidenceRequest) UnmarshalJSON(data []byte) error { + type unmarshaler SubmitEvidenceRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchCatalogItemsResponse(value) + *s = SubmitEvidenceRequest(value) extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { @@ -47147,7 +63837,7 @@ func (s *SearchCatalogItemsResponse) UnmarshalJSON(data []byte) error { return nil } -func (s *SearchCatalogItemsResponse) String() string { +func (s *SubmitEvidenceRequest) String() string { if len(s._rawJSON) > 0 { if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value @@ -47159,35 +63849,28 @@ func (s *SearchCatalogItemsResponse) String() string { return fmt.Sprintf("%#v", s) } -type SearchCatalogObjectsResponse struct { - // Any errors that occurred during the request. +// Defines the fields in a `SubmitEvidence` response. +type SubmitEvidenceResponse struct { + // Information about errors encountered during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The pagination cursor to be used in a subsequent request. If unset, this is the final response. - // See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // The CatalogObjects returned. - Objects []*CatalogObject `json:"objects,omitempty" url:"objects,omitempty"` - // A list of CatalogObjects referenced by the objects in the `objects` field. - RelatedObjects []*CatalogObject `json:"related_objects,omitempty" url:"related_objects,omitempty"` - // When the associated product catalog was last updated. Will - // match the value for `end_time` or `cursor` if either field is included in the `SearchCatalog` request. - LatestTime *string `json:"latest_time,omitempty" url:"latest_time,omitempty"` + // The `Dispute` for which evidence was submitted. + Dispute *Dispute `json:"dispute,omitempty" url:"dispute,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchCatalogObjectsResponse) GetExtraProperties() map[string]interface{} { +func (s *SubmitEvidenceResponse) GetExtraProperties() map[string]interface{} { return s.extraProperties } -func (s *SearchCatalogObjectsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler SearchCatalogObjectsResponse +func (s *SubmitEvidenceResponse) UnmarshalJSON(data []byte) error { + type unmarshaler SubmitEvidenceResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchCatalogObjectsResponse(value) + *s = SubmitEvidenceResponse(value) extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { @@ -47199,7 +63882,7 @@ func (s *SearchCatalogObjectsResponse) UnmarshalJSON(data []byte) error { return nil } -func (s *SearchCatalogObjectsResponse) String() string { +func (s *SubmitEvidenceResponse) String() string { if len(s._rawJSON) > 0 { if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value @@ -47211,44 +63894,107 @@ func (s *SearchCatalogObjectsResponse) String() string { return fmt.Sprintf("%#v", s) } -// Defines the fields that are included in the response body of -// a request to the `SearchCustomers` endpoint. +// Represents a subscription purchased by a customer. // -// Either `errors` or `customers` is present in a given response (never both). -type SearchCustomersResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The customer profiles that match the search query. If any search condition is not met, the result is an empty object (`{}`). - // Only customer profiles with public information (`given_name`, `family_name`, `company_name`, `email_address`, or `phone_number`) - // are included in the response. - Customers []*Customer `json:"customers,omitempty" url:"customers,omitempty"` - // A pagination cursor that can be used during subsequent calls - // to `SearchCustomers` to retrieve the next set of results associated - // with the original query. Pagination cursors are only present when - // a request succeeds and additional results are available. +// For more information, see +// [Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). +type Subscription struct { + // The Square-assigned ID of the subscription. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The ID of the location associated with the subscription. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The ID of the subscribed-to [subscription plan](entity:CatalogSubscriptionPlan). + PlanID *string `json:"plan_id,omitempty" url:"plan_id,omitempty"` + // The ID of the subscribed-to [subscription plan variation](entity:CatalogSubscriptionPlanVariation). + PlanVariationID *string `json:"plan_variation_id,omitempty" url:"plan_variation_id,omitempty"` + // The ID of the subscribing [customer](entity:Customer) profile. + CustomerID *string `json:"customer_id,omitempty" url:"customer_id,omitempty"` + // The `YYYY-MM-DD`-formatted date (for example, 2013-01-15) to start the subscription. + StartDate *string `json:"start_date,omitempty" url:"start_date,omitempty"` + // The `YYYY-MM-DD`-formatted date (for example, 2013-01-15) to cancel the subscription, + // when the subscription status changes to `CANCELED` and the subscription billing stops. // - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // The total count of customers associated with the Square account that match the search query. Only customer profiles with - // public information (`given_name`, `family_name`, `company_name`, `email_address`, or `phone_number`) are counted. This field is - // present only if `count` is set to `true` in the request. - Count *int64 `json:"count,omitempty" url:"count,omitempty"` + // If this field is not set, the subscription ends according its subscription plan. + // + // This field cannot be updated, other than being cleared. + CanceledDate *string `json:"canceled_date,omitempty" url:"canceled_date,omitempty"` + // The `YYYY-MM-DD`-formatted date up to when the subscriber is invoiced for the + // subscription. + // + // After the invoice is sent for a given billing period, + // this date will be the last day of the billing period. + // For example, + // suppose for the month of May a subscriber gets an invoice + // (or charged the card) on May 1. For the monthly billing scenario, + // this date is then set to May 31. + ChargedThroughDate *string `json:"charged_through_date,omitempty" url:"charged_through_date,omitempty"` + // The current status of the subscription. + // See [SubscriptionStatus](#type-subscriptionstatus) for possible values + Status *SubscriptionStatus `json:"status,omitempty" url:"status,omitempty"` + // The tax amount applied when billing the subscription. The + // percentage is expressed in decimal form, using a `'.'` as the decimal + // separator and without a `'%'` sign. For example, a value of `7.5` + // corresponds to 7.5%. + TaxPercentage *string `json:"tax_percentage,omitempty" url:"tax_percentage,omitempty"` + // The IDs of the [invoices](entity:Invoice) created for the + // subscription, listed in order when the invoices were created + // (newest invoices appear first). + InvoiceIDs []string `json:"invoice_ids,omitempty" url:"invoice_ids,omitempty"` + // A custom price which overrides the cost of a subscription plan variation with `STATIC` pricing. + // This field does not affect itemized subscriptions with `RELATIVE` pricing. Instead, + // you should edit the Subscription's [order template](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions#phases-and-order-templates). + PriceOverrideMoney *Money `json:"price_override_money,omitempty" url:"price_override_money,omitempty"` + // The version of the object. When updating an object, the version + // supplied must match the version in the database, otherwise the write will + // be rejected as conflicting. + Version *int64 `json:"version,omitempty" url:"version,omitempty"` + // The timestamp when the subscription was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The ID of the [subscriber's](entity:Customer) [card](entity:Card) + // used to charge for the subscription. + CardID *string `json:"card_id,omitempty" url:"card_id,omitempty"` + // The `YYYY-MM-DD`-formatted date (for example, 2013-01-15) up to when the subscriber is invoiced for the + // subscription. + // + // After the invoice is sent for a given billing period, + // this date will be the last day of the billing period. + // For example, + // suppose for the month of May a subscriber gets an invoice + // (or charged the card) on May 1. For the monthly billing scenario, + // this date is then set to May 31. + PaidUntilDate *string `json:"paid_until_date,omitempty" url:"paid_until_date,omitempty"` + // Timezone that will be used in date calculations for the subscription. + // Defaults to the timezone of the location based on `location_id`. + // Format: the IANA Timezone Database identifier for the location timezone (for example, `America/Los_Angeles`). + Timezone *string `json:"timezone,omitempty" url:"timezone,omitempty"` + // The origination details of the subscription. + Source *SubscriptionSource `json:"source,omitempty" url:"source,omitempty"` + // The list of scheduled actions on this subscription. It is set only in the response from + // [RetrieveSubscription](api-endpoint:Subscriptions-RetrieveSubscription) with the query parameter + // of `include=actions` or from + // [SearchSubscriptions](api-endpoint:Subscriptions-SearchSubscriptions) with the input parameter + // of `include:["actions"]`. + Actions []*SubscriptionAction `json:"actions,omitempty" url:"actions,omitempty"` + // The day of the month on which the subscription will issue invoices and publish orders. + MonthlyBillingAnchorDate *int `json:"monthly_billing_anchor_date,omitempty" url:"monthly_billing_anchor_date,omitempty"` + // array of phases for this subscription + Phases []*Phase `json:"phases,omitempty" url:"phases,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchCustomersResponse) GetExtraProperties() map[string]interface{} { +func (s *Subscription) GetExtraProperties() map[string]interface{} { return s.extraProperties } -func (s *SearchCustomersResponse) UnmarshalJSON(data []byte) error { - type unmarshaler SearchCustomersResponse +func (s *Subscription) UnmarshalJSON(data []byte) error { + type unmarshaler Subscription var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchCustomersResponse(value) + *s = Subscription(value) extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { @@ -47260,7 +64006,7 @@ func (s *SearchCustomersResponse) UnmarshalJSON(data []byte) error { return nil } -func (s *SearchCustomersResponse) String() string { +func (s *Subscription) String() string { if len(s._rawJSON) > 0 { if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value @@ -47272,32 +64018,39 @@ func (s *SearchCustomersResponse) String() string { return fmt.Sprintf("%#v", s) } -// Criteria to filter events by. -type SearchEventsFilter struct { - // Filter events by event types. - EventTypes []string `json:"event_types,omitempty" url:"event_types,omitempty"` - // Filter events by merchant. - MerchantIDs []string `json:"merchant_ids,omitempty" url:"merchant_ids,omitempty"` - // Filter events by location. - LocationIDs []string `json:"location_ids,omitempty" url:"location_ids,omitempty"` - // Filter events by when they were created. - CreatedAt *TimeRange `json:"created_at,omitempty" url:"created_at,omitempty"` +// Represents an action as a pending change to a subscription. +type SubscriptionAction struct { + // The ID of an action scoped to a subscription. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The type of the action. + // See [SubscriptionActionType](#type-subscriptionactiontype) for possible values + Type *SubscriptionActionType `json:"type,omitempty" url:"type,omitempty"` + // The `YYYY-MM-DD`-formatted date when the action occurs on the subscription. + EffectiveDate *string `json:"effective_date,omitempty" url:"effective_date,omitempty"` + // The target subscription plan a subscription switches to, for a `SWAP_PLAN` action. + NewPlanID *string `json:"new_plan_id,omitempty" url:"new_plan_id,omitempty"` + // The new billing anchor day value, for a `CHANGE_BILLING_ANCHOR_DATE` action. + MonthlyBillingAnchorDate *int `json:"monthly_billing_anchor_date,omitempty" url:"monthly_billing_anchor_date,omitempty"` + // A list of Phases, to pass phase-specific information used in the swap. + Phases []*Phase `json:"phases,omitempty" url:"phases,omitempty"` + // The target subscription plan variation that a subscription switches to, for a `SWAP_PLAN` action. + NewPlanVariationID *string `json:"new_plan_variation_id,omitempty" url:"new_plan_variation_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchEventsFilter) GetExtraProperties() map[string]interface{} { +func (s *SubscriptionAction) GetExtraProperties() map[string]interface{} { return s.extraProperties } -func (s *SearchEventsFilter) UnmarshalJSON(data []byte) error { - type unmarshaler SearchEventsFilter +func (s *SubscriptionAction) UnmarshalJSON(data []byte) error { + type unmarshaler SubscriptionAction var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchEventsFilter(value) + *s = SubscriptionAction(value) extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { @@ -47309,7 +64062,7 @@ func (s *SearchEventsFilter) UnmarshalJSON(data []byte) error { return nil } -func (s *SearchEventsFilter) String() string { +func (s *SubscriptionAction) String() string { if len(s._rawJSON) > 0 { if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value @@ -47321,28 +64074,128 @@ func (s *SearchEventsFilter) String() string { return fmt.Sprintf("%#v", s) } -// Contains query criteria for the search. -type SearchEventsQuery struct { - // Criteria to filter events by. - Filter *SearchEventsFilter `json:"filter,omitempty" url:"filter,omitempty"` - // Criteria to sort events by. - Sort *SearchEventsSort `json:"sort,omitempty" url:"sort,omitempty"` +// Supported types of an action as a pending change to a subscription. +type SubscriptionActionType string + +const ( + SubscriptionActionTypeDefaultSubscriptionActionTypeDoNotUse SubscriptionActionType = "DEFAULT_SUBSCRIPTION_ACTION_TYPE_DO_NOT_USE" + SubscriptionActionTypeCancel SubscriptionActionType = "CANCEL" + SubscriptionActionTypePause SubscriptionActionType = "PAUSE" + SubscriptionActionTypeResume SubscriptionActionType = "RESUME" + SubscriptionActionTypeSwapPlan SubscriptionActionType = "SWAP_PLAN" + SubscriptionActionTypeChangeBillingAnchorDate SubscriptionActionType = "CHANGE_BILLING_ANCHOR_DATE" +) + +func NewSubscriptionActionTypeFromString(s string) (SubscriptionActionType, error) { + switch s { + case "DEFAULT_SUBSCRIPTION_ACTION_TYPE_DO_NOT_USE": + return SubscriptionActionTypeDefaultSubscriptionActionTypeDoNotUse, nil + case "CANCEL": + return SubscriptionActionTypeCancel, nil + case "PAUSE": + return SubscriptionActionTypePause, nil + case "RESUME": + return SubscriptionActionTypeResume, nil + case "SWAP_PLAN": + return SubscriptionActionTypeSwapPlan, nil + case "CHANGE_BILLING_ANCHOR_DATE": + return SubscriptionActionTypeChangeBillingAnchorDate, nil + } + var t SubscriptionActionType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SubscriptionActionType) Ptr() *SubscriptionActionType { + return &s +} + +// Determines the billing cadence of a [Subscription](entity:Subscription) +type SubscriptionCadence string + +const ( + SubscriptionCadenceSubscriptionCadenceDoNotUse SubscriptionCadence = "SUBSCRIPTION_CADENCE_DO_NOT_USE" + SubscriptionCadenceDaily SubscriptionCadence = "DAILY" + SubscriptionCadenceWeekly SubscriptionCadence = "WEEKLY" + SubscriptionCadenceEveryTwoWeeks SubscriptionCadence = "EVERY_TWO_WEEKS" + SubscriptionCadenceThirtyDays SubscriptionCadence = "THIRTY_DAYS" + SubscriptionCadenceSixtyDays SubscriptionCadence = "SIXTY_DAYS" + SubscriptionCadenceNinetyDays SubscriptionCadence = "NINETY_DAYS" + SubscriptionCadenceMonthly SubscriptionCadence = "MONTHLY" + SubscriptionCadenceEveryTwoMonths SubscriptionCadence = "EVERY_TWO_MONTHS" + SubscriptionCadenceQuarterly SubscriptionCadence = "QUARTERLY" + SubscriptionCadenceEveryFourMonths SubscriptionCadence = "EVERY_FOUR_MONTHS" + SubscriptionCadenceEverySixMonths SubscriptionCadence = "EVERY_SIX_MONTHS" + SubscriptionCadenceAnnual SubscriptionCadence = "ANNUAL" + SubscriptionCadenceEveryTwoYears SubscriptionCadence = "EVERY_TWO_YEARS" +) + +func NewSubscriptionCadenceFromString(s string) (SubscriptionCadence, error) { + switch s { + case "SUBSCRIPTION_CADENCE_DO_NOT_USE": + return SubscriptionCadenceSubscriptionCadenceDoNotUse, nil + case "DAILY": + return SubscriptionCadenceDaily, nil + case "WEEKLY": + return SubscriptionCadenceWeekly, nil + case "EVERY_TWO_WEEKS": + return SubscriptionCadenceEveryTwoWeeks, nil + case "THIRTY_DAYS": + return SubscriptionCadenceThirtyDays, nil + case "SIXTY_DAYS": + return SubscriptionCadenceSixtyDays, nil + case "NINETY_DAYS": + return SubscriptionCadenceNinetyDays, nil + case "MONTHLY": + return SubscriptionCadenceMonthly, nil + case "EVERY_TWO_MONTHS": + return SubscriptionCadenceEveryTwoMonths, nil + case "QUARTERLY": + return SubscriptionCadenceQuarterly, nil + case "EVERY_FOUR_MONTHS": + return SubscriptionCadenceEveryFourMonths, nil + case "EVERY_SIX_MONTHS": + return SubscriptionCadenceEverySixMonths, nil + case "ANNUAL": + return SubscriptionCadenceAnnual, nil + case "EVERY_TWO_YEARS": + return SubscriptionCadenceEveryTwoYears, nil + } + var t SubscriptionCadence + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SubscriptionCadence) Ptr() *SubscriptionCadence { + return &s +} + +// Published when a [Subscription](entity:Subscription) is created. +type SubscriptionCreatedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents, `"subscription.created"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *SubscriptionCreatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchEventsQuery) GetExtraProperties() map[string]interface{} { +func (s *SubscriptionCreatedEvent) GetExtraProperties() map[string]interface{} { return s.extraProperties } -func (s *SearchEventsQuery) UnmarshalJSON(data []byte) error { - type unmarshaler SearchEventsQuery +func (s *SubscriptionCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler SubscriptionCreatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchEventsQuery(value) + *s = SubscriptionCreatedEvent(value) extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { @@ -47354,7 +64207,7 @@ func (s *SearchEventsQuery) UnmarshalJSON(data []byte) error { return nil } -func (s *SearchEventsQuery) String() string { +func (s *SubscriptionCreatedEvent) String() string { if len(s._rawJSON) > 0 { if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value @@ -47366,38 +64219,29 @@ func (s *SearchEventsQuery) String() string { return fmt.Sprintf("%#v", s) } -// Defines the fields that are included in the response body of -// a request to the [SearchEvents]($e/Events/SearchEvents) endpoint. -// -// Note: if there are errors processing the request, the events field will not be -// present. -type SearchEventsResponse struct { - // Information on errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The list of [Event](entity:Event)s returned by the search. - Events []*Event `json:"events,omitempty" url:"events,omitempty"` - // Contains the metadata of an event. For more information, see [Event](entity:Event). - Metadata []*EventMetadata `json:"metadata,omitempty" url:"metadata,omitempty"` - // When a response is truncated, it includes a cursor that you can use in a subsequent request to fetch the next set of events. If empty, this is the final response. - // - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` +type SubscriptionCreatedEventData struct { + // Name of the affected object’s type, `"subscription"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the affected subscription. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the created subscription. + Object *SubscriptionCreatedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchEventsResponse) GetExtraProperties() map[string]interface{} { +func (s *SubscriptionCreatedEventData) GetExtraProperties() map[string]interface{} { return s.extraProperties } -func (s *SearchEventsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler SearchEventsResponse +func (s *SubscriptionCreatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler SubscriptionCreatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchEventsResponse(value) + *s = SubscriptionCreatedEventData(value) extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { @@ -47409,7 +64253,7 @@ func (s *SearchEventsResponse) UnmarshalJSON(data []byte) error { return nil } -func (s *SearchEventsResponse) String() string { +func (s *SubscriptionCreatedEventData) String() string { if len(s._rawJSON) > 0 { if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value @@ -47421,30 +64265,25 @@ func (s *SearchEventsResponse) String() string { return fmt.Sprintf("%#v", s) } -// Criteria to sort events by. -type SearchEventsSort struct { - // Sort events by event types. - // See [SearchEventsSortField](#type-searcheventssortfield) for possible values - Field *SearchEventsSortField `json:"field,omitempty" url:"field,omitempty"` - // The order to use for sorting the events. - // See [SortOrder](#type-sortorder) for possible values - Order *SortOrder `json:"order,omitempty" url:"order,omitempty"` +type SubscriptionCreatedEventObject struct { + // The created subscription. + Subscription *Subscription `json:"subscription,omitempty" url:"subscription,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchEventsSort) GetExtraProperties() map[string]interface{} { +func (s *SubscriptionCreatedEventObject) GetExtraProperties() map[string]interface{} { return s.extraProperties } -func (s *SearchEventsSort) UnmarshalJSON(data []byte) error { - type unmarshaler SearchEventsSort +func (s *SubscriptionCreatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler SubscriptionCreatedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchEventsSort(value) + *s = SubscriptionCreatedEventObject(value) extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { @@ -47456,7 +64295,7 @@ func (s *SearchEventsSort) UnmarshalJSON(data []byte) error { return nil } -func (s *SearchEventsSort) String() string { +func (s *SubscriptionCreatedEventObject) String() string { if len(s._rawJSON) > 0 { if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value @@ -47468,36 +64307,41 @@ func (s *SearchEventsSort) String() string { return fmt.Sprintf("%#v", s) } -// Specifies the sort key for events returned from a search. -type SearchEventsSortField = string - -// Describes a `SearchInvoices` response. -type SearchInvoicesResponse struct { - // The list of invoices returned by the search. - Invoices []*Invoice `json:"invoices,omitempty" url:"invoices,omitempty"` - // When a response is truncated, it includes a cursor that you can use in a - // subsequent request to fetch the next set of invoices. If empty, this is the final - // response. - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // Information about errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Describes changes to a subscription and the subscription status. +type SubscriptionEvent struct { + // The ID of the subscription event. + ID string `json:"id" url:"id"` + // Type of the subscription event. + // See [SubscriptionEventSubscriptionEventType](#type-subscriptioneventsubscriptioneventtype) for possible values + SubscriptionEventType SubscriptionEventSubscriptionEventType `json:"subscription_event_type" url:"subscription_event_type"` + // The `YYYY-MM-DD`-formatted date (for example, 2013-01-15) when the subscription event occurred. + EffectiveDate string `json:"effective_date" url:"effective_date"` + // The ID of the subscription plan associated with the subscription. + PlanID *string `json:"plan_id,omitempty" url:"plan_id,omitempty"` + // The day-of-the-month the billing anchor date was changed to, if applicable. + MonthlyBillingAnchorDate *int `json:"monthly_billing_anchor_date,omitempty" url:"monthly_billing_anchor_date,omitempty"` + // Additional information about the subscription event. + Info *SubscriptionEventInfo `json:"info,omitempty" url:"info,omitempty"` + // A list of Phases, to pass phase-specific information used in the swap. + Phases []*Phase `json:"phases,omitempty" url:"phases,omitempty"` + // The ID of the subscription plan variation associated with the subscription. + PlanVariationID string `json:"plan_variation_id" url:"plan_variation_id"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchInvoicesResponse) GetExtraProperties() map[string]interface{} { +func (s *SubscriptionEvent) GetExtraProperties() map[string]interface{} { return s.extraProperties } -func (s *SearchInvoicesResponse) UnmarshalJSON(data []byte) error { - type unmarshaler SearchInvoicesResponse +func (s *SubscriptionEvent) UnmarshalJSON(data []byte) error { + type unmarshaler SubscriptionEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchInvoicesResponse(value) + *s = SubscriptionEvent(value) extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { @@ -47509,7 +64353,7 @@ func (s *SearchInvoicesResponse) UnmarshalJSON(data []byte) error { return nil } -func (s *SearchInvoicesResponse) String() string { +func (s *SubscriptionEvent) String() string { if len(s._rawJSON) > 0 { if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value @@ -47519,38 +64363,31 @@ func (s *SearchInvoicesResponse) String() string { return value } return fmt.Sprintf("%#v", s) -} - -// The search criteria for the loyalty accounts. -type SearchLoyaltyAccountsRequestLoyaltyAccountQuery struct { - // The set of mappings to use in the loyalty account search. - // - // This cannot be combined with `customer_ids`. - // - // Max: 30 mappings - Mappings []*LoyaltyAccountMapping `json:"mappings,omitempty" url:"mappings,omitempty"` - // The set of customer IDs to use in the loyalty account search. - // - // This cannot be combined with `mappings`. - // - // Max: 30 customer IDs - CustomerIDs []string `json:"customer_ids,omitempty" url:"customer_ids,omitempty"` +} + +// Provides information about the subscription event. +type SubscriptionEventInfo struct { + // A human-readable explanation for the event. + Detail *string `json:"detail,omitempty" url:"detail,omitempty"` + // An info code indicating the subscription event that occurred. + // See [InfoCode](#type-infocode) for possible values + Code *SubscriptionEventInfoCode `json:"code,omitempty" url:"code,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchLoyaltyAccountsRequestLoyaltyAccountQuery) GetExtraProperties() map[string]interface{} { +func (s *SubscriptionEventInfo) GetExtraProperties() map[string]interface{} { return s.extraProperties } -func (s *SearchLoyaltyAccountsRequestLoyaltyAccountQuery) UnmarshalJSON(data []byte) error { - type unmarshaler SearchLoyaltyAccountsRequestLoyaltyAccountQuery +func (s *SubscriptionEventInfo) UnmarshalJSON(data []byte) error { + type unmarshaler SubscriptionEventInfo var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchLoyaltyAccountsRequestLoyaltyAccountQuery(value) + *s = SubscriptionEventInfo(value) extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { @@ -47562,7 +64399,7 @@ func (s *SearchLoyaltyAccountsRequestLoyaltyAccountQuery) UnmarshalJSON(data []b return nil } -func (s *SearchLoyaltyAccountsRequestLoyaltyAccountQuery) String() string { +func (s *SubscriptionEventInfo) String() string { if len(s._rawJSON) > 0 { if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value @@ -47574,34 +64411,116 @@ func (s *SearchLoyaltyAccountsRequestLoyaltyAccountQuery) String() string { return fmt.Sprintf("%#v", s) } -// A response that includes loyalty accounts that satisfy the search criteria. -type SearchLoyaltyAccountsResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The loyalty accounts that met the search criteria, - // in order of creation date. - LoyaltyAccounts []*LoyaltyAccount `json:"loyalty_accounts,omitempty" url:"loyalty_accounts,omitempty"` - // The pagination cursor to use in a subsequent - // request. If empty, this is the final response. - // For more information, - // see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` +// Supported info codes of a subscription event. +type SubscriptionEventInfoCode string + +const ( + SubscriptionEventInfoCodeLocationNotActive SubscriptionEventInfoCode = "LOCATION_NOT_ACTIVE" + SubscriptionEventInfoCodeLocationCannotAcceptPayment SubscriptionEventInfoCode = "LOCATION_CANNOT_ACCEPT_PAYMENT" + SubscriptionEventInfoCodeCustomerDeleted SubscriptionEventInfoCode = "CUSTOMER_DELETED" + SubscriptionEventInfoCodeCustomerNoEmail SubscriptionEventInfoCode = "CUSTOMER_NO_EMAIL" + SubscriptionEventInfoCodeCustomerNoName SubscriptionEventInfoCode = "CUSTOMER_NO_NAME" + SubscriptionEventInfoCodeUserProvided SubscriptionEventInfoCode = "USER_PROVIDED" + SubscriptionEventInfoCodeInvoiceInvalid SubscriptionEventInfoCode = "INVOICE_INVALID" +) + +func NewSubscriptionEventInfoCodeFromString(s string) (SubscriptionEventInfoCode, error) { + switch s { + case "LOCATION_NOT_ACTIVE": + return SubscriptionEventInfoCodeLocationNotActive, nil + case "LOCATION_CANNOT_ACCEPT_PAYMENT": + return SubscriptionEventInfoCodeLocationCannotAcceptPayment, nil + case "CUSTOMER_DELETED": + return SubscriptionEventInfoCodeCustomerDeleted, nil + case "CUSTOMER_NO_EMAIL": + return SubscriptionEventInfoCodeCustomerNoEmail, nil + case "CUSTOMER_NO_NAME": + return SubscriptionEventInfoCodeCustomerNoName, nil + case "USER_PROVIDED": + return SubscriptionEventInfoCodeUserProvided, nil + case "INVOICE_INVALID": + return SubscriptionEventInfoCodeInvoiceInvalid, nil + } + var t SubscriptionEventInfoCode + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SubscriptionEventInfoCode) Ptr() *SubscriptionEventInfoCode { + return &s +} + +// Supported types of an event occurred to a subscription. +type SubscriptionEventSubscriptionEventType string + +const ( + SubscriptionEventSubscriptionEventTypeDefaultSubscriptionEventTypeDoNotUse SubscriptionEventSubscriptionEventType = "DEFAULT_SUBSCRIPTION_EVENT_TYPE_DO_NOT_USE" + SubscriptionEventSubscriptionEventTypeStartSubscription SubscriptionEventSubscriptionEventType = "START_SUBSCRIPTION" + SubscriptionEventSubscriptionEventTypePlanChange SubscriptionEventSubscriptionEventType = "PLAN_CHANGE" + SubscriptionEventSubscriptionEventTypeStopSubscription SubscriptionEventSubscriptionEventType = "STOP_SUBSCRIPTION" + SubscriptionEventSubscriptionEventTypeDeactivateSubscription SubscriptionEventSubscriptionEventType = "DEACTIVATE_SUBSCRIPTION" + SubscriptionEventSubscriptionEventTypeResumeSubscription SubscriptionEventSubscriptionEventType = "RESUME_SUBSCRIPTION" + SubscriptionEventSubscriptionEventTypePauseSubscription SubscriptionEventSubscriptionEventType = "PAUSE_SUBSCRIPTION" + SubscriptionEventSubscriptionEventTypeBillingAnchorDateChanged SubscriptionEventSubscriptionEventType = "BILLING_ANCHOR_DATE_CHANGED" +) + +func NewSubscriptionEventSubscriptionEventTypeFromString(s string) (SubscriptionEventSubscriptionEventType, error) { + switch s { + case "DEFAULT_SUBSCRIPTION_EVENT_TYPE_DO_NOT_USE": + return SubscriptionEventSubscriptionEventTypeDefaultSubscriptionEventTypeDoNotUse, nil + case "START_SUBSCRIPTION": + return SubscriptionEventSubscriptionEventTypeStartSubscription, nil + case "PLAN_CHANGE": + return SubscriptionEventSubscriptionEventTypePlanChange, nil + case "STOP_SUBSCRIPTION": + return SubscriptionEventSubscriptionEventTypeStopSubscription, nil + case "DEACTIVATE_SUBSCRIPTION": + return SubscriptionEventSubscriptionEventTypeDeactivateSubscription, nil + case "RESUME_SUBSCRIPTION": + return SubscriptionEventSubscriptionEventTypeResumeSubscription, nil + case "PAUSE_SUBSCRIPTION": + return SubscriptionEventSubscriptionEventTypePauseSubscription, nil + case "BILLING_ANCHOR_DATE_CHANGED": + return SubscriptionEventSubscriptionEventTypeBillingAnchorDateChanged, nil + } + var t SubscriptionEventSubscriptionEventType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SubscriptionEventSubscriptionEventType) Ptr() *SubscriptionEventSubscriptionEventType { + return &s +} + +// Describes a phase in a subscription plan variation. For more information, see [Subscription Plans and Variations](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations). +type SubscriptionPhase struct { + // The Square-assigned ID of the subscription phase. This field cannot be changed after a `SubscriptionPhase` is created. + UID *string `json:"uid,omitempty" url:"uid,omitempty"` + // The billing cadence of the phase. For example, weekly or monthly. This field cannot be changed after a `SubscriptionPhase` is created. + // See [SubscriptionCadence](#type-subscriptioncadence) for possible values + Cadence SubscriptionCadence `json:"cadence" url:"cadence"` + // The number of `cadence`s the phase lasts. If not set, the phase never ends. Only the last phase can be indefinite. This field cannot be changed after a `SubscriptionPhase` is created. + Periods *int `json:"periods,omitempty" url:"periods,omitempty"` + // The amount to bill for each `cadence`. Failure to specify this field results in a `MISSING_REQUIRED_PARAMETER` error at runtime. + RecurringPriceMoney *Money `json:"recurring_price_money,omitempty" url:"recurring_price_money,omitempty"` + // The position this phase appears in the sequence of phases defined for the plan, indexed from 0. This field cannot be changed after a `SubscriptionPhase` is created. + Ordinal *int64 `json:"ordinal,omitempty" url:"ordinal,omitempty"` + // The subscription pricing. + Pricing *SubscriptionPricing `json:"pricing,omitempty" url:"pricing,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchLoyaltyAccountsResponse) GetExtraProperties() map[string]interface{} { +func (s *SubscriptionPhase) GetExtraProperties() map[string]interface{} { return s.extraProperties } -func (s *SearchLoyaltyAccountsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler SearchLoyaltyAccountsResponse +func (s *SubscriptionPhase) UnmarshalJSON(data []byte) error { + type unmarshaler SubscriptionPhase var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchLoyaltyAccountsResponse(value) + *s = SubscriptionPhase(value) extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { @@ -47613,7 +64532,7 @@ func (s *SearchLoyaltyAccountsResponse) UnmarshalJSON(data []byte) error { return nil } -func (s *SearchLoyaltyAccountsResponse) String() string { +func (s *SubscriptionPhase) String() string { if len(s._rawJSON) > 0 { if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value @@ -47625,34 +64544,31 @@ func (s *SearchLoyaltyAccountsResponse) String() string { return fmt.Sprintf("%#v", s) } -// A response that contains loyalty events that satisfy the search -// criteria, in order by the `created_at` date. -type SearchLoyaltyEventsResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The loyalty events that satisfy the search criteria. - Events []*LoyaltyEvent `json:"events,omitempty" url:"events,omitempty"` - // The pagination cursor to be used in a subsequent - // request. If empty, this is the final response. - // For more information, - // see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` +// Describes the pricing for the subscription. +type SubscriptionPricing struct { + // RELATIVE or STATIC + // See [SubscriptionPricingType](#type-subscriptionpricingtype) for possible values + Type *SubscriptionPricingType `json:"type,omitempty" url:"type,omitempty"` + // The ids of the discount catalog objects + DiscountIDs []string `json:"discount_ids,omitempty" url:"discount_ids,omitempty"` + // The price of the subscription, if STATIC + PriceMoney *Money `json:"price_money,omitempty" url:"price_money,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchLoyaltyEventsResponse) GetExtraProperties() map[string]interface{} { +func (s *SubscriptionPricing) GetExtraProperties() map[string]interface{} { return s.extraProperties } -func (s *SearchLoyaltyEventsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler SearchLoyaltyEventsResponse +func (s *SubscriptionPricing) UnmarshalJSON(data []byte) error { + type unmarshaler SubscriptionPricing var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchLoyaltyEventsResponse(value) + *s = SubscriptionPricing(value) extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { @@ -47664,7 +64580,7 @@ func (s *SearchLoyaltyEventsResponse) UnmarshalJSON(data []byte) error { return nil } -func (s *SearchLoyaltyEventsResponse) String() string { +func (s *SubscriptionPricing) String() string { if len(s._rawJSON) > 0 { if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value @@ -47676,29 +64592,54 @@ func (s *SearchLoyaltyEventsResponse) String() string { return fmt.Sprintf("%#v", s) } -// The set of search requirements. -type SearchLoyaltyRewardsRequestLoyaltyRewardQuery struct { - // The ID of the [loyalty account](entity:LoyaltyAccount) to which the loyalty reward belongs. - LoyaltyAccountID string `json:"loyalty_account_id" url:"loyalty_account_id"` - // The status of the loyalty reward. - // See [LoyaltyRewardStatus](#type-loyaltyrewardstatus) for possible values - Status *LoyaltyRewardStatus `json:"status,omitempty" url:"status,omitempty"` +// Determines the pricing of a [Subscription](entity:Subscription) +type SubscriptionPricingType string + +const ( + SubscriptionPricingTypeSubscriptionPricingDoNotUse SubscriptionPricingType = "SUBSCRIPTION_PRICING_DO_NOT_USE" + SubscriptionPricingTypeStatic SubscriptionPricingType = "STATIC" + SubscriptionPricingTypeRelative SubscriptionPricingType = "RELATIVE" +) + +func NewSubscriptionPricingTypeFromString(s string) (SubscriptionPricingType, error) { + switch s { + case "SUBSCRIPTION_PRICING_DO_NOT_USE": + return SubscriptionPricingTypeSubscriptionPricingDoNotUse, nil + case "STATIC": + return SubscriptionPricingTypeStatic, nil + case "RELATIVE": + return SubscriptionPricingTypeRelative, nil + } + var t SubscriptionPricingType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SubscriptionPricingType) Ptr() *SubscriptionPricingType { + return &s +} + +// The origination details of the subscription. +type SubscriptionSource struct { + // The name used to identify the place (physical or digital) that + // a subscription originates. If unset, the name defaults to the name + // of the application that created the subscription. + Name *string `json:"name,omitempty" url:"name,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchLoyaltyRewardsRequestLoyaltyRewardQuery) GetExtraProperties() map[string]interface{} { +func (s *SubscriptionSource) GetExtraProperties() map[string]interface{} { return s.extraProperties } -func (s *SearchLoyaltyRewardsRequestLoyaltyRewardQuery) UnmarshalJSON(data []byte) error { - type unmarshaler SearchLoyaltyRewardsRequestLoyaltyRewardQuery +func (s *SubscriptionSource) UnmarshalJSON(data []byte) error { + type unmarshaler SubscriptionSource var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchLoyaltyRewardsRequestLoyaltyRewardQuery(value) + *s = SubscriptionSource(value) extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { @@ -47710,7 +64651,7 @@ func (s *SearchLoyaltyRewardsRequestLoyaltyRewardQuery) UnmarshalJSON(data []byt return nil } -func (s *SearchLoyaltyRewardsRequestLoyaltyRewardQuery) String() string { +func (s *SubscriptionSource) String() string { if len(s._rawJSON) > 0 { if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value @@ -47722,32 +64663,72 @@ func (s *SearchLoyaltyRewardsRequestLoyaltyRewardQuery) String() string { return fmt.Sprintf("%#v", s) } -// A response that includes the loyalty rewards satisfying the search criteria. -type SearchLoyaltyRewardsResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The loyalty rewards that satisfy the search criteria. - // These are returned in descending order by `updated_at`. - Rewards []*LoyaltyReward `json:"rewards,omitempty" url:"rewards,omitempty"` - // The pagination cursor to be used in a subsequent - // request. If empty, this is the final response. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` +// Supported subscription statuses. +type SubscriptionStatus string + +const ( + SubscriptionStatusDefaultSubscriptionStatusDoNotUse SubscriptionStatus = "DEFAULT_SUBSCRIPTION_STATUS_DO_NOT_USE" + SubscriptionStatusPending SubscriptionStatus = "PENDING" + SubscriptionStatusActive SubscriptionStatus = "ACTIVE" + SubscriptionStatusCanceled SubscriptionStatus = "CANCELED" + SubscriptionStatusDeactivated SubscriptionStatus = "DEACTIVATED" + SubscriptionStatusPaused SubscriptionStatus = "PAUSED" +) + +func NewSubscriptionStatusFromString(s string) (SubscriptionStatus, error) { + switch s { + case "DEFAULT_SUBSCRIPTION_STATUS_DO_NOT_USE": + return SubscriptionStatusDefaultSubscriptionStatusDoNotUse, nil + case "PENDING": + return SubscriptionStatusPending, nil + case "ACTIVE": + return SubscriptionStatusActive, nil + case "CANCELED": + return SubscriptionStatusCanceled, nil + case "DEACTIVATED": + return SubscriptionStatusDeactivated, nil + case "PAUSED": + return SubscriptionStatusPaused, nil + } + var t SubscriptionStatus + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SubscriptionStatus) Ptr() *SubscriptionStatus { + return &s +} + +// Represents the details of a webhook subscription, including notification URL, +// event types, and signature key. +type SubscriptionTestResult struct { + // A Square-generated unique ID for the subscription test result. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The status code returned by the subscription notification URL. + StatusCode *int `json:"status_code,omitempty" url:"status_code,omitempty"` + // An object containing the payload of the test event. For example, a `payment.created` event. + Payload *string `json:"payload,omitempty" url:"payload,omitempty"` + // The timestamp of when the subscription was created, in RFC 3339 format. + // For example, "2016-09-04T23:59:33.123Z". + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The timestamp of when the subscription was updated, in RFC 3339 format. For example, "2016-09-04T23:59:33.123Z". + // Because a subscription test result is unique, this field is the same as the `created_at` field. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchLoyaltyRewardsResponse) GetExtraProperties() map[string]interface{} { +func (s *SubscriptionTestResult) GetExtraProperties() map[string]interface{} { return s.extraProperties } -func (s *SearchLoyaltyRewardsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler SearchLoyaltyRewardsResponse +func (s *SubscriptionTestResult) UnmarshalJSON(data []byte) error { + type unmarshaler SubscriptionTestResult var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchLoyaltyRewardsResponse(value) + *s = SubscriptionTestResult(value) extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { @@ -47759,7 +64740,7 @@ func (s *SearchLoyaltyRewardsResponse) UnmarshalJSON(data []byte) error { return nil } -func (s *SearchLoyaltyRewardsResponse) String() string { +func (s *SubscriptionTestResult) String() string { if len(s._rawJSON) > 0 { if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value @@ -47771,30 +64752,36 @@ func (s *SearchLoyaltyRewardsResponse) String() string { return fmt.Sprintf("%#v", s) } -// A filter based on the order `customer_id` and any tender `customer_id` -// associated with the order. It does not filter based on the -// [FulfillmentRecipient]($m/FulfillmentRecipient) `customer_id`. -type SearchOrdersCustomerFilter struct { - // A list of customer IDs to filter by. - // - // Max: 10 customer ids. - CustomerIDs []string `json:"customer_ids,omitempty" url:"customer_ids,omitempty"` +// Published when a [Subscription](entity:Subscription) is updated. +// Typically the `subscription.status` is updated as subscriptions become active +// or cancelled. +type SubscriptionUpdatedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents, `"subscription.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *SubscriptionUpdatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchOrdersCustomerFilter) GetExtraProperties() map[string]interface{} { +func (s *SubscriptionUpdatedEvent) GetExtraProperties() map[string]interface{} { return s.extraProperties } -func (s *SearchOrdersCustomerFilter) UnmarshalJSON(data []byte) error { - type unmarshaler SearchOrdersCustomerFilter +func (s *SubscriptionUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler SubscriptionUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchOrdersCustomerFilter(value) + *s = SubscriptionUpdatedEvent(value) extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { @@ -47806,7 +64793,7 @@ func (s *SearchOrdersCustomerFilter) UnmarshalJSON(data []byte) error { return nil } -func (s *SearchOrdersCustomerFilter) String() string { +func (s *SubscriptionUpdatedEvent) String() string { if len(s._rawJSON) > 0 { if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value @@ -47818,49 +64805,29 @@ func (s *SearchOrdersCustomerFilter) String() string { return fmt.Sprintf("%#v", s) } -// Filter for `Order` objects based on whether their `CREATED_AT`, -// `CLOSED_AT`, or `UPDATED_AT` timestamps fall within a specified time range. -// You can specify the time range and which timestamp to filter for. You can filter -// for only one time range at a time. -// -// For each time range, the start time and end time are inclusive. If the end time -// is absent, it defaults to the time of the first request for the cursor. -// -// **Important:** If you use the `DateTimeFilter` in a `SearchOrders` query, -// you must set the `sort_field` in [OrdersSort]($m/SearchOrdersSort) -// to the same field you filter for. For example, if you set the `CLOSED_AT` field -// in `DateTimeFilter`, you must set the `sort_field` in `SearchOrdersSort` to -// `CLOSED_AT`. Otherwise, `SearchOrders` throws an error. -// [Learn more about filtering orders by time range.](https://developer.squareup.com/docs/orders-api/manage-orders/search-orders#important-note-about-filtering-orders-by-time-range) -type SearchOrdersDateTimeFilter struct { - // The time range for filtering on the `created_at` timestamp. If you use this - // value, you must set the `sort_field` in the `OrdersSearchSort` object to - // `CREATED_AT`. - CreatedAt *TimeRange `json:"created_at,omitempty" url:"created_at,omitempty"` - // The time range for filtering on the `updated_at` timestamp. If you use this - // value, you must set the `sort_field` in the `OrdersSearchSort` object to - // `UPDATED_AT`. - UpdatedAt *TimeRange `json:"updated_at,omitempty" url:"updated_at,omitempty"` - // The time range for filtering on the `closed_at` timestamp. If you use this - // value, you must set the `sort_field` in the `OrdersSearchSort` object to - // `CLOSED_AT`. - ClosedAt *TimeRange `json:"closed_at,omitempty" url:"closed_at,omitempty"` +type SubscriptionUpdatedEventData struct { + // Name of the affected object’s type, `"subscription"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the affected subscription. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the updated subscription. + Object *SubscriptionUpdatedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchOrdersDateTimeFilter) GetExtraProperties() map[string]interface{} { +func (s *SubscriptionUpdatedEventData) GetExtraProperties() map[string]interface{} { return s.extraProperties } -func (s *SearchOrdersDateTimeFilter) UnmarshalJSON(data []byte) error { - type unmarshaler SearchOrdersDateTimeFilter +func (s *SubscriptionUpdatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler SubscriptionUpdatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchOrdersDateTimeFilter(value) + *s = SubscriptionUpdatedEventData(value) extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { @@ -47872,7 +64839,7 @@ func (s *SearchOrdersDateTimeFilter) UnmarshalJSON(data []byte) error { return nil } -func (s *SearchOrdersDateTimeFilter) String() string { +func (s *SubscriptionUpdatedEventData) String() string { if len(s._rawJSON) > 0 { if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value @@ -47884,39 +64851,25 @@ func (s *SearchOrdersDateTimeFilter) String() string { return fmt.Sprintf("%#v", s) } -// Filtering criteria to use for a `SearchOrders` request. Multiple filters -// are ANDed together. -type SearchOrdersFilter struct { - // Filter by [OrderState](entity:OrderState). - StateFilter *SearchOrdersStateFilter `json:"state_filter,omitempty" url:"state_filter,omitempty"` - // Filter for results within a time range. - // - // **Important:** If you filter for orders by time range, you must set `SearchOrdersSort` - // to sort by the same field. - // [Learn more about filtering orders by time range.](https://developer.squareup.com/docs/orders-api/manage-orders/search-orders#important-note-about-filtering-orders-by-time-range) - DateTimeFilter *SearchOrdersDateTimeFilter `json:"date_time_filter,omitempty" url:"date_time_filter,omitempty"` - // Filter by the fulfillment type or state. - FulfillmentFilter *SearchOrdersFulfillmentFilter `json:"fulfillment_filter,omitempty" url:"fulfillment_filter,omitempty"` - // Filter by the source of the order. - SourceFilter *SearchOrdersSourceFilter `json:"source_filter,omitempty" url:"source_filter,omitempty"` - // Filter by customers associated with the order. - CustomerFilter *SearchOrdersCustomerFilter `json:"customer_filter,omitempty" url:"customer_filter,omitempty"` +type SubscriptionUpdatedEventObject struct { + // The updated subscription. + Subscription *Subscription `json:"subscription,omitempty" url:"subscription,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchOrdersFilter) GetExtraProperties() map[string]interface{} { +func (s *SubscriptionUpdatedEventObject) GetExtraProperties() map[string]interface{} { return s.extraProperties } -func (s *SearchOrdersFilter) UnmarshalJSON(data []byte) error { - type unmarshaler SearchOrdersFilter +func (s *SubscriptionUpdatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler SubscriptionUpdatedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchOrdersFilter(value) + *s = SubscriptionUpdatedEventObject(value) extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { @@ -47928,7 +64881,7 @@ func (s *SearchOrdersFilter) UnmarshalJSON(data []byte) error { return nil } -func (s *SearchOrdersFilter) String() string { +func (s *SubscriptionUpdatedEventObject) String() string { if len(s._rawJSON) > 0 { if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value @@ -47940,34 +64893,31 @@ func (s *SearchOrdersFilter) String() string { return fmt.Sprintf("%#v", s) } -// Filter based on [order fulfillment]($m/Fulfillment) information. -type SearchOrdersFulfillmentFilter struct { - // A list of [fulfillment types](entity:FulfillmentType) to filter - // for. The list returns orders if any of its fulfillments match any of the fulfillment types - // listed in this field. - // See [FulfillmentType](#type-fulfillmenttype) for possible values - FulfillmentTypes []FulfillmentType `json:"fulfillment_types,omitempty" url:"fulfillment_types,omitempty"` - // A list of [fulfillment states](entity:FulfillmentState) to filter - // for. The list returns orders if any of its fulfillments match any of the - // fulfillment states listed in this field. - // See [FulfillmentState](#type-fulfillmentstate) for possible values - FulfillmentStates []FulfillmentState `json:"fulfillment_states,omitempty" url:"fulfillment_states,omitempty"` +// Defines output parameters in a response of the +// [SwapPlan](api-endpoint:Subscriptions-SwapPlan) endpoint. +type SwapPlanResponse struct { + // Errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The subscription with the updated subscription plan. + Subscription *Subscription `json:"subscription,omitempty" url:"subscription,omitempty"` + // A list of a `SWAP_PLAN` action created by the request. + Actions []*SubscriptionAction `json:"actions,omitempty" url:"actions,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchOrdersFulfillmentFilter) GetExtraProperties() map[string]interface{} { +func (s *SwapPlanResponse) GetExtraProperties() map[string]interface{} { return s.extraProperties } -func (s *SearchOrdersFulfillmentFilter) UnmarshalJSON(data []byte) error { - type unmarshaler SearchOrdersFulfillmentFilter +func (s *SwapPlanResponse) UnmarshalJSON(data []byte) error { + type unmarshaler SwapPlanResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchOrdersFulfillmentFilter(value) + *s = SwapPlanResponse(value) extraProperties, err := core.ExtractExtraProperties(data, *s) if err != nil { @@ -47979,7 +64929,7 @@ func (s *SearchOrdersFulfillmentFilter) UnmarshalJSON(data []byte) error { return nil } -func (s *SearchOrdersFulfillmentFilter) String() string { +func (s *SwapPlanResponse) String() string { if len(s._rawJSON) > 0 { if value, err := core.StringifyJSON(s._rawJSON); err == nil { return value @@ -47991,2881 +64941,2791 @@ func (s *SearchOrdersFulfillmentFilter) String() string { return fmt.Sprintf("%#v", s) } -// Contains query criteria for the search. -type SearchOrdersQuery struct { - // Criteria to filter results by. - Filter *SearchOrdersFilter `json:"filter,omitempty" url:"filter,omitempty"` - // Criteria to sort results by. - Sort *SearchOrdersSort `json:"sort,omitempty" url:"sort,omitempty"` +// When to calculate the taxes due on a cart. +type TaxCalculationPhase string + +const ( + TaxCalculationPhaseTaxSubtotalPhase TaxCalculationPhase = "TAX_SUBTOTAL_PHASE" + TaxCalculationPhaseTaxTotalPhase TaxCalculationPhase = "TAX_TOTAL_PHASE" +) + +func NewTaxCalculationPhaseFromString(s string) (TaxCalculationPhase, error) { + switch s { + case "TAX_SUBTOTAL_PHASE": + return TaxCalculationPhaseTaxSubtotalPhase, nil + case "TAX_TOTAL_PHASE": + return TaxCalculationPhaseTaxTotalPhase, nil + } + var t TaxCalculationPhase + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (t TaxCalculationPhase) Ptr() *TaxCalculationPhase { + return &t +} + +// Identifiers for the location used by various governments for tax purposes. +type TaxIDs struct { + // The EU VAT number for this location. For example, `IE3426675K`. + // If the EU VAT number is present, it is well-formed and has been + // validated with VIES, the VAT Information Exchange System. + EuVat *string `json:"eu_vat,omitempty" url:"eu_vat,omitempty"` + // The SIRET (Système d'Identification du Répertoire des Entreprises et de leurs Etablissements) + // number is a 14-digit code issued by the French INSEE. For example, `39922799000021`. + FrSiret *string `json:"fr_siret,omitempty" url:"fr_siret,omitempty"` + // The French government uses the NAF (Nomenclature des Activités Françaises) to display and + // track economic statistical data. This is also called the APE (Activite Principale de l’Entreprise) code. + // For example, `6910Z`. + FrNaf *string `json:"fr_naf,omitempty" url:"fr_naf,omitempty"` + // The NIF (Numero de Identificacion Fiscal) number is a nine-character tax identifier used in Spain. + // If it is present, it has been validated. For example, `73628495A`. + EsNif *string `json:"es_nif,omitempty" url:"es_nif,omitempty"` + // The QII (Qualified Invoice Issuer) number is a 14-character tax identifier used in Japan. + // For example, `T1234567890123`. + JpQii *string `json:"jp_qii,omitempty" url:"jp_qii,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchOrdersQuery) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TaxIDs) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SearchOrdersQuery) UnmarshalJSON(data []byte) error { - type unmarshaler SearchOrdersQuery +func (t *TaxIDs) UnmarshalJSON(data []byte) error { + type unmarshaler TaxIDs var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchOrdersQuery(value) + *t = TaxIDs(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SearchOrdersQuery) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TaxIDs) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -// Either the `order_entries` or `orders` field is set, depending on whether -// `return_entries` is set on the [SearchOrdersRequest]($e/Orders/SearchOrders). -type SearchOrdersResponse struct { - // A list of [OrderEntries](entity:OrderEntry) that fit the query - // conditions. The list is populated only if `return_entries` is set to `true` in the request. - OrderEntries []*OrderEntry `json:"order_entries,omitempty" url:"order_entries,omitempty"` - // A list of - // [Order](entity:Order) objects that match the query conditions. The list is populated only if - // `return_entries` is set to `false` in the request. - Orders []*Order `json:"orders,omitempty" url:"orders,omitempty"` - // The pagination cursor to be used in a subsequent request. If unset, - // this is the final response. - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // [Errors](entity:Error) encountered during the search. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Whether to the tax amount should be additional to or included in the CatalogItem price. +type TaxInclusionType string + +const ( + TaxInclusionTypeAdditive TaxInclusionType = "ADDITIVE" + TaxInclusionTypeInclusive TaxInclusionType = "INCLUSIVE" +) + +func NewTaxInclusionTypeFromString(s string) (TaxInclusionType, error) { + switch s { + case "ADDITIVE": + return TaxInclusionTypeAdditive, nil + case "INCLUSIVE": + return TaxInclusionTypeInclusive, nil + } + var t TaxInclusionType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (t TaxInclusionType) Ptr() *TaxInclusionType { + return &t +} + +// A record representing an individual team member for a business. +type TeamMember struct { + // The unique ID for the team member. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // A second ID used to associate the team member with an entity in another system. + ReferenceID *string `json:"reference_id,omitempty" url:"reference_id,omitempty"` + // Whether the team member is the owner of the Square account. + IsOwner *bool `json:"is_owner,omitempty" url:"is_owner,omitempty"` + // Describes the status of the team member. + // See [TeamMemberStatus](#type-teammemberstatus) for possible values + Status *TeamMemberStatus `json:"status,omitempty" url:"status,omitempty"` + // The given name (that is, the first name) associated with the team member. + GivenName *string `json:"given_name,omitempty" url:"given_name,omitempty"` + // The family name (that is, the last name) associated with the team member. + FamilyName *string `json:"family_name,omitempty" url:"family_name,omitempty"` + // The email address associated with the team member. + EmailAddress *string `json:"email_address,omitempty" url:"email_address,omitempty"` + // The team member's phone number, in E.164 format. For example: + // +14155552671 - the country code is 1 for US + // +551155256325 - the country code is 55 for BR + PhoneNumber *string `json:"phone_number,omitempty" url:"phone_number,omitempty"` + // The timestamp, in RFC 3339 format, describing when the team member was created. + // For example, "2018-10-04T04:00:00-07:00" or "2019-02-05T12:00:00Z". + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The timestamp, in RFC 3339 format, describing when the team member was last updated. + // For example, "2018-10-04T04:00:00-07:00" or "2019-02-05T12:00:00Z". + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // Describes the team member's assigned locations. + AssignedLocations *TeamMemberAssignedLocations `json:"assigned_locations,omitempty" url:"assigned_locations,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchOrdersResponse) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TeamMember) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SearchOrdersResponse) UnmarshalJSON(data []byte) error { - type unmarshaler SearchOrdersResponse +func (t *TeamMember) UnmarshalJSON(data []byte) error { + type unmarshaler TeamMember var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchOrdersResponse(value) + *t = TeamMember(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SearchOrdersResponse) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TeamMember) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -// Sorting criteria for a `SearchOrders` request. Results can only be sorted -// by a timestamp field. -type SearchOrdersSort struct { - // The field to sort by. - // - // **Important:** When using a [DateTimeFilter](entity:SearchOrdersFilter), - // `sort_field` must match the timestamp field that the `DateTimeFilter` uses to - // filter. For example, if you set your `sort_field` to `CLOSED_AT` and you use a - // `DateTimeFilter`, your `DateTimeFilter` must filter for orders by their `CLOSED_AT` date. - // If this field does not match the timestamp field in `DateTimeFilter`, - // `SearchOrders` returns an error. - // - // Default: `CREATED_AT`. - // See [SearchOrdersSortField](#type-searchorderssortfield) for possible values - SortField SearchOrdersSortField `json:"sort_field" url:"sort_field"` - // The chronological order in which results are returned. Defaults to `DESC`. - // See [SortOrder](#type-sortorder) for possible values - SortOrder *SortOrder `json:"sort_order,omitempty" url:"sort_order,omitempty"` +// An object that represents a team member's assignment to locations. +type TeamMemberAssignedLocations struct { + // The current assignment type of the team member. + // See [TeamMemberAssignedLocationsAssignmentType](#type-teammemberassignedlocationsassignmenttype) for possible values + AssignmentType *TeamMemberAssignedLocationsAssignmentType `json:"assignment_type,omitempty" url:"assignment_type,omitempty"` + // The explicit locations that the team member is assigned to. + LocationIDs []string `json:"location_ids,omitempty" url:"location_ids,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchOrdersSort) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TeamMemberAssignedLocations) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SearchOrdersSort) UnmarshalJSON(data []byte) error { - type unmarshaler SearchOrdersSort +func (t *TeamMemberAssignedLocations) UnmarshalJSON(data []byte) error { + type unmarshaler TeamMemberAssignedLocations var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchOrdersSort(value) + *t = TeamMemberAssignedLocations(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SearchOrdersSort) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TeamMemberAssignedLocations) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -// Specifies which timestamp to use to sort `SearchOrder` results. -type SearchOrdersSortField string +// Enumerates the possible assignment types that the team member can have. +type TeamMemberAssignedLocationsAssignmentType string const ( - SearchOrdersSortFieldCreatedAt SearchOrdersSortField = "CREATED_AT" - SearchOrdersSortFieldUpdatedAt SearchOrdersSortField = "UPDATED_AT" - SearchOrdersSortFieldClosedAt SearchOrdersSortField = "CLOSED_AT" + TeamMemberAssignedLocationsAssignmentTypeDoNotUse TeamMemberAssignedLocationsAssignmentType = "DO_NOT_USE" + TeamMemberAssignedLocationsAssignmentTypeAllCurrentAndFutureLocations TeamMemberAssignedLocationsAssignmentType = "ALL_CURRENT_AND_FUTURE_LOCATIONS" + TeamMemberAssignedLocationsAssignmentTypeExplicitLocations TeamMemberAssignedLocationsAssignmentType = "EXPLICIT_LOCATIONS" ) -func NewSearchOrdersSortFieldFromString(s string) (SearchOrdersSortField, error) { +func NewTeamMemberAssignedLocationsAssignmentTypeFromString(s string) (TeamMemberAssignedLocationsAssignmentType, error) { switch s { - case "CREATED_AT": - return SearchOrdersSortFieldCreatedAt, nil - case "UPDATED_AT": - return SearchOrdersSortFieldUpdatedAt, nil - case "CLOSED_AT": - return SearchOrdersSortFieldClosedAt, nil + case "DO_NOT_USE": + return TeamMemberAssignedLocationsAssignmentTypeDoNotUse, nil + case "ALL_CURRENT_AND_FUTURE_LOCATIONS": + return TeamMemberAssignedLocationsAssignmentTypeAllCurrentAndFutureLocations, nil + case "EXPLICIT_LOCATIONS": + return TeamMemberAssignedLocationsAssignmentTypeExplicitLocations, nil } - var t SearchOrdersSortField + var t TeamMemberAssignedLocationsAssignmentType return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (s SearchOrdersSortField) Ptr() *SearchOrdersSortField { - return &s +func (t TeamMemberAssignedLocationsAssignmentType) Ptr() *TeamMemberAssignedLocationsAssignmentType { + return &t } -// A filter based on order `source` information. -type SearchOrdersSourceFilter struct { - // Filters by the [Source](entity:OrderSource) `name`. The filter returns any orders - // with a `source.name` that matches any of the listed source names. - // - // Max: 10 source names. - SourceNames []string `json:"source_names,omitempty" url:"source_names,omitempty"` +// The booking profile of a seller's team member, including the team member's ID, display name, description and whether the team member can be booked as a service provider. +type TeamMemberBookingProfile struct { + // The ID of the [TeamMember](entity:TeamMember) object for the team member associated with the booking profile. + TeamMemberID *string `json:"team_member_id,omitempty" url:"team_member_id,omitempty"` + // The description of the team member. + Description *string `json:"description,omitempty" url:"description,omitempty"` + // The display name of the team member. + DisplayName *string `json:"display_name,omitempty" url:"display_name,omitempty"` + // Indicates whether the team member can be booked through the Bookings API or the seller's online booking channel or site (`true`) or not (`false`). + IsBookable *bool `json:"is_bookable,omitempty" url:"is_bookable,omitempty"` + // The URL of the team member's image for the bookings profile. + ProfileImageURL *string `json:"profile_image_url,omitempty" url:"profile_image_url,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchOrdersSourceFilter) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TeamMemberBookingProfile) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SearchOrdersSourceFilter) UnmarshalJSON(data []byte) error { - type unmarshaler SearchOrdersSourceFilter +func (t *TeamMemberBookingProfile) UnmarshalJSON(data []byte) error { + type unmarshaler TeamMemberBookingProfile var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchOrdersSourceFilter(value) + *t = TeamMemberBookingProfile(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SearchOrdersSourceFilter) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TeamMemberBookingProfile) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -// Filter by the current order `state`. -type SearchOrdersStateFilter struct { - // States to filter for. - // See [OrderState](#type-orderstate) for possible values - States []OrderState `json:"states,omitempty" url:"states,omitempty"` +// Published when a Team Member is created. +type TeamMemberCreatedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents, `"team_member.created"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *TeamMemberCreatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchOrdersStateFilter) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TeamMemberCreatedEvent) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SearchOrdersStateFilter) UnmarshalJSON(data []byte) error { - type unmarshaler SearchOrdersStateFilter +func (t *TeamMemberCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler TeamMemberCreatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchOrdersStateFilter(value) + *t = TeamMemberCreatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SearchOrdersStateFilter) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TeamMemberCreatedEvent) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -// The response to a request for `Shift` objects. The response contains -// the requested `Shift` objects and might contain a set of `Error` objects if -// the request resulted in errors. -type SearchShiftsResponse struct { - // Shifts. - Shifts []*Shift `json:"shifts,omitempty" url:"shifts,omitempty"` - // An opaque cursor for fetching the next page. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +type TeamMemberCreatedEventData struct { + // Name of the affected object’s type, `"team_member"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the created team member. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the created team member. + Object *TeamMemberCreatedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchShiftsResponse) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TeamMemberCreatedEventData) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SearchShiftsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler SearchShiftsResponse +func (t *TeamMemberCreatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler TeamMemberCreatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchShiftsResponse(value) + *t = TeamMemberCreatedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SearchShiftsResponse) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TeamMemberCreatedEventData) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -// Represents a set of query expressions (filters) to narrow the scope of targeted subscriptions returned by -// the [SearchSubscriptions]($e/Subscriptions/SearchSubscriptions) endpoint. -type SearchSubscriptionsFilter struct { - // A filter to select subscriptions based on the subscribing customer IDs. - CustomerIDs []string `json:"customer_ids,omitempty" url:"customer_ids,omitempty"` - // A filter to select subscriptions based on the location. - LocationIDs []string `json:"location_ids,omitempty" url:"location_ids,omitempty"` - // A filter to select subscriptions based on the source application. - SourceNames []string `json:"source_names,omitempty" url:"source_names,omitempty"` +type TeamMemberCreatedEventObject struct { + // The created team member. + TeamMember *TeamMember `json:"team_member,omitempty" url:"team_member,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchSubscriptionsFilter) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TeamMemberCreatedEventObject) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SearchSubscriptionsFilter) UnmarshalJSON(data []byte) error { - type unmarshaler SearchSubscriptionsFilter +func (t *TeamMemberCreatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler TeamMemberCreatedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchSubscriptionsFilter(value) + *t = TeamMemberCreatedEventObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SearchSubscriptionsFilter) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TeamMemberCreatedEventObject) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -// Represents a query, consisting of specified query expressions, used to search for subscriptions. -type SearchSubscriptionsQuery struct { - // A list of query expressions. - Filter *SearchSubscriptionsFilter `json:"filter,omitempty" url:"filter,omitempty"` +// Enumerates the possible invitation statuses the team member can have within a business. +type TeamMemberInvitationStatus string - extraProperties map[string]interface{} - _rawJSON json.RawMessage +const ( + TeamMemberInvitationStatusInvitationStatusDoNotUse TeamMemberInvitationStatus = "INVITATION_STATUS_DO_NOT_USE" + TeamMemberInvitationStatusUninvited TeamMemberInvitationStatus = "UNINVITED" + TeamMemberInvitationStatusPending TeamMemberInvitationStatus = "PENDING" + TeamMemberInvitationStatusAccepted TeamMemberInvitationStatus = "ACCEPTED" +) + +func NewTeamMemberInvitationStatusFromString(s string) (TeamMemberInvitationStatus, error) { + switch s { + case "INVITATION_STATUS_DO_NOT_USE": + return TeamMemberInvitationStatusInvitationStatusDoNotUse, nil + case "UNINVITED": + return TeamMemberInvitationStatusUninvited, nil + case "PENDING": + return TeamMemberInvitationStatusPending, nil + case "ACCEPTED": + return TeamMemberInvitationStatusAccepted, nil + } + var t TeamMemberInvitationStatus + return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (s *SearchSubscriptionsQuery) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t TeamMemberInvitationStatus) Ptr() *TeamMemberInvitationStatus { + return &t } -func (s *SearchSubscriptionsQuery) UnmarshalJSON(data []byte) error { - type unmarshaler SearchSubscriptionsQuery - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *s = SearchSubscriptionsQuery(value) +// Enumerates the possible statuses the team member can have within a business. +type TeamMemberStatus string - extraProperties, err := core.ExtractExtraProperties(data, *s) - if err != nil { - return err - } - s.extraProperties = extraProperties +const ( + TeamMemberStatusStatusDoNotUse TeamMemberStatus = "STATUS_DO_NOT_USE" + TeamMemberStatusActive TeamMemberStatus = "ACTIVE" + TeamMemberStatusInactive TeamMemberStatus = "INACTIVE" +) - s._rawJSON = json.RawMessage(data) - return nil +func NewTeamMemberStatusFromString(s string) (TeamMemberStatus, error) { + switch s { + case "STATUS_DO_NOT_USE": + return TeamMemberStatusStatusDoNotUse, nil + case "ACTIVE": + return TeamMemberStatusActive, nil + case "INACTIVE": + return TeamMemberStatusInactive, nil + } + var t TeamMemberStatus + return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (s *SearchSubscriptionsQuery) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(s); err == nil { - return value - } - return fmt.Sprintf("%#v", s) +func (t TeamMemberStatus) Ptr() *TeamMemberStatus { + return &t } -// Defines output parameters in a response from the -// [SearchSubscriptions]($e/Subscriptions/SearchSubscriptions) endpoint. -type SearchSubscriptionsResponse struct { - // Errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The subscriptions matching the specified query expressions. - Subscriptions []*Subscription `json:"subscriptions,omitempty" url:"subscriptions,omitempty"` - // When the total number of resulting subscription exceeds the limit of a paged response, - // the response includes a cursor for you to use in a subsequent request to fetch the next set of results. - // If the cursor is unset, the response contains the last page of the results. - // - // For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` +// Published when a Team Member is updated. +type TeamMemberUpdatedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents, `"team_member.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *TeamMemberUpdatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchSubscriptionsResponse) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TeamMemberUpdatedEvent) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SearchSubscriptionsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler SearchSubscriptionsResponse +func (t *TeamMemberUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler TeamMemberUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchSubscriptionsResponse(value) + *t = TeamMemberUpdatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SearchSubscriptionsResponse) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TeamMemberUpdatedEvent) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -// Represents a filter used in a search for `TeamMember` objects. `AND` logic is applied -// between the individual fields, and `OR` logic is applied within list-based fields. -// For example, setting this filter value: -// -// ``` -// filter = (locations_ids = ["A", "B"], status = ACTIVE) -// ``` -// -// returns only active team members assigned to either location "A" or "B". -type SearchTeamMembersFilter struct { - // When present, filters by team members assigned to the specified locations. - // When empty, includes team members assigned to any location. - LocationIDs []string `json:"location_ids,omitempty" url:"location_ids,omitempty"` - // When present, filters by team members who match the given status. - // When empty, includes team members of all statuses. - // See [TeamMemberStatus](#type-teammemberstatus) for possible values - Status *TeamMemberStatus `json:"status,omitempty" url:"status,omitempty"` - // When present and set to true, returns the team member who is the owner of the Square account. - IsOwner *bool `json:"is_owner,omitempty" url:"is_owner,omitempty"` +type TeamMemberUpdatedEventData struct { + // Name of the affected object’s type, `"team_member"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the affected team member. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the updated team member. + Object *TeamMemberUpdatedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchTeamMembersFilter) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TeamMemberUpdatedEventData) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SearchTeamMembersFilter) UnmarshalJSON(data []byte) error { - type unmarshaler SearchTeamMembersFilter +func (t *TeamMemberUpdatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler TeamMemberUpdatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchTeamMembersFilter(value) + *t = TeamMemberUpdatedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SearchTeamMembersFilter) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TeamMemberUpdatedEventData) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -// Represents the parameters in a search for `TeamMember` objects. -type SearchTeamMembersQuery struct { - // The options to filter by. - Filter *SearchTeamMembersFilter `json:"filter,omitempty" url:"filter,omitempty"` +type TeamMemberUpdatedEventObject struct { + // The updated team member. + TeamMember *TeamMember `json:"team_member,omitempty" url:"team_member,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchTeamMembersQuery) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TeamMemberUpdatedEventObject) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SearchTeamMembersQuery) UnmarshalJSON(data []byte) error { - type unmarshaler SearchTeamMembersQuery +func (t *TeamMemberUpdatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler TeamMemberUpdatedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchTeamMembersQuery(value) + *t = TeamMemberUpdatedEventObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SearchTeamMembersQuery) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TeamMemberUpdatedEventObject) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -// Represents a response from a search request containing a filtered list of `TeamMember` objects. -type SearchTeamMembersResponse struct { - // The filtered list of `TeamMember` objects. - TeamMembers []*TeamMember `json:"team_members,omitempty" url:"team_members,omitempty"` - // The opaque cursor for fetching the next page. For more information, see - // [pagination](https://developer.squareup.com/docs/working-with-apis/pagination). - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` - // The errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// The hourly wage rate that a team member earns on a `Shift` for doing the job +// specified by the `title` property of this object. +type TeamMemberWage struct { + // The UUID for this object. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The `TeamMember` that this wage is assigned to. + TeamMemberID *string `json:"team_member_id,omitempty" url:"team_member_id,omitempty"` + // The job title that this wage relates to. + Title *string `json:"title,omitempty" url:"title,omitempty"` + // Can be a custom-set hourly wage or the calculated effective hourly + // wage based on the annual wage and hours worked per week. + HourlyRate *Money `json:"hourly_rate,omitempty" url:"hourly_rate,omitempty"` + // An identifier for the job that this wage relates to. This cannot be + // used to retrieve the job. + JobID *string `json:"job_id,omitempty" url:"job_id,omitempty"` + // Whether team members are eligible for tips when working this job. + TipEligible *bool `json:"tip_eligible,omitempty" url:"tip_eligible,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchTeamMembersResponse) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TeamMemberWage) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SearchTeamMembersResponse) UnmarshalJSON(data []byte) error { - type unmarshaler SearchTeamMembersResponse +func (t *TeamMemberWage) UnmarshalJSON(data []byte) error { + type unmarshaler TeamMemberWage var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchTeamMembersResponse(value) + *t = TeamMemberWage(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SearchTeamMembersResponse) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TeamMemberWage) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -type SearchTerminalActionsResponse struct { - // Information on errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The requested search result of `TerminalAction`s. - Action []*TerminalAction `json:"action,omitempty" url:"action,omitempty"` - // The pagination cursor to be used in a subsequent request. If empty, - // this is the final response. - // - // See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more - // information. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` +// Published when a Wage Setting is updated. +type TeamMemberWageSettingUpdatedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents, `"team_member.wage_setting.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // Timestamp of when the event was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *TeamMemberWageSettingUpdatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchTerminalActionsResponse) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TeamMemberWageSettingUpdatedEvent) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SearchTerminalActionsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler SearchTerminalActionsResponse +func (t *TeamMemberWageSettingUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler TeamMemberWageSettingUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchTerminalActionsResponse(value) + *t = TeamMemberWageSettingUpdatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SearchTerminalActionsResponse) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TeamMemberWageSettingUpdatedEvent) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) -} - -type SearchTerminalCheckoutsResponse struct { - // Information about errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The requested search result of `TerminalCheckout` objects. - Checkouts []*TerminalCheckout `json:"checkouts,omitempty" url:"checkouts,omitempty"` - // The pagination cursor to be used in a subsequent request. If empty, - // this is the final response. - // - // See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` + return fmt.Sprintf("%#v", t) +} + +type TeamMemberWageSettingUpdatedEventData struct { + // Name of the affected object’s type, `"wage_setting"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the updated team member wage setting. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the updated team member wage setting. + Object *TeamMemberWageSettingUpdatedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchTerminalCheckoutsResponse) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TeamMemberWageSettingUpdatedEventData) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SearchTerminalCheckoutsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler SearchTerminalCheckoutsResponse +func (t *TeamMemberWageSettingUpdatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler TeamMemberWageSettingUpdatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchTerminalCheckoutsResponse(value) + *t = TeamMemberWageSettingUpdatedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SearchTerminalCheckoutsResponse) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TeamMemberWageSettingUpdatedEventData) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -type SearchTerminalRefundsResponse struct { - // Information about errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The requested search result of `TerminalRefund` objects. - Refunds []*TerminalRefund `json:"refunds,omitempty" url:"refunds,omitempty"` - // The pagination cursor to be used in a subsequent request. If empty, - // this is the final response. - // - // See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. - Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"` +type TeamMemberWageSettingUpdatedEventObject struct { + // The updated team member wage setting. + WageSetting *WageSetting `json:"wage_setting,omitempty" url:"wage_setting,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchTerminalRefundsResponse) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TeamMemberWageSettingUpdatedEventObject) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SearchTerminalRefundsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler SearchTerminalRefundsResponse +func (t *TeamMemberWageSettingUpdatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler TeamMemberWageSettingUpdatedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchTerminalRefundsResponse(value) + *t = TeamMemberWageSettingUpdatedEventObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SearchTerminalRefundsResponse) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TeamMemberWageSettingUpdatedEventObject) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -// Defines supported query expressions to search for vendors by. -type SearchVendorsRequestFilter struct { - // The names of the [Vendor](entity:Vendor) objects to retrieve. - Name []string `json:"name,omitempty" url:"name,omitempty"` - // The statuses of the [Vendor](entity:Vendor) objects to retrieve. - // See [VendorStatus](#type-vendorstatus) for possible values - Status []VendorStatus `json:"status,omitempty" url:"status,omitempty"` +// Represents a tender (i.e., a method of payment) used in a Square transaction. +type Tender struct { + // The tender's unique ID. It is the associated payment ID. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The ID of the transaction's associated location. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The ID of the tender's associated transaction. + TransactionID *string `json:"transaction_id,omitempty" url:"transaction_id,omitempty"` + // The timestamp for when the tender was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // An optional note associated with the tender at the time of payment. + Note *string `json:"note,omitempty" url:"note,omitempty"` + // The total amount of the tender, including `tip_money`. If the tender has a `payment_id`, + // the `total_money` of the corresponding [Payment](entity:Payment) will be equal to the + // `amount_money` of the tender. + AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` + // The tip's amount of the tender. + TipMoney *Money `json:"tip_money,omitempty" url:"tip_money,omitempty"` + // The amount of any Square processing fees applied to the tender. + // + // This field is not immediately populated when a new transaction is created. + // It is usually available after about ten seconds. + ProcessingFeeMoney *Money `json:"processing_fee_money,omitempty" url:"processing_fee_money,omitempty"` + // If the tender is associated with a customer or represents a customer's card on file, + // this is the ID of the associated customer. + CustomerID *string `json:"customer_id,omitempty" url:"customer_id,omitempty"` + // The type of tender, such as `CARD` or `CASH`. + // See [TenderType](#type-tendertype) for possible values + Type TenderType `json:"type" url:"type"` + // The details of the card tender. + // + // This value is present only if the value of `type` is `CARD`. + CardDetails *TenderCardDetails `json:"card_details,omitempty" url:"card_details,omitempty"` + // The details of the cash tender. + // + // This value is present only if the value of `type` is `CASH`. + CashDetails *TenderCashDetails `json:"cash_details,omitempty" url:"cash_details,omitempty"` + // The details of the bank account tender. + // + // This value is present only if the value of `type` is `BANK_ACCOUNT`. + BankAccountDetails *TenderBankAccountDetails `json:"bank_account_details,omitempty" url:"bank_account_details,omitempty"` + // The details of a Buy Now Pay Later tender. + // + // This value is present only if the value of `type` is `BUY_NOW_PAY_LATER`. + BuyNowPayLaterDetails *TenderBuyNowPayLaterDetails `json:"buy_now_pay_later_details,omitempty" url:"buy_now_pay_later_details,omitempty"` + // The details of a Square Account tender. + // + // This value is present only if the value of `type` is `SQUARE_ACCOUNT`. + SquareAccountDetails *TenderSquareAccountDetails `json:"square_account_details,omitempty" url:"square_account_details,omitempty"` + // Additional recipients (other than the merchant) receiving a portion of this tender. + // For example, fees assessed on the purchase by a third party integration. + AdditionalRecipients []*AdditionalRecipient `json:"additional_recipients,omitempty" url:"additional_recipients,omitempty"` + // The ID of the [Payment](entity:Payment) that corresponds to this tender. + // This value is only present for payments created with the v2 Payments API. + PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchVendorsRequestFilter) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *Tender) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SearchVendorsRequestFilter) UnmarshalJSON(data []byte) error { - type unmarshaler SearchVendorsRequestFilter +func (t *Tender) UnmarshalJSON(data []byte) error { + type unmarshaler Tender var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchVendorsRequestFilter(value) + *t = Tender(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SearchVendorsRequestFilter) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *Tender) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -// Defines a sorter used to sort results from [SearchVendors]($e/Vendors/SearchVendors). -type SearchVendorsRequestSort struct { - // Specifies the sort key to sort the returned vendors. - // See [Field](#type-field) for possible values - Field *SearchVendorsRequestSortField `json:"field,omitempty" url:"field,omitempty"` - // Specifies the sort order for the returned vendors. - // See [SortOrder](#type-sortorder) for possible values - Order *SortOrder `json:"order,omitempty" url:"order,omitempty"` +// Represents the details of a tender with `type` `BANK_ACCOUNT`. +// +// See [BankAccountPaymentDetails](entity:BankAccountPaymentDetails) +// for more exposed details of a bank account payment. +type TenderBankAccountDetails struct { + // The bank account payment's current state. + // + // See [TenderBankAccountPaymentDetailsStatus](entity:TenderBankAccountDetailsStatus) for possible values. + // See [TenderBankAccountDetailsStatus](#type-tenderbankaccountdetailsstatus) for possible values + Status *TenderBankAccountDetailsStatus `json:"status,omitempty" url:"status,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchVendorsRequestSort) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TenderBankAccountDetails) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SearchVendorsRequestSort) UnmarshalJSON(data []byte) error { - type unmarshaler SearchVendorsRequestSort +func (t *TenderBankAccountDetails) UnmarshalJSON(data []byte) error { + type unmarshaler TenderBankAccountDetails var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchVendorsRequestSort(value) + *t = TenderBankAccountDetails(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SearchVendorsRequestSort) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TenderBankAccountDetails) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -// The field to sort the returned [Vendor]($m/Vendor) objects by. -type SearchVendorsRequestSortField string +// Indicates the bank account payment's current status. +type TenderBankAccountDetailsStatus string const ( - SearchVendorsRequestSortFieldName SearchVendorsRequestSortField = "NAME" - SearchVendorsRequestSortFieldCreatedAt SearchVendorsRequestSortField = "CREATED_AT" + TenderBankAccountDetailsStatusPending TenderBankAccountDetailsStatus = "PENDING" + TenderBankAccountDetailsStatusCompleted TenderBankAccountDetailsStatus = "COMPLETED" + TenderBankAccountDetailsStatusFailed TenderBankAccountDetailsStatus = "FAILED" ) -func NewSearchVendorsRequestSortFieldFromString(s string) (SearchVendorsRequestSortField, error) { +func NewTenderBankAccountDetailsStatusFromString(s string) (TenderBankAccountDetailsStatus, error) { switch s { - case "NAME": - return SearchVendorsRequestSortFieldName, nil - case "CREATED_AT": - return SearchVendorsRequestSortFieldCreatedAt, nil + case "PENDING": + return TenderBankAccountDetailsStatusPending, nil + case "COMPLETED": + return TenderBankAccountDetailsStatusCompleted, nil + case "FAILED": + return TenderBankAccountDetailsStatusFailed, nil } - var t SearchVendorsRequestSortField + var t TenderBankAccountDetailsStatus return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (s SearchVendorsRequestSortField) Ptr() *SearchVendorsRequestSortField { - return &s +func (t TenderBankAccountDetailsStatus) Ptr() *TenderBankAccountDetailsStatus { + return &t } -// Represents an output from a call to [SearchVendors]($e/Vendors/SearchVendors). -type SearchVendorsResponse struct { - // Errors encountered when the request fails. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The [Vendor](entity:Vendor) objects matching the specified search filter. - Vendors []*Vendor `json:"vendors,omitempty" url:"vendors,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"` +// Represents the details of a tender with `type` `BUY_NOW_PAY_LATER`. +type TenderBuyNowPayLaterDetails struct { + // The Buy Now Pay Later brand. + // See [Brand](#type-brand) for possible values + BuyNowPayLaterBrand *TenderBuyNowPayLaterDetailsBrand `json:"buy_now_pay_later_brand,omitempty" url:"buy_now_pay_later_brand,omitempty"` + // The buy now pay later payment's current state (such as `AUTHORIZED` or + // `CAPTURED`). See [TenderBuyNowPayLaterDetailsStatus](entity:TenderBuyNowPayLaterDetailsStatus) + // for possible values. + // See [Status](#type-status) for possible values + Status *TenderBuyNowPayLaterDetailsStatus `json:"status,omitempty" url:"status,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SearchVendorsResponse) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TenderBuyNowPayLaterDetails) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SearchVendorsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler SearchVendorsResponse +func (t *TenderBuyNowPayLaterDetails) UnmarshalJSON(data []byte) error { + type unmarshaler TenderBuyNowPayLaterDetails var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SearchVendorsResponse(value) + *t = TenderBuyNowPayLaterDetails(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SearchVendorsResponse) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TenderBuyNowPayLaterDetails) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -// A query filter to search for buyer-accessible appointment segments by. -type SegmentFilter struct { - // The ID of the [CatalogItemVariation](entity:CatalogItemVariation) object representing the service booked in this segment. - ServiceVariationID string `json:"service_variation_id" url:"service_variation_id"` - // A query filter to search for buyer-accessible appointment segments with service-providing team members matching the specified list of team member IDs. Supported query expressions are - // - // - `ANY`: return the appointment segments with team members whose IDs match any member in this list. - // - `NONE`: return the appointment segments with team members whose IDs are not in this list. - // - `ALL`: not supported. - // - // When no expression is specified, any service-providing team member is eligible to fulfill the Booking. - TeamMemberIDFilter *FilterValue `json:"team_member_id_filter,omitempty" url:"team_member_id_filter,omitempty"` +type TenderBuyNowPayLaterDetailsBrand string - extraProperties map[string]interface{} - _rawJSON json.RawMessage +const ( + TenderBuyNowPayLaterDetailsBrandOtherBrand TenderBuyNowPayLaterDetailsBrand = "OTHER_BRAND" + TenderBuyNowPayLaterDetailsBrandAfterpay TenderBuyNowPayLaterDetailsBrand = "AFTERPAY" +) + +func NewTenderBuyNowPayLaterDetailsBrandFromString(s string) (TenderBuyNowPayLaterDetailsBrand, error) { + switch s { + case "OTHER_BRAND": + return TenderBuyNowPayLaterDetailsBrandOtherBrand, nil + case "AFTERPAY": + return TenderBuyNowPayLaterDetailsBrandAfterpay, nil + } + var t TenderBuyNowPayLaterDetailsBrand + return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (s *SegmentFilter) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t TenderBuyNowPayLaterDetailsBrand) Ptr() *TenderBuyNowPayLaterDetailsBrand { + return &t } -func (s *SegmentFilter) UnmarshalJSON(data []byte) error { - type unmarshaler SegmentFilter - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *s = SegmentFilter(value) +type TenderBuyNowPayLaterDetailsStatus string - extraProperties, err := core.ExtractExtraProperties(data, *s) - if err != nil { - return err - } - s.extraProperties = extraProperties +const ( + TenderBuyNowPayLaterDetailsStatusAuthorized TenderBuyNowPayLaterDetailsStatus = "AUTHORIZED" + TenderBuyNowPayLaterDetailsStatusCaptured TenderBuyNowPayLaterDetailsStatus = "CAPTURED" + TenderBuyNowPayLaterDetailsStatusVoided TenderBuyNowPayLaterDetailsStatus = "VOIDED" + TenderBuyNowPayLaterDetailsStatusFailed TenderBuyNowPayLaterDetailsStatus = "FAILED" +) - s._rawJSON = json.RawMessage(data) - return nil +func NewTenderBuyNowPayLaterDetailsStatusFromString(s string) (TenderBuyNowPayLaterDetailsStatus, error) { + switch s { + case "AUTHORIZED": + return TenderBuyNowPayLaterDetailsStatusAuthorized, nil + case "CAPTURED": + return TenderBuyNowPayLaterDetailsStatusCaptured, nil + case "VOIDED": + return TenderBuyNowPayLaterDetailsStatusVoided, nil + case "FAILED": + return TenderBuyNowPayLaterDetailsStatusFailed, nil + } + var t TenderBuyNowPayLaterDetailsStatus + return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (s *SegmentFilter) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(s); err == nil { - return value - } - return fmt.Sprintf("%#v", s) +func (t TenderBuyNowPayLaterDetailsStatus) Ptr() *TenderBuyNowPayLaterDetailsStatus { + return &t } -type SelectOption struct { - // The reference id for the option. - ReferenceID string `json:"reference_id" url:"reference_id"` - // The title text that displays in the select option button. - Title string `json:"title" url:"title"` +// Represents additional details of a tender with `type` `CARD` or `SQUARE_GIFT_CARD` +type TenderCardDetails struct { + // The credit card payment's current state (such as `AUTHORIZED` or + // `CAPTURED`). See [TenderCardDetailsStatus](entity:TenderCardDetailsStatus) + // for possible values. + // See [TenderCardDetailsStatus](#type-tendercarddetailsstatus) for possible values + Status *TenderCardDetailsStatus `json:"status,omitempty" url:"status,omitempty"` + // The credit card's non-confidential details. + Card *Card `json:"card,omitempty" url:"card,omitempty"` + // The method used to enter the card's details for the transaction. + // See [TenderCardDetailsEntryMethod](#type-tendercarddetailsentrymethod) for possible values + EntryMethod *TenderCardDetailsEntryMethod `json:"entry_method,omitempty" url:"entry_method,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SelectOption) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TenderCardDetails) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SelectOption) UnmarshalJSON(data []byte) error { - type unmarshaler SelectOption +func (t *TenderCardDetails) UnmarshalJSON(data []byte) error { + type unmarshaler TenderCardDetails var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SelectOption(value) + *t = TenderCardDetails(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SelectOption) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TenderCardDetails) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -type SelectOptions struct { - // The title text to display in the select flow on the Terminal. - Title string `json:"title" url:"title"` - // The body text to display in the select flow on the Terminal. - Body string `json:"body" url:"body"` - // Represents the buttons/options that should be displayed in the select flow on the Terminal. - Options []*SelectOption `json:"options,omitempty" url:"options,omitempty"` - // The buyer’s selected option. - SelectedOption *SelectOption `json:"selected_option,omitempty" url:"selected_option,omitempty"` +// Indicates the method used to enter the card's details. +type TenderCardDetailsEntryMethod string - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} +const ( + TenderCardDetailsEntryMethodSwiped TenderCardDetailsEntryMethod = "SWIPED" + TenderCardDetailsEntryMethodKeyed TenderCardDetailsEntryMethod = "KEYED" + TenderCardDetailsEntryMethodEmv TenderCardDetailsEntryMethod = "EMV" + TenderCardDetailsEntryMethodOnFile TenderCardDetailsEntryMethod = "ON_FILE" + TenderCardDetailsEntryMethodContactless TenderCardDetailsEntryMethod = "CONTACTLESS" +) -func (s *SelectOptions) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func NewTenderCardDetailsEntryMethodFromString(s string) (TenderCardDetailsEntryMethod, error) { + switch s { + case "SWIPED": + return TenderCardDetailsEntryMethodSwiped, nil + case "KEYED": + return TenderCardDetailsEntryMethodKeyed, nil + case "EMV": + return TenderCardDetailsEntryMethodEmv, nil + case "ON_FILE": + return TenderCardDetailsEntryMethodOnFile, nil + case "CONTACTLESS": + return TenderCardDetailsEntryMethodContactless, nil + } + var t TenderCardDetailsEntryMethod + return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (s *SelectOptions) UnmarshalJSON(data []byte) error { - type unmarshaler SelectOptions - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *s = SelectOptions(value) +func (t TenderCardDetailsEntryMethod) Ptr() *TenderCardDetailsEntryMethod { + return &t +} - extraProperties, err := core.ExtractExtraProperties(data, *s) - if err != nil { - return err - } - s.extraProperties = extraProperties +// Indicates the card transaction's current status. +type TenderCardDetailsStatus string - s._rawJSON = json.RawMessage(data) - return nil -} +const ( + TenderCardDetailsStatusAuthorized TenderCardDetailsStatus = "AUTHORIZED" + TenderCardDetailsStatusCaptured TenderCardDetailsStatus = "CAPTURED" + TenderCardDetailsStatusVoided TenderCardDetailsStatus = "VOIDED" + TenderCardDetailsStatusFailed TenderCardDetailsStatus = "FAILED" +) -func (s *SelectOptions) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(s); err == nil { - return value +func NewTenderCardDetailsStatusFromString(s string) (TenderCardDetailsStatus, error) { + switch s { + case "AUTHORIZED": + return TenderCardDetailsStatusAuthorized, nil + case "CAPTURED": + return TenderCardDetailsStatusCaptured, nil + case "VOIDED": + return TenderCardDetailsStatusVoided, nil + case "FAILED": + return TenderCardDetailsStatusFailed, nil } - return fmt.Sprintf("%#v", s) + var t TenderCardDetailsStatus + return "", fmt.Errorf("%s is not a valid %T", s, t) } -// A record of the hourly rate, start, and end times for a single work shift -// for an employee. This might include a record of the start and end times for breaks -// taken during the shift. -type Shift struct { - // The UUID for this object. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The ID of the employee this shift belongs to. DEPRECATED at version 2020-08-26. Use `team_member_id` instead. - EmployeeID *string `json:"employee_id,omitempty" url:"employee_id,omitempty"` - // The ID of the location this shift occurred at. The location should be based on - // where the employee clocked in. - LocationID string `json:"location_id" url:"location_id"` - // The read-only convenience value that is calculated from the location based - // on the `location_id`. Format: the IANA timezone database identifier for the - // location timezone. - Timezone *string `json:"timezone,omitempty" url:"timezone,omitempty"` - // RFC 3339; shifted to the location timezone + offset. Precision up to the - // minute is respected; seconds are truncated. - StartAt string `json:"start_at" url:"start_at"` - // RFC 3339; shifted to the timezone + offset. Precision up to the minute is - // respected; seconds are truncated. - EndAt *string `json:"end_at,omitempty" url:"end_at,omitempty"` - // Job and pay related information. If the wage is not set on create, it defaults to a wage - // of zero. If the title is not set on create, it defaults to the name of the role the employee - // is assigned to, if any. - Wage *ShiftWage `json:"wage,omitempty" url:"wage,omitempty"` - // A list of all the paid or unpaid breaks that were taken during this shift. - Breaks []*Break `json:"breaks,omitempty" url:"breaks,omitempty"` - // Describes the working state of the current `Shift`. - // See [ShiftStatus](#type-shiftstatus) for possible values - Status *ShiftStatus `json:"status,omitempty" url:"status,omitempty"` - // Used for resolving concurrency issues. The request fails if the version - // provided does not match the server version at the time of the request. If not provided, - // Square executes a blind write; potentially overwriting data from another - // write. - Version *int `json:"version,omitempty" url:"version,omitempty"` - // A read-only timestamp in RFC 3339 format; presented in UTC. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // A read-only timestamp in RFC 3339 format; presented in UTC. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` - // The ID of the team member this shift belongs to. Replaced `employee_id` at version "2020-08-26". - TeamMemberID *string `json:"team_member_id,omitempty" url:"team_member_id,omitempty"` - // The tips declared by the team member for the shift. - DeclaredCashTipMoney *Money `json:"declared_cash_tip_money,omitempty" url:"declared_cash_tip_money,omitempty"` +func (t TenderCardDetailsStatus) Ptr() *TenderCardDetailsStatus { + return &t +} + +// Represents the details of a tender with `type` `CASH`. +type TenderCashDetails struct { + // The total amount of cash provided by the buyer, before change is given. + BuyerTenderedMoney *Money `json:"buyer_tendered_money,omitempty" url:"buyer_tendered_money,omitempty"` + // The amount of change returned to the buyer. + ChangeBackMoney *Money `json:"change_back_money,omitempty" url:"change_back_money,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *Shift) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TenderCashDetails) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *Shift) UnmarshalJSON(data []byte) error { - type unmarshaler Shift +func (t *TenderCashDetails) UnmarshalJSON(data []byte) error { + type unmarshaler TenderCashDetails var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = Shift(value) + *t = TenderCashDetails(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *Shift) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TenderCashDetails) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -// Defines a filter used in a search for `Shift` records. `AND` logic is -// used by Square's servers to apply each filter property specified. -type ShiftFilter struct { - // Fetch shifts for the specified location. - LocationIDs []string `json:"location_ids,omitempty" url:"location_ids,omitempty"` - // Fetch shifts for the specified employees. DEPRECATED at version 2020-08-26. Use `team_member_ids` instead. - EmployeeIDs []string `json:"employee_ids,omitempty" url:"employee_ids,omitempty"` - // Fetch a `Shift` instance by `Shift.status`. - // See [ShiftFilterStatus](#type-shiftfilterstatus) for possible values - Status *ShiftFilterStatus `json:"status,omitempty" url:"status,omitempty"` - // Fetch `Shift` instances that start in the time range - Inclusive. - Start *TimeRange `json:"start,omitempty" url:"start,omitempty"` - // Fetch the `Shift` instances that end in the time range - Inclusive. - End *TimeRange `json:"end,omitempty" url:"end,omitempty"` - // Fetch the `Shift` instances based on the workday date range. - Workday *ShiftWorkday `json:"workday,omitempty" url:"workday,omitempty"` - // Fetch shifts for the specified team members. Replaced `employee_ids` at version "2020-08-26". - TeamMemberIDs []string `json:"team_member_ids,omitempty" url:"team_member_ids,omitempty"` +// Represents the details of a tender with `type` `SQUARE_ACCOUNT`. +type TenderSquareAccountDetails struct { + // The Square Account payment's current state (such as `AUTHORIZED` or + // `CAPTURED`). See [TenderSquareAccountDetailsStatus](entity:TenderSquareAccountDetailsStatus) + // for possible values. + // See [Status](#type-status) for possible values + Status *TenderSquareAccountDetailsStatus `json:"status,omitempty" url:"status,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *ShiftFilter) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TenderSquareAccountDetails) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *ShiftFilter) UnmarshalJSON(data []byte) error { - type unmarshaler ShiftFilter +func (t *TenderSquareAccountDetails) UnmarshalJSON(data []byte) error { + type unmarshaler TenderSquareAccountDetails var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = ShiftFilter(value) + *t = TenderSquareAccountDetails(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *ShiftFilter) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TenderSquareAccountDetails) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -// Specifies the `status` of `Shift` records to be returned. -type ShiftFilterStatus string +type TenderSquareAccountDetailsStatus string const ( - ShiftFilterStatusOpen ShiftFilterStatus = "OPEN" - ShiftFilterStatusClosed ShiftFilterStatus = "CLOSED" + TenderSquareAccountDetailsStatusAuthorized TenderSquareAccountDetailsStatus = "AUTHORIZED" + TenderSquareAccountDetailsStatusCaptured TenderSquareAccountDetailsStatus = "CAPTURED" + TenderSquareAccountDetailsStatusVoided TenderSquareAccountDetailsStatus = "VOIDED" + TenderSquareAccountDetailsStatusFailed TenderSquareAccountDetailsStatus = "FAILED" ) -func NewShiftFilterStatusFromString(s string) (ShiftFilterStatus, error) { +func NewTenderSquareAccountDetailsStatusFromString(s string) (TenderSquareAccountDetailsStatus, error) { switch s { - case "OPEN": - return ShiftFilterStatusOpen, nil - case "CLOSED": - return ShiftFilterStatusClosed, nil + case "AUTHORIZED": + return TenderSquareAccountDetailsStatusAuthorized, nil + case "CAPTURED": + return TenderSquareAccountDetailsStatusCaptured, nil + case "VOIDED": + return TenderSquareAccountDetailsStatusVoided, nil + case "FAILED": + return TenderSquareAccountDetailsStatusFailed, nil } - var t ShiftFilterStatus + var t TenderSquareAccountDetailsStatus return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (s ShiftFilterStatus) Ptr() *ShiftFilterStatus { - return &s -} - -// The parameters of a `Shift` search query, which includes filter and sort options. -type ShiftQuery struct { - // Query filter options. - Filter *ShiftFilter `json:"filter,omitempty" url:"filter,omitempty"` - // Sort order details. - Sort *ShiftSort `json:"sort,omitempty" url:"sort,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (t TenderSquareAccountDetailsStatus) Ptr() *TenderSquareAccountDetailsStatus { + return &t } -func (s *ShiftQuery) GetExtraProperties() map[string]interface{} { - return s.extraProperties -} +// Indicates a tender's type. +type TenderType string -func (s *ShiftQuery) UnmarshalJSON(data []byte) error { - type unmarshaler ShiftQuery - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *s = ShiftQuery(value) +const ( + TenderTypeCard TenderType = "CARD" + TenderTypeCash TenderType = "CASH" + TenderTypeThirdPartyCard TenderType = "THIRD_PARTY_CARD" + TenderTypeSquareGiftCard TenderType = "SQUARE_GIFT_CARD" + TenderTypeNoSale TenderType = "NO_SALE" + TenderTypeCheck TenderType = "CHECK" + TenderTypeMerchantGiftCard TenderType = "MERCHANT_GIFT_CARD" + TenderTypeThirdPartyEMoney TenderType = "THIRD_PARTY_E_MONEY" + TenderTypeBankAccount TenderType = "BANK_ACCOUNT" + TenderTypeWallet TenderType = "WALLET" + TenderTypeBuyNowPayLater TenderType = "BUY_NOW_PAY_LATER" + TenderTypeSquareAccount TenderType = "SQUARE_ACCOUNT" + TenderTypeBankTransfer TenderType = "BANK_TRANSFER" + TenderTypeOther TenderType = "OTHER" +) - extraProperties, err := core.ExtractExtraProperties(data, *s) - if err != nil { - return err +func NewTenderTypeFromString(s string) (TenderType, error) { + switch s { + case "CARD": + return TenderTypeCard, nil + case "CASH": + return TenderTypeCash, nil + case "THIRD_PARTY_CARD": + return TenderTypeThirdPartyCard, nil + case "SQUARE_GIFT_CARD": + return TenderTypeSquareGiftCard, nil + case "NO_SALE": + return TenderTypeNoSale, nil + case "CHECK": + return TenderTypeCheck, nil + case "MERCHANT_GIFT_CARD": + return TenderTypeMerchantGiftCard, nil + case "THIRD_PARTY_E_MONEY": + return TenderTypeThirdPartyEMoney, nil + case "BANK_ACCOUNT": + return TenderTypeBankAccount, nil + case "WALLET": + return TenderTypeWallet, nil + case "BUY_NOW_PAY_LATER": + return TenderTypeBuyNowPayLater, nil + case "SQUARE_ACCOUNT": + return TenderTypeSquareAccount, nil + case "BANK_TRANSFER": + return TenderTypeBankTransfer, nil + case "OTHER": + return TenderTypeOther, nil } - s.extraProperties = extraProperties - - s._rawJSON = json.RawMessage(data) - return nil + var t TenderType + return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (s *ShiftQuery) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(s); err == nil { - return value - } - return fmt.Sprintf("%#v", s) +func (t TenderType) Ptr() *TenderType { + return &t } -// Sets the sort order of search results. -type ShiftSort struct { - // The field to sort on. - // See [ShiftSortField](#type-shiftsortfield) for possible values - Field *ShiftSortField `json:"field,omitempty" url:"field,omitempty"` - // The order in which results are returned. Defaults to DESC. - // See [SortOrder](#type-sortorder) for possible values - Order *SortOrder `json:"order,omitempty" url:"order,omitempty"` +// Represents an action processed by the Square Terminal. +type TerminalAction struct { + // A unique ID for this `TerminalAction`. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The unique Id of the device intended for this `TerminalAction`. + // The Id can be retrieved from /v2/devices api. + DeviceID *string `json:"device_id,omitempty" url:"device_id,omitempty"` + // The duration as an RFC 3339 duration, after which the action will be automatically canceled. + // TerminalActions that are `PENDING` will be automatically `CANCELED` and have a cancellation reason + // of `TIMED_OUT` + // + // Default: 5 minutes from creation + // + // Maximum: 5 minutes + DeadlineDuration *string `json:"deadline_duration,omitempty" url:"deadline_duration,omitempty"` + // The status of the `TerminalAction`. + // Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` + Status *string `json:"status,omitempty" url:"status,omitempty"` + // The reason why `TerminalAction` is canceled. Present if the status is `CANCELED`. + // See [ActionCancelReason](#type-actioncancelreason) for possible values + CancelReason *ActionCancelReason `json:"cancel_reason,omitempty" url:"cancel_reason,omitempty"` + // The time when the `TerminalAction` was created as an RFC 3339 timestamp. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The time when the `TerminalAction` was last updated as an RFC 3339 timestamp. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // The ID of the application that created the action. + AppID *string `json:"app_id,omitempty" url:"app_id,omitempty"` + // The location id the action is attached to, if a link can be made. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // Represents the type of the action. + // See [ActionType](#type-actiontype) for possible values + Type *TerminalActionActionType `json:"type,omitempty" url:"type,omitempty"` + // Describes configuration for the QR code action. Requires `QR_CODE` type. + QrCodeOptions *QrCodeOptions `json:"qr_code_options,omitempty" url:"qr_code_options,omitempty"` + // Describes configuration for the save-card action. Requires `SAVE_CARD` type. + SaveCardOptions *SaveCardOptions `json:"save_card_options,omitempty" url:"save_card_options,omitempty"` + // Describes configuration for the signature capture action. Requires `SIGNATURE` type. + SignatureOptions *SignatureOptions `json:"signature_options,omitempty" url:"signature_options,omitempty"` + // Describes configuration for the confirmation action. Requires `CONFIRMATION` type. + ConfirmationOptions *ConfirmationOptions `json:"confirmation_options,omitempty" url:"confirmation_options,omitempty"` + // Describes configuration for the receipt action. Requires `RECEIPT` type. + ReceiptOptions *ReceiptOptions `json:"receipt_options,omitempty" url:"receipt_options,omitempty"` + // Describes configuration for the data collection action. Requires `DATA_COLLECTION` type. + DataCollectionOptions *DataCollectionOptions `json:"data_collection_options,omitempty" url:"data_collection_options,omitempty"` + // Describes configuration for the select action. Requires `SELECT` type. + SelectOptions *SelectOptions `json:"select_options,omitempty" url:"select_options,omitempty"` + // Details about the Terminal that received the action request (such as battery level, + // operating system version, and network connection settings). + // + // Only available for `PING` action type. + DeviceMetadata *DeviceMetadata `json:"device_metadata,omitempty" url:"device_metadata,omitempty"` + // Indicates the action will be linked to another action and requires a waiting dialog to be + // displayed instead of returning to the idle screen on completion of the action. + // + // Only supported on SIGNATURE, CONFIRMATION, DATA_COLLECTION, and SELECT types. + AwaitNextAction *bool `json:"await_next_action,omitempty" url:"await_next_action,omitempty"` + // The timeout duration of the waiting dialog as an RFC 3339 duration, after which the + // waiting dialog will no longer be displayed and the Terminal will return to the idle screen. + // + // Default: 5 minutes from when the waiting dialog is displayed + // + // Maximum: 5 minutes + AwaitNextActionDuration *string `json:"await_next_action_duration,omitempty" url:"await_next_action_duration,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *ShiftSort) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TerminalAction) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *ShiftSort) UnmarshalJSON(data []byte) error { - type unmarshaler ShiftSort +func (t *TerminalAction) UnmarshalJSON(data []byte) error { + type unmarshaler TerminalAction var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = ShiftSort(value) + *t = TerminalAction(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *ShiftSort) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TerminalAction) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) -} - -// Enumerates the `Shift` fields to sort on. -type ShiftSortField string - -const ( - ShiftSortFieldStartAt ShiftSortField = "START_AT" - ShiftSortFieldEndAt ShiftSortField = "END_AT" - ShiftSortFieldCreatedAt ShiftSortField = "CREATED_AT" - ShiftSortFieldUpdatedAt ShiftSortField = "UPDATED_AT" -) - -func NewShiftSortFieldFromString(s string) (ShiftSortField, error) { - switch s { - case "START_AT": - return ShiftSortFieldStartAt, nil - case "END_AT": - return ShiftSortFieldEndAt, nil - case "CREATED_AT": - return ShiftSortFieldCreatedAt, nil - case "UPDATED_AT": - return ShiftSortFieldUpdatedAt, nil - } - var t ShiftSortField - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (s ShiftSortField) Ptr() *ShiftSortField { - return &s + return fmt.Sprintf("%#v", t) } -// Enumerates the possible status of a `Shift`. -type ShiftStatus string +// Describes the type of this unit and indicates which field contains the unit information. This is an ‘open’ enum. +type TerminalActionActionType string const ( - ShiftStatusOpen ShiftStatus = "OPEN" - ShiftStatusClosed ShiftStatus = "CLOSED" + TerminalActionActionTypeInvalidType TerminalActionActionType = "INVALID_TYPE" + TerminalActionActionTypeUnsupportedActionType TerminalActionActionType = "UNSUPPORTED_ACTION_TYPE" + TerminalActionActionTypeCheckout TerminalActionActionType = "CHECKOUT" + TerminalActionActionTypeRefund TerminalActionActionType = "REFUND" + TerminalActionActionTypeQrCode TerminalActionActionType = "QR_CODE" + TerminalActionActionTypePing TerminalActionActionType = "PING" + TerminalActionActionTypeSaveCard TerminalActionActionType = "SAVE_CARD" + TerminalActionActionTypeSignature TerminalActionActionType = "SIGNATURE" + TerminalActionActionTypeConfirmation TerminalActionActionType = "CONFIRMATION" + TerminalActionActionTypeReceipt TerminalActionActionType = "RECEIPT" + TerminalActionActionTypeDataCollection TerminalActionActionType = "DATA_COLLECTION" + TerminalActionActionTypeSelect TerminalActionActionType = "SELECT" + TerminalActionActionTypeStack TerminalActionActionType = "STACK" + TerminalActionActionTypeConfig TerminalActionActionType = "CONFIG" + TerminalActionActionTypeInternalPing TerminalActionActionType = "INTERNAL_PING" ) -func NewShiftStatusFromString(s string) (ShiftStatus, error) { +func NewTerminalActionActionTypeFromString(s string) (TerminalActionActionType, error) { switch s { - case "OPEN": - return ShiftStatusOpen, nil - case "CLOSED": - return ShiftStatusClosed, nil + case "INVALID_TYPE": + return TerminalActionActionTypeInvalidType, nil + case "UNSUPPORTED_ACTION_TYPE": + return TerminalActionActionTypeUnsupportedActionType, nil + case "CHECKOUT": + return TerminalActionActionTypeCheckout, nil + case "REFUND": + return TerminalActionActionTypeRefund, nil + case "QR_CODE": + return TerminalActionActionTypeQrCode, nil + case "PING": + return TerminalActionActionTypePing, nil + case "SAVE_CARD": + return TerminalActionActionTypeSaveCard, nil + case "SIGNATURE": + return TerminalActionActionTypeSignature, nil + case "CONFIRMATION": + return TerminalActionActionTypeConfirmation, nil + case "RECEIPT": + return TerminalActionActionTypeReceipt, nil + case "DATA_COLLECTION": + return TerminalActionActionTypeDataCollection, nil + case "SELECT": + return TerminalActionActionTypeSelect, nil + case "STACK": + return TerminalActionActionTypeStack, nil + case "CONFIG": + return TerminalActionActionTypeConfig, nil + case "INTERNAL_PING": + return TerminalActionActionTypeInternalPing, nil } - var t ShiftStatus + var t TerminalActionActionType return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (s ShiftStatus) Ptr() *ShiftStatus { - return &s +func (t TerminalActionActionType) Ptr() *TerminalActionActionType { + return &t } -// The hourly wage rate used to compensate an employee for this shift. -type ShiftWage struct { - // The name of the job performed during this shift. - Title *string `json:"title,omitempty" url:"title,omitempty"` - // Can be a custom-set hourly wage or the calculated effective hourly - // wage based on the annual wage and hours worked per week. - HourlyRate *Money `json:"hourly_rate,omitempty" url:"hourly_rate,omitempty"` - // The id of the job performed during this shift. Square - // labor-reporting UIs might group shifts together by id. This cannot be used to retrieve the job. - JobID *string `json:"job_id,omitempty" url:"job_id,omitempty"` - // Whether team members are eligible for tips when working this job. - TipEligible *bool `json:"tip_eligible,omitempty" url:"tip_eligible,omitempty"` +// Published when a TerminalAction is created. +type TerminalActionCreatedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents, `"terminal.action.created"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // RFC 3339 timestamp of when the event was created. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *TerminalActionCreatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *ShiftWage) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TerminalActionCreatedEvent) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *ShiftWage) UnmarshalJSON(data []byte) error { - type unmarshaler ShiftWage +func (t *TerminalActionCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler TerminalActionCreatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = ShiftWage(value) + *t = TerminalActionCreatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *ShiftWage) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TerminalActionCreatedEvent) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -// A `Shift` search query filter parameter that sets a range of days that -// a `Shift` must start or end in before passing the filter condition. -type ShiftWorkday struct { - // Dates for fetching the shifts. - DateRange *DateRange `json:"date_range,omitempty" url:"date_range,omitempty"` - // The strategy on which the dates are applied. - // See [ShiftWorkdayMatcher](#type-shiftworkdaymatcher) for possible values - MatchShiftsBy *ShiftWorkdayMatcher `json:"match_shifts_by,omitempty" url:"match_shifts_by,omitempty"` - // Location-specific timezones convert workdays to datetime filters. - // Every location included in the query must have a timezone or this field - // must be provided as a fallback. Format: the IANA timezone database - // identifier for the relevant timezone. - DefaultTimezone *string `json:"default_timezone,omitempty" url:"default_timezone,omitempty"` +type TerminalActionCreatedEventData struct { + // Name of the created object’s type, `"action"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the created terminal action. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the created terminal action. + Object *TerminalActionCreatedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *ShiftWorkday) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TerminalActionCreatedEventData) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *ShiftWorkday) UnmarshalJSON(data []byte) error { - type unmarshaler ShiftWorkday +func (t *TerminalActionCreatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler TerminalActionCreatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = ShiftWorkday(value) + *t = TerminalActionCreatedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *ShiftWorkday) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TerminalActionCreatedEventData) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) -} - -// Defines the logic used to apply a workday filter. -type ShiftWorkdayMatcher string - -const ( - ShiftWorkdayMatcherStartAt ShiftWorkdayMatcher = "START_AT" - ShiftWorkdayMatcherEndAt ShiftWorkdayMatcher = "END_AT" - ShiftWorkdayMatcherIntersection ShiftWorkdayMatcher = "INTERSECTION" -) - -func NewShiftWorkdayMatcherFromString(s string) (ShiftWorkdayMatcher, error) { - switch s { - case "START_AT": - return ShiftWorkdayMatcherStartAt, nil - case "END_AT": - return ShiftWorkdayMatcherEndAt, nil - case "INTERSECTION": - return ShiftWorkdayMatcherIntersection, nil - } - var t ShiftWorkdayMatcher - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (s ShiftWorkdayMatcher) Ptr() *ShiftWorkdayMatcher { - return &s + return fmt.Sprintf("%#v", t) } -type ShippingFee struct { - // The name for the shipping fee. - Name *string `json:"name,omitempty" url:"name,omitempty"` - // The amount and currency for the shipping fee. - Charge *Money `json:"charge,omitempty" url:"charge,omitempty"` +type TerminalActionCreatedEventObject struct { + // The created terminal action. + Action *TerminalAction `json:"action,omitempty" url:"action,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *ShippingFee) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TerminalActionCreatedEventObject) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *ShippingFee) UnmarshalJSON(data []byte) error { - type unmarshaler ShippingFee +func (t *TerminalActionCreatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler TerminalActionCreatedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = ShippingFee(value) + *t = TerminalActionCreatedEventObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *ShippingFee) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TerminalActionCreatedEventObject) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -type SignatureImage struct { - // The mime/type of the image data. - // Use `image/png;base64` for png. - ImageType *string `json:"image_type,omitempty" url:"image_type,omitempty"` - // The base64 representation of the image. - Data *string `json:"data,omitempty" url:"data,omitempty"` +type TerminalActionQuery struct { + // Options for filtering returned `TerminalAction`s + Filter *TerminalActionQueryFilter `json:"filter,omitempty" url:"filter,omitempty"` + // Option for sorting returned `TerminalAction` objects. + Sort *TerminalActionQuerySort `json:"sort,omitempty" url:"sort,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SignatureImage) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TerminalActionQuery) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SignatureImage) UnmarshalJSON(data []byte) error { - type unmarshaler SignatureImage +func (t *TerminalActionQuery) UnmarshalJSON(data []byte) error { + type unmarshaler TerminalActionQuery var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SignatureImage(value) + *t = TerminalActionQuery(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SignatureImage) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TerminalActionQuery) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -type SignatureOptions struct { - // The title text to display in the signature capture flow on the Terminal. - Title string `json:"title" url:"title"` - // The body text to display in the signature capture flow on the Terminal. - Body string `json:"body" url:"body"` - // An image representation of the collected signature. - Signature []*SignatureImage `json:"signature,omitempty" url:"signature,omitempty"` +type TerminalActionQueryFilter struct { + // `TerminalAction`s associated with a specific device. If no device is specified then all + // `TerminalAction`s for the merchant will be displayed. + DeviceID *string `json:"device_id,omitempty" url:"device_id,omitempty"` + // Time range for the beginning of the reporting period. Inclusive. + // Default value: The current time minus one day. + // Note that `TerminalAction`s are available for 30 days after creation. + CreatedAt *TimeRange `json:"created_at,omitempty" url:"created_at,omitempty"` + // Filter results with the desired status of the `TerminalAction` + // Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` + Status *string `json:"status,omitempty" url:"status,omitempty"` + // Filter results with the requested ActionType. + // See [TerminalActionActionType](#type-terminalactionactiontype) for possible values + Type *TerminalActionActionType `json:"type,omitempty" url:"type,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SignatureOptions) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TerminalActionQueryFilter) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SignatureOptions) UnmarshalJSON(data []byte) error { - type unmarshaler SignatureOptions +func (t *TerminalActionQueryFilter) UnmarshalJSON(data []byte) error { + type unmarshaler TerminalActionQueryFilter var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SignatureOptions(value) + *t = TerminalActionQueryFilter(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SignatureOptions) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TerminalActionQueryFilter) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -// Represents a Square Online site, which is an online store for a Square seller. -type Site struct { - // The Square-assigned ID of the site. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The title of the site. - SiteTitle *string `json:"site_title,omitempty" url:"site_title,omitempty"` - // The domain of the site (without the protocol). For example, `mysite1.square.site`. - Domain *string `json:"domain,omitempty" url:"domain,omitempty"` - // Indicates whether the site is published. - IsPublished *bool `json:"is_published,omitempty" url:"is_published,omitempty"` - // The timestamp of when the site was created, in RFC 3339 format. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The timestamp of when the site was last updated, in RFC 3339 format. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` +type TerminalActionQuerySort struct { + // The order in which results are listed. + // + // - `ASC` - Oldest to newest. + // - `DESC` - Newest to oldest (default). + // See [SortOrder](#type-sortorder) for possible values + SortOrder *SortOrder `json:"sort_order,omitempty" url:"sort_order,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *Site) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TerminalActionQuerySort) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *Site) UnmarshalJSON(data []byte) error { - type unmarshaler Site +func (t *TerminalActionQuerySort) UnmarshalJSON(data []byte) error { + type unmarshaler TerminalActionQuerySort var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = Site(value) + *t = TerminalActionQuerySort(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *Site) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TerminalActionQuerySort) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -// Represents the snippet that is added to a Square Online site. The snippet code is injected into the `head` element of all pages on the site, except for checkout pages. -type Snippet struct { - // The Square-assigned ID for the snippet. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The ID of the site that contains the snippet. - SiteID *string `json:"site_id,omitempty" url:"site_id,omitempty"` - // The snippet code, which can contain valid HTML, JavaScript, or both. - Content string `json:"content" url:"content"` - // The timestamp of when the snippet was initially added to the site, in RFC 3339 format. +// Published when a TerminalAction is updated. +type TerminalActionUpdatedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents, `"terminal.action.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // RFC 3339 timestamp of when the event was created. CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The timestamp of when the snippet was last updated on the site, in RFC 3339 format. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // Data associated with the event. + Data *TerminalActionUpdatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *Snippet) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TerminalActionUpdatedEvent) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *Snippet) UnmarshalJSON(data []byte) error { - type unmarshaler Snippet +func (t *TerminalActionUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler TerminalActionUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = Snippet(value) + *t = TerminalActionUpdatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *Snippet) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TerminalActionUpdatedEvent) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -type SnippetResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The snippet. - Snippet *Snippet `json:"snippet,omitempty" url:"snippet,omitempty"` +type TerminalActionUpdatedEventData struct { + // Name of the updated object’s type, `"action"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the updated terminal action. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the updated terminal action. + Object *TerminalActionUpdatedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SnippetResponse) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TerminalActionUpdatedEventData) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SnippetResponse) UnmarshalJSON(data []byte) error { - type unmarshaler SnippetResponse +func (t *TerminalActionUpdatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler TerminalActionUpdatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SnippetResponse(value) + *t = TerminalActionUpdatedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SnippetResponse) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TerminalActionUpdatedEventData) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) -} - -// The order (e.g., chronological or alphabetical) in which results from a request are returned. -type SortOrder string - -const ( - SortOrderDesc SortOrder = "DESC" - SortOrderAsc SortOrder = "ASC" -) - -func NewSortOrderFromString(s string) (SortOrder, error) { - switch s { - case "DESC": - return SortOrderDesc, nil - case "ASC": - return SortOrderAsc, nil - } - var t SortOrder - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (s SortOrder) Ptr() *SortOrder { - return &s + return fmt.Sprintf("%#v", t) } -// Represents information about the application used to generate a change. -type SourceApplication struct { - // **Read only** The [product](entity:Product) type of the application. - // See [Product](#type-product) for possible values - Product *Product `json:"product,omitempty" url:"product,omitempty"` - // **Read only** The Square-assigned ID of the application. This field is used only if the - // [product](entity:Product) type is `EXTERNAL_API`. - ApplicationID *string `json:"application_id,omitempty" url:"application_id,omitempty"` - // **Read only** The display name of the application - // (for example, `"Custom Application"` or `"Square POS 4.74 for Android"`). - Name *string `json:"name,omitempty" url:"name,omitempty"` +type TerminalActionUpdatedEventObject struct { + // The updated terminal action. + Action *TerminalAction `json:"action,omitempty" url:"action,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SourceApplication) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TerminalActionUpdatedEventObject) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SourceApplication) UnmarshalJSON(data []byte) error { - type unmarshaler SourceApplication +func (t *TerminalActionUpdatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler TerminalActionUpdatedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SourceApplication(value) + *t = TerminalActionUpdatedEventObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SourceApplication) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TerminalActionUpdatedEventObject) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -// Additional details about Square Account payments. -type SquareAccountDetails struct { - // Unique identifier for the payment source used for this payment. - PaymentSourceToken *string `json:"payment_source_token,omitempty" url:"payment_source_token,omitempty"` - // Information about errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Represents a checkout processed by the Square Terminal. +type TerminalCheckout struct { + // A unique ID for this `TerminalCheckout`. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The amount of money (including the tax amount) that the Square Terminal device should try to collect. + AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` + // An optional user-defined reference ID that can be used to associate + // this `TerminalCheckout` to another entity in an external system. For example, an order + // ID generated by a third-party shopping cart. The ID is also associated with any payments + // used to complete the checkout. + ReferenceID *string `json:"reference_id,omitempty" url:"reference_id,omitempty"` + // An optional note to associate with the checkout, as well as with any payments used to complete the checkout. + // Note: maximum 500 characters + Note *string `json:"note,omitempty" url:"note,omitempty"` + // The reference to the Square order ID for the checkout request. Supported only in the US. + OrderID *string `json:"order_id,omitempty" url:"order_id,omitempty"` + // Payment-specific options for the checkout request. Supported only in the US. + PaymentOptions *PaymentOptions `json:"payment_options,omitempty" url:"payment_options,omitempty"` + // Options to control the display and behavior of the Square Terminal device. + DeviceOptions *DeviceCheckoutOptions `json:"device_options,omitempty" url:"device_options,omitempty"` + // An RFC 3339 duration, after which the checkout is automatically canceled. + // A `TerminalCheckout` that is `PENDING` is automatically `CANCELED` and has a cancellation reason + // of `TIMED_OUT`. + // + // Default: 5 minutes from creation + // + // Maximum: 5 minutes + DeadlineDuration *string `json:"deadline_duration,omitempty" url:"deadline_duration,omitempty"` + // The status of the `TerminalCheckout`. + // Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` + Status *string `json:"status,omitempty" url:"status,omitempty"` + // The reason why `TerminalCheckout` is canceled. Present if the status is `CANCELED`. + // See [ActionCancelReason](#type-actioncancelreason) for possible values + CancelReason *ActionCancelReason `json:"cancel_reason,omitempty" url:"cancel_reason,omitempty"` + // A list of IDs for payments created by this `TerminalCheckout`. + PaymentIDs []string `json:"payment_ids,omitempty" url:"payment_ids,omitempty"` + // The time when the `TerminalCheckout` was created, as an RFC 3339 timestamp. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The time when the `TerminalCheckout` was last updated, as an RFC 3339 timestamp. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // The ID of the application that created the checkout. + AppID *string `json:"app_id,omitempty" url:"app_id,omitempty"` + // The location of the device where the `TerminalCheckout` was directed. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The type of payment the terminal should attempt to capture from. Defaults to `CARD_PRESENT`. + // See [CheckoutOptionsPaymentType](#type-checkoutoptionspaymenttype) for possible values + PaymentType *CheckoutOptionsPaymentType `json:"payment_type,omitempty" url:"payment_type,omitempty"` + // An optional ID of the team member associated with creating the checkout. + TeamMemberID *string `json:"team_member_id,omitempty" url:"team_member_id,omitempty"` + // An optional ID of the customer associated with the checkout. + CustomerID *string `json:"customer_id,omitempty" url:"customer_id,omitempty"` + // The amount the developer is taking as a fee for facilitating the payment on behalf + // of the seller. + // + // The amount cannot be more than 90% of the total amount of the payment. + // + // The amount must be specified in the smallest denomination of the applicable currency (for example, US dollar amounts are specified in cents). For more information, see [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts). + // + // The fee currency code must match the currency associated with the seller that is accepting the payment. The application must be from a developer account in the same country and using the same currency code as the seller. + // + // For more information about the application fee scenario, see [Take Payments and Collect Fees](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees). + // + // To set this field, PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS OAuth permission is required. For more information, see [Permissions](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees#permissions). + // + // Supported only in the US. + AppFeeMoney *Money `json:"app_fee_money,omitempty" url:"app_fee_money,omitempty"` + // Optional additional payment information to include on the customer's card statement as + // part of the statement description. This can be, for example, an invoice number, ticket number, + // or short description that uniquely identifies the purchase. Supported only in the US. + StatementDescriptionIdentifier *string `json:"statement_description_identifier,omitempty" url:"statement_description_identifier,omitempty"` + // The amount designated as a tip, in addition to `amount_money`. This may only be set for a + // checkout that has tipping disabled (`tip_settings.allow_tipping` is `false`). Supported only in + // the US. + TipMoney *Money `json:"tip_money,omitempty" url:"tip_money,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SquareAccountDetails) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TerminalCheckout) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SquareAccountDetails) UnmarshalJSON(data []byte) error { - type unmarshaler SquareAccountDetails +func (t *TerminalCheckout) UnmarshalJSON(data []byte) error { + type unmarshaler TerminalCheckout var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SquareAccountDetails(value) + *t = TerminalCheckout(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SquareAccountDetails) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TerminalCheckout) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -// Contains the name and abbreviation for standard measurement unit. -type StandardUnitDescription struct { - // Identifies the measurement unit being described. - Unit *MeasurementUnit `json:"unit,omitempty" url:"unit,omitempty"` - // UI display name of the measurement unit. For example, 'Pound'. - Name *string `json:"name,omitempty" url:"name,omitempty"` - // UI display abbreviation for the measurement unit. For example, 'lb'. - Abbreviation *string `json:"abbreviation,omitempty" url:"abbreviation,omitempty"` +// Published when a [TerminalCheckout](entity:TerminalCheckout) is created. +type TerminalCheckoutCreatedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents, `"terminal.checkout.created"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // RFC 3339 timestamp of when the event was created. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *TerminalCheckoutCreatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *StandardUnitDescription) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TerminalCheckoutCreatedEvent) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *StandardUnitDescription) UnmarshalJSON(data []byte) error { - type unmarshaler StandardUnitDescription +func (t *TerminalCheckoutCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler TerminalCheckoutCreatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = StandardUnitDescription(value) + *t = TerminalCheckoutCreatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *StandardUnitDescription) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TerminalCheckoutCreatedEvent) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -// Group of standard measurement units. -type StandardUnitDescriptionGroup struct { - // List of standard (non-custom) measurement units in this description group. - StandardUnitDescriptions []*StandardUnitDescription `json:"standard_unit_descriptions,omitempty" url:"standard_unit_descriptions,omitempty"` - // IETF language tag. - LanguageCode *string `json:"language_code,omitempty" url:"language_code,omitempty"` +type TerminalCheckoutCreatedEventData struct { + // Name of the created object’s type, `"checkout"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the created terminal checkout. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the created terminal checkout + Object *TerminalCheckoutCreatedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *StandardUnitDescriptionGroup) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TerminalCheckoutCreatedEventData) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *StandardUnitDescriptionGroup) UnmarshalJSON(data []byte) error { - type unmarshaler StandardUnitDescriptionGroup +func (t *TerminalCheckoutCreatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler TerminalCheckoutCreatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = StandardUnitDescriptionGroup(value) + *t = TerminalCheckoutCreatedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *StandardUnitDescriptionGroup) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TerminalCheckoutCreatedEventData) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -// Defines the parameters for a `SubmitEvidence` request. -type SubmitEvidenceRequest struct { +type TerminalCheckoutCreatedEventObject struct { + // The created terminal checkout + Checkout *TerminalCheckout `json:"checkout,omitempty" url:"checkout,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SubmitEvidenceRequest) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TerminalCheckoutCreatedEventObject) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SubmitEvidenceRequest) UnmarshalJSON(data []byte) error { - type unmarshaler SubmitEvidenceRequest +func (t *TerminalCheckoutCreatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler TerminalCheckoutCreatedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SubmitEvidenceRequest(value) + *t = TerminalCheckoutCreatedEventObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SubmitEvidenceRequest) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TerminalCheckoutCreatedEventObject) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -// Defines the fields in a `SubmitEvidence` response. -type SubmitEvidenceResponse struct { - // Information about errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The `Dispute` for which evidence was submitted. - Dispute *Dispute `json:"dispute,omitempty" url:"dispute,omitempty"` +type TerminalCheckoutQuery struct { + // Options for filtering returned `TerminalCheckout` objects. + Filter *TerminalCheckoutQueryFilter `json:"filter,omitempty" url:"filter,omitempty"` + // Option for sorting returned `TerminalCheckout` objects. + Sort *TerminalCheckoutQuerySort `json:"sort,omitempty" url:"sort,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SubmitEvidenceResponse) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TerminalCheckoutQuery) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SubmitEvidenceResponse) UnmarshalJSON(data []byte) error { - type unmarshaler SubmitEvidenceResponse +func (t *TerminalCheckoutQuery) UnmarshalJSON(data []byte) error { + type unmarshaler TerminalCheckoutQuery var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SubmitEvidenceResponse(value) + *t = TerminalCheckoutQuery(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SubmitEvidenceResponse) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TerminalCheckoutQuery) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -// Represents a subscription purchased by a customer. -// -// For more information, see -// [Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). -type Subscription struct { - // The Square-assigned ID of the subscription. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The ID of the location associated with the subscription. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` - // The ID of the subscribed-to [subscription plan variation](entity:CatalogSubscriptionPlanVariation). - PlanVariationID *string `json:"plan_variation_id,omitempty" url:"plan_variation_id,omitempty"` - // The ID of the subscribing [customer](entity:Customer) profile. - CustomerID *string `json:"customer_id,omitempty" url:"customer_id,omitempty"` - // The `YYYY-MM-DD`-formatted date (for example, 2013-01-15) to start the subscription. - StartDate *string `json:"start_date,omitempty" url:"start_date,omitempty"` - // The `YYYY-MM-DD`-formatted date (for example, 2013-01-15) to cancel the subscription, - // when the subscription status changes to `CANCELED` and the subscription billing stops. - // - // If this field is not set, the subscription ends according its subscription plan. - // - // This field cannot be updated, other than being cleared. - CanceledDate *string `json:"canceled_date,omitempty" url:"canceled_date,omitempty"` - // The `YYYY-MM-DD`-formatted date up to when the subscriber is invoiced for the - // subscription. - // - // After the invoice is sent for a given billing period, - // this date will be the last day of the billing period. - // For example, - // suppose for the month of May a subscriber gets an invoice - // (or charged the card) on May 1. For the monthly billing scenario, - // this date is then set to May 31. - ChargedThroughDate *string `json:"charged_through_date,omitempty" url:"charged_through_date,omitempty"` - // The current status of the subscription. - // See [SubscriptionStatus](#type-subscriptionstatus) for possible values - Status *SubscriptionStatus `json:"status,omitempty" url:"status,omitempty"` - // The tax amount applied when billing the subscription. The - // percentage is expressed in decimal form, using a `'.'` as the decimal - // separator and without a `'%'` sign. For example, a value of `7.5` - // corresponds to 7.5%. - TaxPercentage *string `json:"tax_percentage,omitempty" url:"tax_percentage,omitempty"` - // The IDs of the [invoices](entity:Invoice) created for the - // subscription, listed in order when the invoices were created - // (newest invoices appear first). - InvoiceIDs []string `json:"invoice_ids,omitempty" url:"invoice_ids,omitempty"` - // A custom price which overrides the cost of a subscription plan variation with `STATIC` pricing. - // This field does not affect itemized subscriptions with `RELATIVE` pricing. Instead, - // you should edit the Subscription's [order template](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions#phases-and-order-templates). - PriceOverrideMoney *Money `json:"price_override_money,omitempty" url:"price_override_money,omitempty"` - // The version of the object. When updating an object, the version - // supplied must match the version in the database, otherwise the write will - // be rejected as conflicting. - Version *int64 `json:"version,omitempty" url:"version,omitempty"` - // The timestamp when the subscription was created, in RFC 3339 format. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The ID of the [subscriber's](entity:Customer) [card](entity:Card) - // used to charge for the subscription. - CardID *string `json:"card_id,omitempty" url:"card_id,omitempty"` - // Timezone that will be used in date calculations for the subscription. - // Defaults to the timezone of the location based on `location_id`. - // Format: the IANA Timezone Database identifier for the location timezone (for example, `America/Los_Angeles`). - Timezone *string `json:"timezone,omitempty" url:"timezone,omitempty"` - // The origination details of the subscription. - Source *SubscriptionSource `json:"source,omitempty" url:"source,omitempty"` - // The list of scheduled actions on this subscription. It is set only in the response from - // [RetrieveSubscription]($e/Subscriptions/RetrieveSubscription) with the query parameter - // of `include=actions` or from - // [SearchSubscriptions]($e/Subscriptions/SearchSubscriptions) with the input parameter - // of `include:["actions"]`. - Actions []*SubscriptionAction `json:"actions,omitempty" url:"actions,omitempty"` - // The day of the month on which the subscription will issue invoices and publish orders. - MonthlyBillingAnchorDate *int `json:"monthly_billing_anchor_date,omitempty" url:"monthly_billing_anchor_date,omitempty"` - // array of phases for this subscription - Phases []*Phase `json:"phases,omitempty" url:"phases,omitempty"` +type TerminalCheckoutQueryFilter struct { + // The `TerminalCheckout` objects associated with a specific device. If no device is specified, then all + // `TerminalCheckout` objects for the merchant are displayed. + DeviceID *string `json:"device_id,omitempty" url:"device_id,omitempty"` + // The time range for the beginning of the reporting period, which is inclusive. + // Default value: The current time minus one day. + // Note that `TerminalCheckout`s are available for 30 days after creation. + CreatedAt *TimeRange `json:"created_at,omitempty" url:"created_at,omitempty"` + // Filtered results with the desired status of the `TerminalCheckout`. + // Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` + Status *string `json:"status,omitempty" url:"status,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *Subscription) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TerminalCheckoutQueryFilter) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *Subscription) UnmarshalJSON(data []byte) error { - type unmarshaler Subscription +func (t *TerminalCheckoutQueryFilter) UnmarshalJSON(data []byte) error { + type unmarshaler TerminalCheckoutQueryFilter var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = Subscription(value) + *t = TerminalCheckoutQueryFilter(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *Subscription) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TerminalCheckoutQueryFilter) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -// Represents an action as a pending change to a subscription. -type SubscriptionAction struct { - // The ID of an action scoped to a subscription. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The type of the action. - // See [SubscriptionActionType](#type-subscriptionactiontype) for possible values - Type *SubscriptionActionType `json:"type,omitempty" url:"type,omitempty"` - // The `YYYY-MM-DD`-formatted date when the action occurs on the subscription. - EffectiveDate *string `json:"effective_date,omitempty" url:"effective_date,omitempty"` - // The new billing anchor day value, for a `CHANGE_BILLING_ANCHOR_DATE` action. - MonthlyBillingAnchorDate *int `json:"monthly_billing_anchor_date,omitempty" url:"monthly_billing_anchor_date,omitempty"` - // A list of Phases, to pass phase-specific information used in the swap. - Phases []*Phase `json:"phases,omitempty" url:"phases,omitempty"` - // The target subscription plan variation that a subscription switches to, for a `SWAP_PLAN` action. - NewPlanVariationID *string `json:"new_plan_variation_id,omitempty" url:"new_plan_variation_id,omitempty"` +type TerminalCheckoutQuerySort struct { + // The order in which results are listed. + // Default: `DESC` + // See [SortOrder](#type-sortorder) for possible values + SortOrder *SortOrder `json:"sort_order,omitempty" url:"sort_order,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SubscriptionAction) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TerminalCheckoutQuerySort) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SubscriptionAction) UnmarshalJSON(data []byte) error { - type unmarshaler SubscriptionAction +func (t *TerminalCheckoutQuerySort) UnmarshalJSON(data []byte) error { + type unmarshaler TerminalCheckoutQuerySort var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SubscriptionAction(value) + *t = TerminalCheckoutQuerySort(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SubscriptionAction) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TerminalCheckoutQuerySort) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) -} - -// Supported types of an action as a pending change to a subscription. -type SubscriptionActionType string - -const ( - SubscriptionActionTypeCancel SubscriptionActionType = "CANCEL" - SubscriptionActionTypePause SubscriptionActionType = "PAUSE" - SubscriptionActionTypeResume SubscriptionActionType = "RESUME" - SubscriptionActionTypeSwapPlan SubscriptionActionType = "SWAP_PLAN" - SubscriptionActionTypeChangeBillingAnchorDate SubscriptionActionType = "CHANGE_BILLING_ANCHOR_DATE" -) - -func NewSubscriptionActionTypeFromString(s string) (SubscriptionActionType, error) { - switch s { - case "CANCEL": - return SubscriptionActionTypeCancel, nil - case "PAUSE": - return SubscriptionActionTypePause, nil - case "RESUME": - return SubscriptionActionTypeResume, nil - case "SWAP_PLAN": - return SubscriptionActionTypeSwapPlan, nil - case "CHANGE_BILLING_ANCHOR_DATE": - return SubscriptionActionTypeChangeBillingAnchorDate, nil - } - var t SubscriptionActionType - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (s SubscriptionActionType) Ptr() *SubscriptionActionType { - return &s -} - -// Determines the billing cadence of a [Subscription]($m/Subscription) -type SubscriptionCadence string - -const ( - SubscriptionCadenceDaily SubscriptionCadence = "DAILY" - SubscriptionCadenceWeekly SubscriptionCadence = "WEEKLY" - SubscriptionCadenceEveryTwoWeeks SubscriptionCadence = "EVERY_TWO_WEEKS" - SubscriptionCadenceThirtyDays SubscriptionCadence = "THIRTY_DAYS" - SubscriptionCadenceSixtyDays SubscriptionCadence = "SIXTY_DAYS" - SubscriptionCadenceNinetyDays SubscriptionCadence = "NINETY_DAYS" - SubscriptionCadenceMonthly SubscriptionCadence = "MONTHLY" - SubscriptionCadenceEveryTwoMonths SubscriptionCadence = "EVERY_TWO_MONTHS" - SubscriptionCadenceQuarterly SubscriptionCadence = "QUARTERLY" - SubscriptionCadenceEveryFourMonths SubscriptionCadence = "EVERY_FOUR_MONTHS" - SubscriptionCadenceEverySixMonths SubscriptionCadence = "EVERY_SIX_MONTHS" - SubscriptionCadenceAnnual SubscriptionCadence = "ANNUAL" - SubscriptionCadenceEveryTwoYears SubscriptionCadence = "EVERY_TWO_YEARS" -) - -func NewSubscriptionCadenceFromString(s string) (SubscriptionCadence, error) { - switch s { - case "DAILY": - return SubscriptionCadenceDaily, nil - case "WEEKLY": - return SubscriptionCadenceWeekly, nil - case "EVERY_TWO_WEEKS": - return SubscriptionCadenceEveryTwoWeeks, nil - case "THIRTY_DAYS": - return SubscriptionCadenceThirtyDays, nil - case "SIXTY_DAYS": - return SubscriptionCadenceSixtyDays, nil - case "NINETY_DAYS": - return SubscriptionCadenceNinetyDays, nil - case "MONTHLY": - return SubscriptionCadenceMonthly, nil - case "EVERY_TWO_MONTHS": - return SubscriptionCadenceEveryTwoMonths, nil - case "QUARTERLY": - return SubscriptionCadenceQuarterly, nil - case "EVERY_FOUR_MONTHS": - return SubscriptionCadenceEveryFourMonths, nil - case "EVERY_SIX_MONTHS": - return SubscriptionCadenceEverySixMonths, nil - case "ANNUAL": - return SubscriptionCadenceAnnual, nil - case "EVERY_TWO_YEARS": - return SubscriptionCadenceEveryTwoYears, nil - } - var t SubscriptionCadence - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (s SubscriptionCadence) Ptr() *SubscriptionCadence { - return &s + return fmt.Sprintf("%#v", t) } -// Describes changes to a subscription and the subscription status. -type SubscriptionEvent struct { - // The ID of the subscription event. - ID string `json:"id" url:"id"` - // Type of the subscription event. - // See [SubscriptionEventSubscriptionEventType](#type-subscriptioneventsubscriptioneventtype) for possible values - SubscriptionEventType SubscriptionEventSubscriptionEventType `json:"subscription_event_type" url:"subscription_event_type"` - // The `YYYY-MM-DD`-formatted date (for example, 2013-01-15) when the subscription event occurred. - EffectiveDate string `json:"effective_date" url:"effective_date"` - // The day-of-the-month the billing anchor date was changed to, if applicable. - MonthlyBillingAnchorDate *int `json:"monthly_billing_anchor_date,omitempty" url:"monthly_billing_anchor_date,omitempty"` - // Additional information about the subscription event. - Info *SubscriptionEventInfo `json:"info,omitempty" url:"info,omitempty"` - // A list of Phases, to pass phase-specific information used in the swap. - Phases []*Phase `json:"phases,omitempty" url:"phases,omitempty"` - // The ID of the subscription plan variation associated with the subscription. - PlanVariationID string `json:"plan_variation_id" url:"plan_variation_id"` +// Published when a [TerminalCheckout](entity:TerminalCheckout) is updated. +type TerminalCheckoutUpdatedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents, `"terminal.checkout.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // RFC 3339 timestamp of when the event was created. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *TerminalCheckoutUpdatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SubscriptionEvent) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TerminalCheckoutUpdatedEvent) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SubscriptionEvent) UnmarshalJSON(data []byte) error { - type unmarshaler SubscriptionEvent +func (t *TerminalCheckoutUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler TerminalCheckoutUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SubscriptionEvent(value) + *t = TerminalCheckoutUpdatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SubscriptionEvent) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TerminalCheckoutUpdatedEvent) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -// Provides information about the subscription event. -type SubscriptionEventInfo struct { - // A human-readable explanation for the event. - Detail *string `json:"detail,omitempty" url:"detail,omitempty"` - // An info code indicating the subscription event that occurred. - // See [InfoCode](#type-infocode) for possible values - Code *SubscriptionEventInfoCode `json:"code,omitempty" url:"code,omitempty"` +type TerminalCheckoutUpdatedEventData struct { + // Name of the updated object’s type, `"checkout"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the updated terminal checkout. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the updated terminal checkout + Object *TerminalCheckoutUpdatedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SubscriptionEventInfo) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TerminalCheckoutUpdatedEventData) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SubscriptionEventInfo) UnmarshalJSON(data []byte) error { - type unmarshaler SubscriptionEventInfo +func (t *TerminalCheckoutUpdatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler TerminalCheckoutUpdatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SubscriptionEventInfo(value) + *t = TerminalCheckoutUpdatedEventData(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SubscriptionEventInfo) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TerminalCheckoutUpdatedEventData) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) -} - -// Supported info codes of a subscription event. -type SubscriptionEventInfoCode string - -const ( - SubscriptionEventInfoCodeLocationNotActive SubscriptionEventInfoCode = "LOCATION_NOT_ACTIVE" - SubscriptionEventInfoCodeLocationCannotAcceptPayment SubscriptionEventInfoCode = "LOCATION_CANNOT_ACCEPT_PAYMENT" - SubscriptionEventInfoCodeCustomerDeleted SubscriptionEventInfoCode = "CUSTOMER_DELETED" - SubscriptionEventInfoCodeCustomerNoEmail SubscriptionEventInfoCode = "CUSTOMER_NO_EMAIL" - SubscriptionEventInfoCodeCustomerNoName SubscriptionEventInfoCode = "CUSTOMER_NO_NAME" - SubscriptionEventInfoCodeUserProvided SubscriptionEventInfoCode = "USER_PROVIDED" -) - -func NewSubscriptionEventInfoCodeFromString(s string) (SubscriptionEventInfoCode, error) { - switch s { - case "LOCATION_NOT_ACTIVE": - return SubscriptionEventInfoCodeLocationNotActive, nil - case "LOCATION_CANNOT_ACCEPT_PAYMENT": - return SubscriptionEventInfoCodeLocationCannotAcceptPayment, nil - case "CUSTOMER_DELETED": - return SubscriptionEventInfoCodeCustomerDeleted, nil - case "CUSTOMER_NO_EMAIL": - return SubscriptionEventInfoCodeCustomerNoEmail, nil - case "CUSTOMER_NO_NAME": - return SubscriptionEventInfoCodeCustomerNoName, nil - case "USER_PROVIDED": - return SubscriptionEventInfoCodeUserProvided, nil - } - var t SubscriptionEventInfoCode - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (s SubscriptionEventInfoCode) Ptr() *SubscriptionEventInfoCode { - return &s -} - -// Supported types of an event occurred to a subscription. -type SubscriptionEventSubscriptionEventType string - -const ( - SubscriptionEventSubscriptionEventTypeStartSubscription SubscriptionEventSubscriptionEventType = "START_SUBSCRIPTION" - SubscriptionEventSubscriptionEventTypePlanChange SubscriptionEventSubscriptionEventType = "PLAN_CHANGE" - SubscriptionEventSubscriptionEventTypeStopSubscription SubscriptionEventSubscriptionEventType = "STOP_SUBSCRIPTION" - SubscriptionEventSubscriptionEventTypeDeactivateSubscription SubscriptionEventSubscriptionEventType = "DEACTIVATE_SUBSCRIPTION" - SubscriptionEventSubscriptionEventTypeResumeSubscription SubscriptionEventSubscriptionEventType = "RESUME_SUBSCRIPTION" - SubscriptionEventSubscriptionEventTypePauseSubscription SubscriptionEventSubscriptionEventType = "PAUSE_SUBSCRIPTION" - SubscriptionEventSubscriptionEventTypeBillingAnchorDateChanged SubscriptionEventSubscriptionEventType = "BILLING_ANCHOR_DATE_CHANGED" -) - -func NewSubscriptionEventSubscriptionEventTypeFromString(s string) (SubscriptionEventSubscriptionEventType, error) { - switch s { - case "START_SUBSCRIPTION": - return SubscriptionEventSubscriptionEventTypeStartSubscription, nil - case "PLAN_CHANGE": - return SubscriptionEventSubscriptionEventTypePlanChange, nil - case "STOP_SUBSCRIPTION": - return SubscriptionEventSubscriptionEventTypeStopSubscription, nil - case "DEACTIVATE_SUBSCRIPTION": - return SubscriptionEventSubscriptionEventTypeDeactivateSubscription, nil - case "RESUME_SUBSCRIPTION": - return SubscriptionEventSubscriptionEventTypeResumeSubscription, nil - case "PAUSE_SUBSCRIPTION": - return SubscriptionEventSubscriptionEventTypePauseSubscription, nil - case "BILLING_ANCHOR_DATE_CHANGED": - return SubscriptionEventSubscriptionEventTypeBillingAnchorDateChanged, nil - } - var t SubscriptionEventSubscriptionEventType - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (s SubscriptionEventSubscriptionEventType) Ptr() *SubscriptionEventSubscriptionEventType { - return &s + return fmt.Sprintf("%#v", t) } -// Describes a phase in a subscription plan variation. For more information, see [Subscription Plans and Variations](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations). -type SubscriptionPhase struct { - // The Square-assigned ID of the subscription phase. This field cannot be changed after a `SubscriptionPhase` is created. - UID *string `json:"uid,omitempty" url:"uid,omitempty"` - // The billing cadence of the phase. For example, weekly or monthly. This field cannot be changed after a `SubscriptionPhase` is created. - // See [SubscriptionCadence](#type-subscriptioncadence) for possible values - Cadence SubscriptionCadence `json:"cadence" url:"cadence"` - // The number of `cadence`s the phase lasts. If not set, the phase never ends. Only the last phase can be indefinite. This field cannot be changed after a `SubscriptionPhase` is created. - Periods *int `json:"periods,omitempty" url:"periods,omitempty"` - // The amount to bill for each `cadence`. Failure to specify this field results in a `MISSING_REQUIRED_PARAMETER` error at runtime. - RecurringPriceMoney *Money `json:"recurring_price_money,omitempty" url:"recurring_price_money,omitempty"` - // The position this phase appears in the sequence of phases defined for the plan, indexed from 0. This field cannot be changed after a `SubscriptionPhase` is created. - Ordinal *int64 `json:"ordinal,omitempty" url:"ordinal,omitempty"` - // The subscription pricing. - Pricing *SubscriptionPricing `json:"pricing,omitempty" url:"pricing,omitempty"` +type TerminalCheckoutUpdatedEventObject struct { + // The updated terminal checkout + Checkout *TerminalCheckout `json:"checkout,omitempty" url:"checkout,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SubscriptionPhase) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TerminalCheckoutUpdatedEventObject) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SubscriptionPhase) UnmarshalJSON(data []byte) error { - type unmarshaler SubscriptionPhase +func (t *TerminalCheckoutUpdatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler TerminalCheckoutUpdatedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SubscriptionPhase(value) + *t = TerminalCheckoutUpdatedEventObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SubscriptionPhase) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TerminalCheckoutUpdatedEventObject) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -// Describes the pricing for the subscription. -type SubscriptionPricing struct { - // RELATIVE or STATIC - // See [SubscriptionPricingType](#type-subscriptionpricingtype) for possible values - Type *SubscriptionPricingType `json:"type,omitempty" url:"type,omitempty"` - // The ids of the discount catalog objects - DiscountIDs []string `json:"discount_ids,omitempty" url:"discount_ids,omitempty"` - // The price of the subscription, if STATIC - PriceMoney *Money `json:"price_money,omitempty" url:"price_money,omitempty"` +// Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit network) payment refunds. +type TerminalRefund struct { + // A unique ID for this `TerminalRefund`. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The reference to the payment refund created by completing this `TerminalRefund`. + RefundID *string `json:"refund_id,omitempty" url:"refund_id,omitempty"` + // The unique ID of the payment being refunded. + PaymentID string `json:"payment_id" url:"payment_id"` + // The reference to the Square order ID for the payment identified by the `payment_id`. + OrderID *string `json:"order_id,omitempty" url:"order_id,omitempty"` + // The amount of money, inclusive of `tax_money`, that the `TerminalRefund` should return. + // This value is limited to the amount taken in the original payment minus any completed or + // pending refunds. + AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` + // A description of the reason for the refund. + Reason string `json:"reason" url:"reason"` + // The unique ID of the device intended for this `TerminalRefund`. + // The Id can be retrieved from /v2/devices api. + DeviceID string `json:"device_id" url:"device_id"` + // The RFC 3339 duration, after which the refund is automatically canceled. + // A `TerminalRefund` that is `PENDING` is automatically `CANCELED` and has a cancellation reason + // of `TIMED_OUT`. + // + // Default: 5 minutes from creation. + // + // Maximum: 5 minutes + DeadlineDuration *string `json:"deadline_duration,omitempty" url:"deadline_duration,omitempty"` + // The status of the `TerminalRefund`. + // Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, or `COMPLETED`. + Status *string `json:"status,omitempty" url:"status,omitempty"` + // Present if the status is `CANCELED`. + // See [ActionCancelReason](#type-actioncancelreason) for possible values + CancelReason *ActionCancelReason `json:"cancel_reason,omitempty" url:"cancel_reason,omitempty"` + // The time when the `TerminalRefund` was created, as an RFC 3339 timestamp. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The time when the `TerminalRefund` was last updated, as an RFC 3339 timestamp. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` + // The ID of the application that created the refund. + AppID *string `json:"app_id,omitempty" url:"app_id,omitempty"` + // The location of the device where the `TerminalRefund` was directed. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SubscriptionPricing) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TerminalRefund) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SubscriptionPricing) UnmarshalJSON(data []byte) error { - type unmarshaler SubscriptionPricing +func (t *TerminalRefund) UnmarshalJSON(data []byte) error { + type unmarshaler TerminalRefund var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SubscriptionPricing(value) + *t = TerminalRefund(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SubscriptionPricing) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TerminalRefund) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) -} - -// Determines the pricing of a [Subscription]($m/Subscription) -type SubscriptionPricingType string - -const ( - SubscriptionPricingTypeStatic SubscriptionPricingType = "STATIC" - SubscriptionPricingTypeRelative SubscriptionPricingType = "RELATIVE" -) - -func NewSubscriptionPricingTypeFromString(s string) (SubscriptionPricingType, error) { - switch s { - case "STATIC": - return SubscriptionPricingTypeStatic, nil - case "RELATIVE": - return SubscriptionPricingTypeRelative, nil - } - var t SubscriptionPricingType - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (s SubscriptionPricingType) Ptr() *SubscriptionPricingType { - return &s + return fmt.Sprintf("%#v", t) } -// The origination details of the subscription. -type SubscriptionSource struct { - // The name used to identify the place (physical or digital) that - // a subscription originates. If unset, the name defaults to the name - // of the application that created the subscription. - Name *string `json:"name,omitempty" url:"name,omitempty"` +// Published when a Terminal API refund is created. +type TerminalRefundCreatedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents, `"terminal.refund.created"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // RFC 3339 timestamp of when the event was created. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Data associated with the event. + Data *TerminalRefundCreatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SubscriptionSource) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TerminalRefundCreatedEvent) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SubscriptionSource) UnmarshalJSON(data []byte) error { - type unmarshaler SubscriptionSource +func (t *TerminalRefundCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler TerminalRefundCreatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SubscriptionSource(value) + *t = TerminalRefundCreatedEvent(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SubscriptionSource) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TerminalRefundCreatedEvent) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -// Supported subscription statuses. -type SubscriptionStatus string - -const ( - SubscriptionStatusPending SubscriptionStatus = "PENDING" - SubscriptionStatusActive SubscriptionStatus = "ACTIVE" - SubscriptionStatusCanceled SubscriptionStatus = "CANCELED" - SubscriptionStatusDeactivated SubscriptionStatus = "DEACTIVATED" - SubscriptionStatusPaused SubscriptionStatus = "PAUSED" -) +type TerminalRefundCreatedEventData struct { + // Name of the created object’s type, `"refund"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the created terminal refund. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the created terminal refund. + Object *TerminalRefundCreatedEventObject `json:"object,omitempty" url:"object,omitempty"` -func NewSubscriptionStatusFromString(s string) (SubscriptionStatus, error) { - switch s { - case "PENDING": - return SubscriptionStatusPending, nil - case "ACTIVE": - return SubscriptionStatusActive, nil - case "CANCELED": - return SubscriptionStatusCanceled, nil - case "DEACTIVATED": - return SubscriptionStatusDeactivated, nil - case "PAUSED": - return SubscriptionStatusPaused, nil - } - var t SubscriptionStatus - return "", fmt.Errorf("%s is not a valid %T", s, t) + extraProperties map[string]interface{} + _rawJSON json.RawMessage } -func (s SubscriptionStatus) Ptr() *SubscriptionStatus { - return &s +func (t *TerminalRefundCreatedEventData) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -// Represents the details of a webhook subscription, including notification URL, -// event types, and signature key. -type SubscriptionTestResult struct { - // A Square-generated unique ID for the subscription test result. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The status code returned by the subscription notification URL. - StatusCode *int `json:"status_code,omitempty" url:"status_code,omitempty"` - // An object containing the payload of the test event. For example, a `payment.created` event. - Payload *string `json:"payload,omitempty" url:"payload,omitempty"` - // The timestamp of when the subscription was created, in RFC 3339 format. - // For example, "2016-09-04T23:59:33.123Z". - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The timestamp of when the subscription was updated, in RFC 3339 format. For example, "2016-09-04T23:59:33.123Z". - // Because a subscription test result is unique, this field is the same as the `created_at` field. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` +func (t *TerminalRefundCreatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler TerminalRefundCreatedEventData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TerminalRefundCreatedEventData(value) + + extraProperties, err := core.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + + t._rawJSON = json.RawMessage(data) + return nil +} + +func (t *TerminalRefundCreatedEventData) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +type TerminalRefundCreatedEventObject struct { + // The created terminal refund. + Refund *TerminalRefund `json:"refund,omitempty" url:"refund,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SubscriptionTestResult) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TerminalRefundCreatedEventObject) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SubscriptionTestResult) UnmarshalJSON(data []byte) error { - type unmarshaler SubscriptionTestResult +func (t *TerminalRefundCreatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler TerminalRefundCreatedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SubscriptionTestResult(value) + *t = TerminalRefundCreatedEventObject(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SubscriptionTestResult) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TerminalRefundCreatedEventObject) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", t) } -// Defines output parameters in a response of the -// [SwapPlan]($e/Subscriptions/SwapPlan) endpoint. -type SwapPlanResponse struct { - // Errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The subscription with the updated subscription plan. - Subscription *Subscription `json:"subscription,omitempty" url:"subscription,omitempty"` - // A list of a `SWAP_PLAN` action created by the request. - Actions []*SubscriptionAction `json:"actions,omitempty" url:"actions,omitempty"` +type TerminalRefundQuery struct { + // The filter for the Terminal refund query. + Filter *TerminalRefundQueryFilter `json:"filter,omitempty" url:"filter,omitempty"` + // The sort order for the Terminal refund query. + Sort *TerminalRefundQuerySort `json:"sort,omitempty" url:"sort,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (s *SwapPlanResponse) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (t *TerminalRefundQuery) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (s *SwapPlanResponse) UnmarshalJSON(data []byte) error { - type unmarshaler SwapPlanResponse +func (t *TerminalRefundQuery) UnmarshalJSON(data []byte) error { + type unmarshaler TerminalRefundQuery var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SwapPlanResponse(value) + *t = TerminalRefundQuery(value) - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { return err } - s.extraProperties = extraProperties + t.extraProperties = extraProperties - s._rawJSON = json.RawMessage(data) + t._rawJSON = json.RawMessage(data) return nil } -func (s *SwapPlanResponse) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (t *TerminalRefundQuery) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := core.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", s) -} - -// When to calculate the taxes due on a cart. -type TaxCalculationPhase string - -const ( - TaxCalculationPhaseTaxSubtotalPhase TaxCalculationPhase = "TAX_SUBTOTAL_PHASE" - TaxCalculationPhaseTaxTotalPhase TaxCalculationPhase = "TAX_TOTAL_PHASE" -) - -func NewTaxCalculationPhaseFromString(s string) (TaxCalculationPhase, error) { - switch s { - case "TAX_SUBTOTAL_PHASE": - return TaxCalculationPhaseTaxSubtotalPhase, nil - case "TAX_TOTAL_PHASE": - return TaxCalculationPhaseTaxTotalPhase, nil - } - var t TaxCalculationPhase - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (t TaxCalculationPhase) Ptr() *TaxCalculationPhase { - return &t + return fmt.Sprintf("%#v", t) } -// Identifiers for the location used by various governments for tax purposes. -type TaxIDs struct { - // The EU VAT number for this location. For example, `IE3426675K`. - // If the EU VAT number is present, it is well-formed and has been - // validated with VIES, the VAT Information Exchange System. - EuVat *string `json:"eu_vat,omitempty" url:"eu_vat,omitempty"` - // The SIRET (Système d'Identification du Répertoire des Entreprises et de leurs Etablissements) - // number is a 14-digit code issued by the French INSEE. For example, `39922799000021`. - FrSiret *string `json:"fr_siret,omitempty" url:"fr_siret,omitempty"` - // The French government uses the NAF (Nomenclature des Activités Françaises) to display and - // track economic statistical data. This is also called the APE (Activite Principale de l’Entreprise) code. - // For example, `6910Z`. - FrNaf *string `json:"fr_naf,omitempty" url:"fr_naf,omitempty"` - // The NIF (Numero de Identificacion Fiscal) number is a nine-character tax identifier used in Spain. - // If it is present, it has been validated. For example, `73628495A`. - EsNif *string `json:"es_nif,omitempty" url:"es_nif,omitempty"` - // The QII (Qualified Invoice Issuer) number is a 14-character tax identifier used in Japan. - // For example, `T1234567890123`. - JpQii *string `json:"jp_qii,omitempty" url:"jp_qii,omitempty"` +type TerminalRefundQueryFilter struct { + // `TerminalRefund` objects associated with a specific device. If no device is specified, then all + // `TerminalRefund` objects for the signed-in account are displayed. + DeviceID *string `json:"device_id,omitempty" url:"device_id,omitempty"` + // The timestamp for the beginning of the reporting period, in RFC 3339 format. Inclusive. + // Default value: The current time minus one day. + // Note that `TerminalRefund`s are available for 30 days after creation. + CreatedAt *TimeRange `json:"created_at,omitempty" url:"created_at,omitempty"` + // Filtered results with the desired status of the `TerminalRefund`. + // Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, or `COMPLETED`. + Status *string `json:"status,omitempty" url:"status,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (t *TaxIDs) GetExtraProperties() map[string]interface{} { +func (t *TerminalRefundQueryFilter) GetExtraProperties() map[string]interface{} { return t.extraProperties } -func (t *TaxIDs) UnmarshalJSON(data []byte) error { - type unmarshaler TaxIDs +func (t *TerminalRefundQueryFilter) UnmarshalJSON(data []byte) error { + type unmarshaler TerminalRefundQueryFilter var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TaxIDs(value) + *t = TerminalRefundQueryFilter(value) extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { @@ -50877,7 +67737,7 @@ func (t *TaxIDs) UnmarshalJSON(data []byte) error { return nil } -func (t *TaxIDs) String() string { +func (t *TerminalRefundQueryFilter) String() string { if len(t._rawJSON) > 0 { if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value @@ -50889,74 +67749,79 @@ func (t *TaxIDs) String() string { return fmt.Sprintf("%#v", t) } -// Whether to the tax amount should be additional to or included in the CatalogItem price. -type TaxInclusionType string +type TerminalRefundQuerySort struct { + // The order in which results are listed. + // + // - `ASC` - Oldest to newest. + // - `DESC` - Newest to oldest (default). + SortOrder *string `json:"sort_order,omitempty" url:"sort_order,omitempty"` -const ( - TaxInclusionTypeAdditive TaxInclusionType = "ADDITIVE" - TaxInclusionTypeInclusive TaxInclusionType = "INCLUSIVE" -) + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} -func NewTaxInclusionTypeFromString(s string) (TaxInclusionType, error) { - switch s { - case "ADDITIVE": - return TaxInclusionTypeAdditive, nil - case "INCLUSIVE": - return TaxInclusionTypeInclusive, nil +func (t *TerminalRefundQuerySort) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TerminalRefundQuerySort) UnmarshalJSON(data []byte) error { + type unmarshaler TerminalRefundQuerySort + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - var t TaxInclusionType - return "", fmt.Errorf("%s is not a valid %T", s, t) + *t = TerminalRefundQuerySort(value) + + extraProperties, err := core.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + + t._rawJSON = json.RawMessage(data) + return nil } -func (t TaxInclusionType) Ptr() *TaxInclusionType { - return &t +func (t *TerminalRefundQuerySort) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) } -// A record representing an individual team member for a business. -type TeamMember struct { - // The unique ID for the team member. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // A second ID used to associate the team member with an entity in another system. - ReferenceID *string `json:"reference_id,omitempty" url:"reference_id,omitempty"` - // Whether the team member is the owner of the Square account. - IsOwner *bool `json:"is_owner,omitempty" url:"is_owner,omitempty"` - // Describes the status of the team member. - // See [TeamMemberStatus](#type-teammemberstatus) for possible values - Status *TeamMemberStatus `json:"status,omitempty" url:"status,omitempty"` - // The given name (that is, the first name) associated with the team member. - GivenName *string `json:"given_name,omitempty" url:"given_name,omitempty"` - // The family name (that is, the last name) associated with the team member. - FamilyName *string `json:"family_name,omitempty" url:"family_name,omitempty"` - // The email address associated with the team member. - EmailAddress *string `json:"email_address,omitempty" url:"email_address,omitempty"` - // The team member's phone number, in E.164 format. For example: - // +14155552671 - the country code is 1 for US - // +551155256325 - the country code is 55 for BR - PhoneNumber *string `json:"phone_number,omitempty" url:"phone_number,omitempty"` - // The timestamp, in RFC 3339 format, describing when the team member was created. - // For example, "2018-10-04T04:00:00-07:00" or "2019-02-05T12:00:00Z". +// Published when a Terminal API refund is updated. +type TerminalRefundUpdatedEvent struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The type of event this represents, `"terminal.refund.updated"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for the event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // RFC 3339 timestamp of when the event was created. CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The timestamp, in RFC 3339 format, describing when the team member was last updated. - // For example, "2018-10-04T04:00:00-07:00" or "2019-02-05T12:00:00Z". - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` - // Describes the team member's assigned locations. - AssignedLocations *TeamMemberAssignedLocations `json:"assigned_locations,omitempty" url:"assigned_locations,omitempty"` + // Data associated with the event. + Data *TerminalRefundUpdatedEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (t *TeamMember) GetExtraProperties() map[string]interface{} { +func (t *TerminalRefundUpdatedEvent) GetExtraProperties() map[string]interface{} { return t.extraProperties } -func (t *TeamMember) UnmarshalJSON(data []byte) error { - type unmarshaler TeamMember +func (t *TerminalRefundUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler TerminalRefundUpdatedEvent var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TeamMember(value) + *t = TerminalRefundUpdatedEvent(value) extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { @@ -50968,7 +67833,7 @@ func (t *TeamMember) UnmarshalJSON(data []byte) error { return nil } -func (t *TeamMember) String() string { +func (t *TerminalRefundUpdatedEvent) String() string { if len(t._rawJSON) > 0 { if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value @@ -50980,29 +67845,29 @@ func (t *TeamMember) String() string { return fmt.Sprintf("%#v", t) } -// An object that represents a team member's assignment to locations. -type TeamMemberAssignedLocations struct { - // The current assignment type of the team member. - // See [TeamMemberAssignedLocationsAssignmentType](#type-teammemberassignedlocationsassignmenttype) for possible values - AssignmentType *TeamMemberAssignedLocationsAssignmentType `json:"assignment_type,omitempty" url:"assignment_type,omitempty"` - // The explicit locations that the team member is assigned to. - LocationIDs []string `json:"location_ids,omitempty" url:"location_ids,omitempty"` +type TerminalRefundUpdatedEventData struct { + // Name of the updated object’s type, `"refund"`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // ID of the updated terminal refund. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the updated terminal refund. + Object *TerminalRefundUpdatedEventObject `json:"object,omitempty" url:"object,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (t *TeamMemberAssignedLocations) GetExtraProperties() map[string]interface{} { +func (t *TerminalRefundUpdatedEventData) GetExtraProperties() map[string]interface{} { return t.extraProperties } -func (t *TeamMemberAssignedLocations) UnmarshalJSON(data []byte) error { - type unmarshaler TeamMemberAssignedLocations +func (t *TerminalRefundUpdatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler TerminalRefundUpdatedEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TeamMemberAssignedLocations(value) + *t = TerminalRefundUpdatedEventData(value) extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { @@ -51014,7 +67879,7 @@ func (t *TeamMemberAssignedLocations) UnmarshalJSON(data []byte) error { return nil } -func (t *TeamMemberAssignedLocations) String() string { +func (t *TerminalRefundUpdatedEventData) String() string { if len(t._rawJSON) > 0 { if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value @@ -51026,57 +67891,25 @@ func (t *TeamMemberAssignedLocations) String() string { return fmt.Sprintf("%#v", t) } -// Enumerates the possible assignment types that the team member can have. -type TeamMemberAssignedLocationsAssignmentType string - -const ( - TeamMemberAssignedLocationsAssignmentTypeAllCurrentAndFutureLocations TeamMemberAssignedLocationsAssignmentType = "ALL_CURRENT_AND_FUTURE_LOCATIONS" - TeamMemberAssignedLocationsAssignmentTypeExplicitLocations TeamMemberAssignedLocationsAssignmentType = "EXPLICIT_LOCATIONS" -) - -func NewTeamMemberAssignedLocationsAssignmentTypeFromString(s string) (TeamMemberAssignedLocationsAssignmentType, error) { - switch s { - case "ALL_CURRENT_AND_FUTURE_LOCATIONS": - return TeamMemberAssignedLocationsAssignmentTypeAllCurrentAndFutureLocations, nil - case "EXPLICIT_LOCATIONS": - return TeamMemberAssignedLocationsAssignmentTypeExplicitLocations, nil - } - var t TeamMemberAssignedLocationsAssignmentType - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (t TeamMemberAssignedLocationsAssignmentType) Ptr() *TeamMemberAssignedLocationsAssignmentType { - return &t -} - -// The booking profile of a seller's team member, including the team member's ID, display name, description and whether the team member can be booked as a service provider. -type TeamMemberBookingProfile struct { - // The ID of the [TeamMember](entity:TeamMember) object for the team member associated with the booking profile. - TeamMemberID *string `json:"team_member_id,omitempty" url:"team_member_id,omitempty"` - // The description of the team member. - Description *string `json:"description,omitempty" url:"description,omitempty"` - // The display name of the team member. - DisplayName *string `json:"display_name,omitempty" url:"display_name,omitempty"` - // Indicates whether the team member can be booked through the Bookings API or the seller's online booking channel or site (`true`) or not (`false`). - IsBookable *bool `json:"is_bookable,omitempty" url:"is_bookable,omitempty"` - // The URL of the team member's image for the bookings profile. - ProfileImageURL *string `json:"profile_image_url,omitempty" url:"profile_image_url,omitempty"` +type TerminalRefundUpdatedEventObject struct { + // The updated terminal refund. + Refund *TerminalRefund `json:"refund,omitempty" url:"refund,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (t *TeamMemberBookingProfile) GetExtraProperties() map[string]interface{} { +func (t *TerminalRefundUpdatedEventObject) GetExtraProperties() map[string]interface{} { return t.extraProperties } -func (t *TeamMemberBookingProfile) UnmarshalJSON(data []byte) error { - type unmarshaler TeamMemberBookingProfile +func (t *TerminalRefundUpdatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler TerminalRefundUpdatedEventObject var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TeamMemberBookingProfile(value) + *t = TerminalRefundUpdatedEventObject(value) extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { @@ -51088,7 +67921,7 @@ func (t *TeamMemberBookingProfile) UnmarshalJSON(data []byte) error { return nil } -func (t *TeamMemberBookingProfile) String() string { +func (t *TerminalRefundUpdatedEventObject) String() string { if len(t._rawJSON) > 0 { if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value @@ -51100,88 +67933,83 @@ func (t *TeamMemberBookingProfile) String() string { return fmt.Sprintf("%#v", t) } -// Enumerates the possible invitation statuses the team member can have within a business. -type TeamMemberInvitationStatus string - -const ( - TeamMemberInvitationStatusUninvited TeamMemberInvitationStatus = "UNINVITED" - TeamMemberInvitationStatusPending TeamMemberInvitationStatus = "PENDING" - TeamMemberInvitationStatusAccepted TeamMemberInvitationStatus = "ACCEPTED" -) +// Defines the fields that are included in the response body of +// a request to the [TestWebhookSubscription](api-endpoint:WebhookSubscriptions-TestWebhookSubscription) endpoint. +// +// Note: If there are errors processing the request, the [SubscriptionTestResult](entity:SubscriptionTestResult) field is not +// present. +type TestWebhookSubscriptionResponse struct { + // Information on errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The [SubscriptionTestResult](entity:SubscriptionTestResult). + SubscriptionTestResult *SubscriptionTestResult `json:"subscription_test_result,omitempty" url:"subscription_test_result,omitempty"` -func NewTeamMemberInvitationStatusFromString(s string) (TeamMemberInvitationStatus, error) { - switch s { - case "UNINVITED": - return TeamMemberInvitationStatusUninvited, nil - case "PENDING": - return TeamMemberInvitationStatusPending, nil - case "ACCEPTED": - return TeamMemberInvitationStatusAccepted, nil - } - var t TeamMemberInvitationStatus - return "", fmt.Errorf("%s is not a valid %T", s, t) + extraProperties map[string]interface{} + _rawJSON json.RawMessage } -func (t TeamMemberInvitationStatus) Ptr() *TeamMemberInvitationStatus { - return &t +func (t *TestWebhookSubscriptionResponse) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -// Enumerates the possible statuses the team member can have within a business. -type TeamMemberStatus string - -const ( - TeamMemberStatusActive TeamMemberStatus = "ACTIVE" - TeamMemberStatusInactive TeamMemberStatus = "INACTIVE" -) +func (t *TestWebhookSubscriptionResponse) UnmarshalJSON(data []byte) error { + type unmarshaler TestWebhookSubscriptionResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TestWebhookSubscriptionResponse(value) -func NewTeamMemberStatusFromString(s string) (TeamMemberStatus, error) { - switch s { - case "ACTIVE": - return TeamMemberStatusActive, nil - case "INACTIVE": - return TeamMemberStatusInactive, nil + extraProperties, err := core.ExtractExtraProperties(data, *t) + if err != nil { + return err } - var t TeamMemberStatus - return "", fmt.Errorf("%s is not a valid %T", s, t) + t.extraProperties = extraProperties + + t._rawJSON = json.RawMessage(data) + return nil } -func (t TeamMemberStatus) Ptr() *TeamMemberStatus { - return &t +func (t *TestWebhookSubscriptionResponse) String() string { + if len(t._rawJSON) > 0 { + if value, err := core.StringifyJSON(t._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) } -// The hourly wage rate that a team member earns on a `Shift` for doing the job -// specified by the `title` property of this object. -type TeamMemberWage struct { - // The UUID for this object. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The `TeamMember` that this wage is assigned to. - TeamMemberID *string `json:"team_member_id,omitempty" url:"team_member_id,omitempty"` - // The job title that this wage relates to. - Title *string `json:"title,omitempty" url:"title,omitempty"` - // Can be a custom-set hourly wage or the calculated effective hourly - // wage based on the annual wage and hours worked per week. - HourlyRate *Money `json:"hourly_rate,omitempty" url:"hourly_rate,omitempty"` - // An identifier for the job that this wage relates to. This cannot be - // used to retrieve the job. - JobID *string `json:"job_id,omitempty" url:"job_id,omitempty"` - // Whether team members are eligible for tips when working this job. - TipEligible *bool `json:"tip_eligible,omitempty" url:"tip_eligible,omitempty"` +// Represents a generic time range. The start and end values are +// represented in RFC 3339 format. Time ranges are customized to be +// inclusive or exclusive based on the needs of a particular endpoint. +// Refer to the relevant endpoint-specific documentation to determine +// how time ranges are handled. +type TimeRange struct { + // A datetime value in RFC 3339 format indicating when the time range + // starts. + StartAt *string `json:"start_at,omitempty" url:"start_at,omitempty"` + // A datetime value in RFC 3339 format indicating when the time range + // ends. + EndAt *string `json:"end_at,omitempty" url:"end_at,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (t *TeamMemberWage) GetExtraProperties() map[string]interface{} { +func (t *TimeRange) GetExtraProperties() map[string]interface{} { return t.extraProperties } -func (t *TeamMemberWage) UnmarshalJSON(data []byte) error { - type unmarshaler TeamMemberWage +func (t *TimeRange) UnmarshalJSON(data []byte) error { + type unmarshaler TimeRange var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TeamMemberWage(value) + *t = TimeRange(value) extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { @@ -51193,7 +68021,7 @@ func (t *TeamMemberWage) UnmarshalJSON(data []byte) error { return nil } -func (t *TeamMemberWage) String() string { +func (t *TimeRange) String() string { if len(t._rawJSON) > 0 { if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value @@ -51205,77 +68033,45 @@ func (t *TeamMemberWage) String() string { return fmt.Sprintf("%#v", t) } -// Represents a tender (i.e., a method of payment) used in a Square transaction. -type Tender struct { - // The tender's unique ID. It is the associated payment ID. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The ID of the transaction's associated location. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` - // The ID of the tender's associated transaction. - TransactionID *string `json:"transaction_id,omitempty" url:"transaction_id,omitempty"` - // The timestamp for when the tender was created, in RFC 3339 format. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // An optional note associated with the tender at the time of payment. - Note *string `json:"note,omitempty" url:"note,omitempty"` - // The total amount of the tender, including `tip_money`. If the tender has a `payment_id`, - // the `total_money` of the corresponding [Payment](entity:Payment) will be equal to the - // `amount_money` of the tender. - AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` - // The tip's amount of the tender. - TipMoney *Money `json:"tip_money,omitempty" url:"tip_money,omitempty"` - // The amount of any Square processing fees applied to the tender. - // - // This field is not immediately populated when a new transaction is created. - // It is usually available after about ten seconds. - ProcessingFeeMoney *Money `json:"processing_fee_money,omitempty" url:"processing_fee_money,omitempty"` - // If the tender is associated with a customer or represents a customer's card on file, - // this is the ID of the associated customer. - CustomerID *string `json:"customer_id,omitempty" url:"customer_id,omitempty"` - // The type of tender, such as `CARD` or `CASH`. - // See [TenderType](#type-tendertype) for possible values - Type TenderType `json:"type" url:"type"` - // The details of the card tender. - // - // This value is present only if the value of `type` is `CARD`. - CardDetails *TenderCardDetails `json:"card_details,omitempty" url:"card_details,omitempty"` - // The details of the cash tender. +type TipSettings struct { + // Indicates whether tipping is enabled for this checkout. Defaults to false. + AllowTipping *bool `json:"allow_tipping,omitempty" url:"allow_tipping,omitempty"` + // Indicates whether tip options should be presented on the screen before presenting + // the signature screen during card payment. Defaults to false. + SeparateTipScreen *bool `json:"separate_tip_screen,omitempty" url:"separate_tip_screen,omitempty"` + // Indicates whether custom tip amounts are allowed during the checkout flow. Defaults to false. + CustomTipField *bool `json:"custom_tip_field,omitempty" url:"custom_tip_field,omitempty"` + // A list of tip percentages that should be presented during the checkout flow, specified as + // up to 3 non-negative integers from 0 to 100 (inclusive). Defaults to 15, 20, and 25. + TipPercentages []int `json:"tip_percentages,omitempty" url:"tip_percentages,omitempty"` + // Enables the "Smart Tip Amounts" behavior. + // Exact tipping options depend on the region in which the Square seller is active. // - // This value is present only if the value of `type` is `CASH`. - CashDetails *TenderCashDetails `json:"cash_details,omitempty" url:"cash_details,omitempty"` - // The details of the bank account tender. + // For payments under 10.00, in the Australia, Canada, Ireland, United Kingdom, and United States, tipping options are presented as no tip, .50, 1.00 or 2.00. // - // This value is present only if the value of `type` is `BANK_ACCOUNT`. - BankAccountDetails *TenderBankAccountDetails `json:"bank_account_details,omitempty" url:"bank_account_details,omitempty"` - // The details of a Buy Now Pay Later tender. + // For payment amounts of 10.00 or greater, tipping options are presented as the following percentages: 0%, 5%, 10%, 15%. // - // This value is present only if the value of `type` is `BUY_NOW_PAY_LATER`. - BuyNowPayLaterDetails *TenderBuyNowPayLaterDetails `json:"buy_now_pay_later_details,omitempty" url:"buy_now_pay_later_details,omitempty"` - // The details of a Square Account tender. + // If set to true, the `tip_percentages` settings is ignored. + // Defaults to false. // - // This value is present only if the value of `type` is `SQUARE_ACCOUNT`. - SquareAccountDetails *TenderSquareAccountDetails `json:"square_account_details,omitempty" url:"square_account_details,omitempty"` - // Additional recipients (other than the merchant) receiving a portion of this tender. - // For example, fees assessed on the purchase by a third party integration. - AdditionalRecipients []*AdditionalRecipient `json:"additional_recipients,omitempty" url:"additional_recipients,omitempty"` - // The ID of the [Payment](entity:Payment) that corresponds to this tender. - // This value is only present for payments created with the v2 Payments API. - PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` + // To learn more about smart tipping, see [Accept Tips with the Square App](https://squareup.com/help/us/en/article/5069-accept-tips-with-the-square-app). + SmartTipping *bool `json:"smart_tipping,omitempty" url:"smart_tipping,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (t *Tender) GetExtraProperties() map[string]interface{} { +func (t *TipSettings) GetExtraProperties() map[string]interface{} { return t.extraProperties } -func (t *Tender) UnmarshalJSON(data []byte) error { - type unmarshaler Tender +func (t *TipSettings) UnmarshalJSON(data []byte) error { + type unmarshaler TipSettings var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = Tender(value) + *t = TipSettings(value) extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { @@ -51287,7 +68083,7 @@ func (t *Tender) UnmarshalJSON(data []byte) error { return nil } -func (t *Tender) String() string { +func (t *TipSettings) String() string { if len(t._rawJSON) > 0 { if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value @@ -51299,32 +68095,60 @@ func (t *Tender) String() string { return fmt.Sprintf("%#v", t) } -// Represents the details of a tender with `type` `BANK_ACCOUNT`. +// Represents a transaction processed with Square, either with the +// Connect API or with Square Point of Sale. // -// See [BankAccountPaymentDetails]($m/BankAccountPaymentDetails) -// for more exposed details of a bank account payment. -type TenderBankAccountDetails struct { - // The bank account payment's current state. +// The `tenders` field of this object lists all methods of payment used to pay in +// the transaction. +type Transaction struct { + // The transaction's unique ID, issued by Square payments servers. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The ID of the transaction's associated location. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The timestamp for when the transaction was created, in RFC 3339 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The tenders used to pay in the transaction. + Tenders []*Tender `json:"tenders,omitempty" url:"tenders,omitempty"` + // Refunds that have been applied to any tender in the transaction. + Refunds []*Refund `json:"refunds,omitempty" url:"refunds,omitempty"` + // If the transaction was created with the [Charge](api-endpoint:Transactions-Charge) + // endpoint, this value is the same as the value provided for the `reference_id` + // parameter in the request to that endpoint. Otherwise, it is not set. + ReferenceID *string `json:"reference_id,omitempty" url:"reference_id,omitempty"` + // The Square product that processed the transaction. + // See [TransactionProduct](#type-transactionproduct) for possible values + Product *TransactionProduct `json:"product,omitempty" url:"product,omitempty"` + // If the transaction was created in the Square Point of Sale app, this value + // is the ID generated for the transaction by Square Point of Sale. // - // See [TenderBankAccountPaymentDetailsStatus](entity:TenderBankAccountDetailsStatus) for possible values. - // See [TenderBankAccountDetailsStatus](#type-tenderbankaccountdetailsstatus) for possible values - Status *TenderBankAccountDetailsStatus `json:"status,omitempty" url:"status,omitempty"` + // This ID has no relationship to the transaction's canonical `id`, which is + // generated by Square's backend servers. This value is generated for bookkeeping + // purposes, in case the transaction cannot immediately be completed (for example, + // if the transaction is processed in offline mode). + // + // It is not currently possible with the Connect API to perform a transaction + // lookup by this value. + ClientID *string `json:"client_id,omitempty" url:"client_id,omitempty"` + // The shipping address provided in the request, if any. + ShippingAddress *Address `json:"shipping_address,omitempty" url:"shipping_address,omitempty"` + // The order_id is an identifier for the order associated with this transaction, if any. + OrderID *string `json:"order_id,omitempty" url:"order_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (t *TenderBankAccountDetails) GetExtraProperties() map[string]interface{} { +func (t *Transaction) GetExtraProperties() map[string]interface{} { return t.extraProperties } -func (t *TenderBankAccountDetails) UnmarshalJSON(data []byte) error { - type unmarshaler TenderBankAccountDetails +func (t *Transaction) UnmarshalJSON(data []byte) error { + type unmarshaler Transaction var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TenderBankAccountDetails(value) + *t = Transaction(value) extraProperties, err := core.ExtractExtraProperties(data, *t) if err != nil { @@ -51336,7 +68160,7 @@ func (t *TenderBankAccountDetails) UnmarshalJSON(data []byte) error { return nil } -func (t *TenderBankAccountDetails) String() string { +func (t *Transaction) String() string { if len(t._rawJSON) > 0 { if value, err := core.StringifyJSON(t._rawJSON); err == nil { return value @@ -51348,1492 +68172,1184 @@ func (t *TenderBankAccountDetails) String() string { return fmt.Sprintf("%#v", t) } -// Indicates the bank account payment's current status. -type TenderBankAccountDetailsStatus string +// Indicates the Square product used to process a transaction. +type TransactionProduct string const ( - TenderBankAccountDetailsStatusPending TenderBankAccountDetailsStatus = "PENDING" - TenderBankAccountDetailsStatusCompleted TenderBankAccountDetailsStatus = "COMPLETED" - TenderBankAccountDetailsStatusFailed TenderBankAccountDetailsStatus = "FAILED" + TransactionProductRegister TransactionProduct = "REGISTER" + TransactionProductExternalAPI TransactionProduct = "EXTERNAL_API" + TransactionProductBilling TransactionProduct = "BILLING" + TransactionProductAppointments TransactionProduct = "APPOINTMENTS" + TransactionProductInvoices TransactionProduct = "INVOICES" + TransactionProductOnlineStore TransactionProduct = "ONLINE_STORE" + TransactionProductPayroll TransactionProduct = "PAYROLL" + TransactionProductOther TransactionProduct = "OTHER" ) -func NewTenderBankAccountDetailsStatusFromString(s string) (TenderBankAccountDetailsStatus, error) { +func NewTransactionProductFromString(s string) (TransactionProduct, error) { switch s { - case "PENDING": - return TenderBankAccountDetailsStatusPending, nil - case "COMPLETED": - return TenderBankAccountDetailsStatusCompleted, nil - case "FAILED": - return TenderBankAccountDetailsStatusFailed, nil + case "REGISTER": + return TransactionProductRegister, nil + case "EXTERNAL_API": + return TransactionProductExternalAPI, nil + case "BILLING": + return TransactionProductBilling, nil + case "APPOINTMENTS": + return TransactionProductAppointments, nil + case "INVOICES": + return TransactionProductInvoices, nil + case "ONLINE_STORE": + return TransactionProductOnlineStore, nil + case "PAYROLL": + return TransactionProductPayroll, nil + case "OTHER": + return TransactionProductOther, nil } - var t TenderBankAccountDetailsStatus + var t TransactionProduct return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (t TenderBankAccountDetailsStatus) Ptr() *TenderBankAccountDetailsStatus { +func (t TransactionProduct) Ptr() *TransactionProduct { return &t } -// Represents the details of a tender with `type` `BUY_NOW_PAY_LATER`. -type TenderBuyNowPayLaterDetails struct { - // The Buy Now Pay Later brand. - // See [Brand](#type-brand) for possible values - BuyNowPayLaterBrand *TenderBuyNowPayLaterDetailsBrand `json:"buy_now_pay_later_brand,omitempty" url:"buy_now_pay_later_brand,omitempty"` - // The buy now pay later payment's current state (such as `AUTHORIZED` or - // `CAPTURED`). See [TenderBuyNowPayLaterDetailsStatus](entity:TenderBuyNowPayLaterDetailsStatus) - // for possible values. - // See [Status](#type-status) for possible values - Status *TenderBuyNowPayLaterDetailsStatus `json:"status,omitempty" url:"status,omitempty"` +// The transaction type used in the disputed payment. +type TransactionType string + +const ( + TransactionTypeDebit TransactionType = "DEBIT" + TransactionTypeCredit TransactionType = "CREDIT" +) + +func NewTransactionTypeFromString(s string) (TransactionType, error) { + switch s { + case "DEBIT": + return TransactionTypeDebit, nil + case "CREDIT": + return TransactionTypeCredit, nil + } + var t TransactionType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (t TransactionType) Ptr() *TransactionType { + return &t +} + +// A response that contains the unlinked `GiftCard` object. If the request resulted in errors, +// the response contains a set of `Error` objects. +type UnlinkCustomerFromGiftCardResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The gift card with the ID of the unlinked customer removed from the `customer_ids` field. + // If no other customers are linked, the `customer_ids` field is also removed. + GiftCard *GiftCard `json:"gift_card,omitempty" url:"gift_card,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (t *TenderBuyNowPayLaterDetails) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func (u *UnlinkCustomerFromGiftCardResponse) GetExtraProperties() map[string]interface{} { + return u.extraProperties } -func (t *TenderBuyNowPayLaterDetails) UnmarshalJSON(data []byte) error { - type unmarshaler TenderBuyNowPayLaterDetails +func (u *UnlinkCustomerFromGiftCardResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UnlinkCustomerFromGiftCardResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TenderBuyNowPayLaterDetails(value) + *u = UnlinkCustomerFromGiftCardResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *t) + extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { return err } - t.extraProperties = extraProperties + u.extraProperties = extraProperties - t._rawJSON = json.RawMessage(data) + u._rawJSON = json.RawMessage(data) return nil } -func (t *TenderBuyNowPayLaterDetails) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { +func (u *UnlinkCustomerFromGiftCardResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(t); err == nil { + if value, err := core.StringifyJSON(u); err == nil { return value } - return fmt.Sprintf("%#v", t) -} - -type TenderBuyNowPayLaterDetailsBrand string - -const ( - TenderBuyNowPayLaterDetailsBrandOtherBrand TenderBuyNowPayLaterDetailsBrand = "OTHER_BRAND" - TenderBuyNowPayLaterDetailsBrandAfterpay TenderBuyNowPayLaterDetailsBrand = "AFTERPAY" -) - -func NewTenderBuyNowPayLaterDetailsBrandFromString(s string) (TenderBuyNowPayLaterDetailsBrand, error) { - switch s { - case "OTHER_BRAND": - return TenderBuyNowPayLaterDetailsBrandOtherBrand, nil - case "AFTERPAY": - return TenderBuyNowPayLaterDetailsBrandAfterpay, nil - } - var t TenderBuyNowPayLaterDetailsBrand - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (t TenderBuyNowPayLaterDetailsBrand) Ptr() *TenderBuyNowPayLaterDetailsBrand { - return &t -} - -type TenderBuyNowPayLaterDetailsStatus string - -const ( - TenderBuyNowPayLaterDetailsStatusAuthorized TenderBuyNowPayLaterDetailsStatus = "AUTHORIZED" - TenderBuyNowPayLaterDetailsStatusCaptured TenderBuyNowPayLaterDetailsStatus = "CAPTURED" - TenderBuyNowPayLaterDetailsStatusVoided TenderBuyNowPayLaterDetailsStatus = "VOIDED" - TenderBuyNowPayLaterDetailsStatusFailed TenderBuyNowPayLaterDetailsStatus = "FAILED" -) - -func NewTenderBuyNowPayLaterDetailsStatusFromString(s string) (TenderBuyNowPayLaterDetailsStatus, error) { - switch s { - case "AUTHORIZED": - return TenderBuyNowPayLaterDetailsStatusAuthorized, nil - case "CAPTURED": - return TenderBuyNowPayLaterDetailsStatusCaptured, nil - case "VOIDED": - return TenderBuyNowPayLaterDetailsStatusVoided, nil - case "FAILED": - return TenderBuyNowPayLaterDetailsStatusFailed, nil - } - var t TenderBuyNowPayLaterDetailsStatus - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (t TenderBuyNowPayLaterDetailsStatus) Ptr() *TenderBuyNowPayLaterDetailsStatus { - return &t + return fmt.Sprintf("%#v", u) } -// Represents additional details of a tender with `type` `CARD` or `SQUARE_GIFT_CARD` -type TenderCardDetails struct { - // The credit card payment's current state (such as `AUTHORIZED` or - // `CAPTURED`). See [TenderCardDetailsStatus](entity:TenderCardDetailsStatus) - // for possible values. - // See [TenderCardDetailsStatus](#type-tendercarddetailsstatus) for possible values - Status *TenderCardDetailsStatus `json:"status,omitempty" url:"status,omitempty"` - // The credit card's non-confidential details. - Card *Card `json:"card,omitempty" url:"card,omitempty"` - // The method used to enter the card's details for the transaction. - // See [TenderCardDetailsEntryMethod](#type-tendercarddetailsentrymethod) for possible values - EntryMethod *TenderCardDetailsEntryMethod `json:"entry_method,omitempty" url:"entry_method,omitempty"` +// Represents an [UpdateBookingCustomAttributeDefinition](api-endpoint:BookingCustomAttributes-UpdateBookingCustomAttributeDefinition) response. +// Either `custom_attribute_definition` or `errors` is present in the response. +type UpdateBookingCustomAttributeDefinitionResponse struct { + // The updated custom attribute definition. + CustomAttributeDefinition *CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"custom_attribute_definition,omitempty"` + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (t *TenderCardDetails) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func (u *UpdateBookingCustomAttributeDefinitionResponse) GetExtraProperties() map[string]interface{} { + return u.extraProperties } -func (t *TenderCardDetails) UnmarshalJSON(data []byte) error { - type unmarshaler TenderCardDetails +func (u *UpdateBookingCustomAttributeDefinitionResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpdateBookingCustomAttributeDefinitionResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TenderCardDetails(value) + *u = UpdateBookingCustomAttributeDefinitionResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *t) + extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { return err } - t.extraProperties = extraProperties + u.extraProperties = extraProperties - t._rawJSON = json.RawMessage(data) + u._rawJSON = json.RawMessage(data) return nil } -func (t *TenderCardDetails) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { +func (u *UpdateBookingCustomAttributeDefinitionResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(t); err == nil { + if value, err := core.StringifyJSON(u); err == nil { return value } - return fmt.Sprintf("%#v", t) + return fmt.Sprintf("%#v", u) } -// Indicates the method used to enter the card's details. -type TenderCardDetailsEntryMethod string - -const ( - TenderCardDetailsEntryMethodSwiped TenderCardDetailsEntryMethod = "SWIPED" - TenderCardDetailsEntryMethodKeyed TenderCardDetailsEntryMethod = "KEYED" - TenderCardDetailsEntryMethodEmv TenderCardDetailsEntryMethod = "EMV" - TenderCardDetailsEntryMethodOnFile TenderCardDetailsEntryMethod = "ON_FILE" - TenderCardDetailsEntryMethodContactless TenderCardDetailsEntryMethod = "CONTACTLESS" -) +type UpdateBookingResponse struct { + // The booking that was updated. + Booking *Booking `json:"booking,omitempty" url:"booking,omitempty"` + // Errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` -func NewTenderCardDetailsEntryMethodFromString(s string) (TenderCardDetailsEntryMethod, error) { - switch s { - case "SWIPED": - return TenderCardDetailsEntryMethodSwiped, nil - case "KEYED": - return TenderCardDetailsEntryMethodKeyed, nil - case "EMV": - return TenderCardDetailsEntryMethodEmv, nil - case "ON_FILE": - return TenderCardDetailsEntryMethodOnFile, nil - case "CONTACTLESS": - return TenderCardDetailsEntryMethodContactless, nil - } - var t TenderCardDetailsEntryMethod - return "", fmt.Errorf("%s is not a valid %T", s, t) + extraProperties map[string]interface{} + _rawJSON json.RawMessage } -func (t TenderCardDetailsEntryMethod) Ptr() *TenderCardDetailsEntryMethod { - return &t +func (u *UpdateBookingResponse) GetExtraProperties() map[string]interface{} { + return u.extraProperties } -// Indicates the card transaction's current status. -type TenderCardDetailsStatus string - -const ( - TenderCardDetailsStatusAuthorized TenderCardDetailsStatus = "AUTHORIZED" - TenderCardDetailsStatusCaptured TenderCardDetailsStatus = "CAPTURED" - TenderCardDetailsStatusVoided TenderCardDetailsStatus = "VOIDED" - TenderCardDetailsStatusFailed TenderCardDetailsStatus = "FAILED" -) +func (u *UpdateBookingResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpdateBookingResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UpdateBookingResponse(value) -func NewTenderCardDetailsStatusFromString(s string) (TenderCardDetailsStatus, error) { - switch s { - case "AUTHORIZED": - return TenderCardDetailsStatusAuthorized, nil - case "CAPTURED": - return TenderCardDetailsStatusCaptured, nil - case "VOIDED": - return TenderCardDetailsStatusVoided, nil - case "FAILED": - return TenderCardDetailsStatusFailed, nil + extraProperties, err := core.ExtractExtraProperties(data, *u) + if err != nil { + return err } - var t TenderCardDetailsStatus - return "", fmt.Errorf("%s is not a valid %T", s, t) + u.extraProperties = extraProperties + + u._rawJSON = json.RawMessage(data) + return nil } -func (t TenderCardDetailsStatus) Ptr() *TenderCardDetailsStatus { - return &t +func (u *UpdateBookingResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) } -// Represents the details of a tender with `type` `CASH`. -type TenderCashDetails struct { - // The total amount of cash provided by the buyer, before change is given. - BuyerTenderedMoney *Money `json:"buyer_tendered_money,omitempty" url:"buyer_tendered_money,omitempty"` - // The amount of change returned to the buyer. - ChangeBackMoney *Money `json:"change_back_money,omitempty" url:"change_back_money,omitempty"` +// A response to a request to update a `BreakType`. The response contains +// the requested `BreakType` objects and might contain a set of `Error` objects if +// the request resulted in errors. +type UpdateBreakTypeResponse struct { + // The response object. + BreakType *BreakType `json:"break_type,omitempty" url:"break_type,omitempty"` + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (t *TenderCashDetails) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func (u *UpdateBreakTypeResponse) GetExtraProperties() map[string]interface{} { + return u.extraProperties } -func (t *TenderCashDetails) UnmarshalJSON(data []byte) error { - type unmarshaler TenderCashDetails +func (u *UpdateBreakTypeResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpdateBreakTypeResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TenderCashDetails(value) + *u = UpdateBreakTypeResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *t) + extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { return err } - t.extraProperties = extraProperties + u.extraProperties = extraProperties - t._rawJSON = json.RawMessage(data) + u._rawJSON = json.RawMessage(data) return nil } -func (t *TenderCashDetails) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { +func (u *UpdateBreakTypeResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(t); err == nil { + if value, err := core.StringifyJSON(u); err == nil { return value } - return fmt.Sprintf("%#v", t) + return fmt.Sprintf("%#v", u) } -// Represents the details of a tender with `type` `SQUARE_ACCOUNT`. -type TenderSquareAccountDetails struct { - // The Square Account payment's current state (such as `AUTHORIZED` or - // `CAPTURED`). See [TenderSquareAccountDetailsStatus](entity:TenderSquareAccountDetailsStatus) - // for possible values. - // See [Status](#type-status) for possible values - Status *TenderSquareAccountDetailsStatus `json:"status,omitempty" url:"status,omitempty"` +type UpdateCatalogImageRequest struct { + // A unique string that identifies this UpdateCatalogImage request. + // Keys can be any valid string but must be unique for every UpdateCatalogImage request. + // + // See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information. + IdempotencyKey string `json:"idempotency_key" url:"idempotency_key"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (t *TenderSquareAccountDetails) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func (u *UpdateCatalogImageRequest) GetExtraProperties() map[string]interface{} { + return u.extraProperties } -func (t *TenderSquareAccountDetails) UnmarshalJSON(data []byte) error { - type unmarshaler TenderSquareAccountDetails +func (u *UpdateCatalogImageRequest) UnmarshalJSON(data []byte) error { + type unmarshaler UpdateCatalogImageRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TenderSquareAccountDetails(value) + *u = UpdateCatalogImageRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *t) + extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { return err } - t.extraProperties = extraProperties + u.extraProperties = extraProperties - t._rawJSON = json.RawMessage(data) + u._rawJSON = json.RawMessage(data) return nil } -func (t *TenderSquareAccountDetails) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { +func (u *UpdateCatalogImageRequest) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(t); err == nil { + if value, err := core.StringifyJSON(u); err == nil { return value } - return fmt.Sprintf("%#v", t) -} - -type TenderSquareAccountDetailsStatus string - -const ( - TenderSquareAccountDetailsStatusAuthorized TenderSquareAccountDetailsStatus = "AUTHORIZED" - TenderSquareAccountDetailsStatusCaptured TenderSquareAccountDetailsStatus = "CAPTURED" - TenderSquareAccountDetailsStatusVoided TenderSquareAccountDetailsStatus = "VOIDED" - TenderSquareAccountDetailsStatusFailed TenderSquareAccountDetailsStatus = "FAILED" -) - -func NewTenderSquareAccountDetailsStatusFromString(s string) (TenderSquareAccountDetailsStatus, error) { - switch s { - case "AUTHORIZED": - return TenderSquareAccountDetailsStatusAuthorized, nil - case "CAPTURED": - return TenderSquareAccountDetailsStatusCaptured, nil - case "VOIDED": - return TenderSquareAccountDetailsStatusVoided, nil - case "FAILED": - return TenderSquareAccountDetailsStatusFailed, nil - } - var t TenderSquareAccountDetailsStatus - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (t TenderSquareAccountDetailsStatus) Ptr() *TenderSquareAccountDetailsStatus { - return &t + return fmt.Sprintf("%#v", u) } -// Indicates a tender's type. -type TenderType string - -const ( - TenderTypeCard TenderType = "CARD" - TenderTypeCash TenderType = "CASH" - TenderTypeThirdPartyCard TenderType = "THIRD_PARTY_CARD" - TenderTypeSquareGiftCard TenderType = "SQUARE_GIFT_CARD" - TenderTypeNoSale TenderType = "NO_SALE" - TenderTypeBankAccount TenderType = "BANK_ACCOUNT" - TenderTypeWallet TenderType = "WALLET" - TenderTypeBuyNowPayLater TenderType = "BUY_NOW_PAY_LATER" - TenderTypeSquareAccount TenderType = "SQUARE_ACCOUNT" - TenderTypeOther TenderType = "OTHER" -) +type UpdateCatalogImageResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The newly updated `CatalogImage` including a Square-generated + // URL for the encapsulated image file. + Image *CatalogObject `json:"image,omitempty" url:"image,omitempty"` -func NewTenderTypeFromString(s string) (TenderType, error) { - switch s { - case "CARD": - return TenderTypeCard, nil - case "CASH": - return TenderTypeCash, nil - case "THIRD_PARTY_CARD": - return TenderTypeThirdPartyCard, nil - case "SQUARE_GIFT_CARD": - return TenderTypeSquareGiftCard, nil - case "NO_SALE": - return TenderTypeNoSale, nil - case "BANK_ACCOUNT": - return TenderTypeBankAccount, nil - case "WALLET": - return TenderTypeWallet, nil - case "BUY_NOW_PAY_LATER": - return TenderTypeBuyNowPayLater, nil - case "SQUARE_ACCOUNT": - return TenderTypeSquareAccount, nil - case "OTHER": - return TenderTypeOther, nil - } - var t TenderType - return "", fmt.Errorf("%s is not a valid %T", s, t) + extraProperties map[string]interface{} + _rawJSON json.RawMessage } -func (t TenderType) Ptr() *TenderType { - return &t +func (u *UpdateCatalogImageResponse) GetExtraProperties() map[string]interface{} { + return u.extraProperties } -// Represents an action processed by the Square Terminal. -type TerminalAction struct { - // A unique ID for this `TerminalAction`. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The unique Id of the device intended for this `TerminalAction`. - // The Id can be retrieved from /v2/devices api. - DeviceID *string `json:"device_id,omitempty" url:"device_id,omitempty"` - // The duration as an RFC 3339 duration, after which the action will be automatically canceled. - // TerminalActions that are `PENDING` will be automatically `CANCELED` and have a cancellation reason - // of `TIMED_OUT` - // - // Default: 5 minutes from creation - // - // Maximum: 5 minutes - DeadlineDuration *string `json:"deadline_duration,omitempty" url:"deadline_duration,omitempty"` - // The status of the `TerminalAction`. - // Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` - Status *string `json:"status,omitempty" url:"status,omitempty"` - // The reason why `TerminalAction` is canceled. Present if the status is `CANCELED`. - // See [ActionCancelReason](#type-actioncancelreason) for possible values - CancelReason *ActionCancelReason `json:"cancel_reason,omitempty" url:"cancel_reason,omitempty"` - // The time when the `TerminalAction` was created as an RFC 3339 timestamp. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The time when the `TerminalAction` was last updated as an RFC 3339 timestamp. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` - // The ID of the application that created the action. - AppID *string `json:"app_id,omitempty" url:"app_id,omitempty"` - // The location id the action is attached to, if a link can be made. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` - // Represents the type of the action. - // See [ActionType](#type-actiontype) for possible values - Type *TerminalActionActionType `json:"type,omitempty" url:"type,omitempty"` - // Describes configuration for the QR code action. Requires `QR_CODE` type. - QrCodeOptions *QrCodeOptions `json:"qr_code_options,omitempty" url:"qr_code_options,omitempty"` - // Describes configuration for the save-card action. Requires `SAVE_CARD` type. - SaveCardOptions *SaveCardOptions `json:"save_card_options,omitempty" url:"save_card_options,omitempty"` - // Describes configuration for the signature capture action. Requires `SIGNATURE` type. - SignatureOptions *SignatureOptions `json:"signature_options,omitempty" url:"signature_options,omitempty"` - // Describes configuration for the confirmation action. Requires `CONFIRMATION` type. - ConfirmationOptions *ConfirmationOptions `json:"confirmation_options,omitempty" url:"confirmation_options,omitempty"` - // Describes configuration for the receipt action. Requires `RECEIPT` type. - ReceiptOptions *ReceiptOptions `json:"receipt_options,omitempty" url:"receipt_options,omitempty"` - // Describes configuration for the data collection action. Requires `DATA_COLLECTION` type. - DataCollectionOptions *DataCollectionOptions `json:"data_collection_options,omitempty" url:"data_collection_options,omitempty"` - // Describes configuration for the select action. Requires `SELECT` type. - SelectOptions *SelectOptions `json:"select_options,omitempty" url:"select_options,omitempty"` - // Details about the Terminal that received the action request (such as battery level, - // operating system version, and network connection settings). - // - // Only available for `PING` action type. - DeviceMetadata *DeviceMetadata `json:"device_metadata,omitempty" url:"device_metadata,omitempty"` - // Indicates the action will be linked to another action and requires a waiting dialog to be - // displayed instead of returning to the idle screen on completion of the action. - // - // Only supported on SIGNATURE, CONFIRMATION, DATA_COLLECTION, and SELECT types. - AwaitNextAction *bool `json:"await_next_action,omitempty" url:"await_next_action,omitempty"` - // The timeout duration of the waiting dialog as an RFC 3339 duration, after which the - // waiting dialog will no longer be displayed and the Terminal will return to the idle screen. - // - // Default: 5 minutes from when the waiting dialog is displayed - // - // Maximum: 5 minutes - AwaitNextActionDuration *string `json:"await_next_action_duration,omitempty" url:"await_next_action_duration,omitempty"` +func (u *UpdateCatalogImageResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpdateCatalogImageResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UpdateCatalogImageResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *u) + if err != nil { + return err + } + u.extraProperties = extraProperties + + u._rawJSON = json.RawMessage(data) + return nil +} + +func (u *UpdateCatalogImageResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) +} + +// Represents an [UpdateCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-UpdateCustomerCustomAttributeDefinition) response. +// Either `custom_attribute_definition` or `errors` is present in the response. +type UpdateCustomerCustomAttributeDefinitionResponse struct { + // The updated custom attribute definition. + CustomAttributeDefinition *CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"custom_attribute_definition,omitempty"` + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (t *TerminalAction) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func (u *UpdateCustomerCustomAttributeDefinitionResponse) GetExtraProperties() map[string]interface{} { + return u.extraProperties } -func (t *TerminalAction) UnmarshalJSON(data []byte) error { - type unmarshaler TerminalAction +func (u *UpdateCustomerCustomAttributeDefinitionResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpdateCustomerCustomAttributeDefinitionResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TerminalAction(value) + *u = UpdateCustomerCustomAttributeDefinitionResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *t) + extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { return err } - t.extraProperties = extraProperties + u.extraProperties = extraProperties - t._rawJSON = json.RawMessage(data) + u._rawJSON = json.RawMessage(data) return nil } -func (t *TerminalAction) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { +func (u *UpdateCustomerCustomAttributeDefinitionResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(t); err == nil { + if value, err := core.StringifyJSON(u); err == nil { return value } - return fmt.Sprintf("%#v", t) + return fmt.Sprintf("%#v", u) } -// Describes the type of this unit and indicates which field contains the unit information. This is an ‘open’ enum. -type TerminalActionActionType string +// Defines the fields that are included in the response body of +// a request to the [UpdateCustomerGroup](api-endpoint:CustomerGroups-UpdateCustomerGroup) endpoint. +// +// Either `errors` or `group` is present in a given response (never both). +type UpdateCustomerGroupResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The successfully updated customer group. + Group *CustomerGroup `json:"group,omitempty" url:"group,omitempty"` -const ( - TerminalActionActionTypeQrCode TerminalActionActionType = "QR_CODE" - TerminalActionActionTypePing TerminalActionActionType = "PING" - TerminalActionActionTypeSaveCard TerminalActionActionType = "SAVE_CARD" - TerminalActionActionTypeSignature TerminalActionActionType = "SIGNATURE" - TerminalActionActionTypeConfirmation TerminalActionActionType = "CONFIRMATION" - TerminalActionActionTypeReceipt TerminalActionActionType = "RECEIPT" - TerminalActionActionTypeDataCollection TerminalActionActionType = "DATA_COLLECTION" - TerminalActionActionTypeSelect TerminalActionActionType = "SELECT" -) + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} -func NewTerminalActionActionTypeFromString(s string) (TerminalActionActionType, error) { - switch s { - case "QR_CODE": - return TerminalActionActionTypeQrCode, nil - case "PING": - return TerminalActionActionTypePing, nil - case "SAVE_CARD": - return TerminalActionActionTypeSaveCard, nil - case "SIGNATURE": - return TerminalActionActionTypeSignature, nil - case "CONFIRMATION": - return TerminalActionActionTypeConfirmation, nil - case "RECEIPT": - return TerminalActionActionTypeReceipt, nil - case "DATA_COLLECTION": - return TerminalActionActionTypeDataCollection, nil - case "SELECT": - return TerminalActionActionTypeSelect, nil +func (u *UpdateCustomerGroupResponse) GetExtraProperties() map[string]interface{} { + return u.extraProperties +} + +func (u *UpdateCustomerGroupResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpdateCustomerGroupResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - var t TerminalActionActionType - return "", fmt.Errorf("%s is not a valid %T", s, t) + *u = UpdateCustomerGroupResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *u) + if err != nil { + return err + } + u.extraProperties = extraProperties + + u._rawJSON = json.RawMessage(data) + return nil } -func (t TerminalActionActionType) Ptr() *TerminalActionActionType { - return &t +func (u *UpdateCustomerGroupResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) } -type TerminalActionQuery struct { - // Options for filtering returned `TerminalAction`s - Filter *TerminalActionQueryFilter `json:"filter,omitempty" url:"filter,omitempty"` - // Option for sorting returned `TerminalAction` objects. - Sort *TerminalActionQuerySort `json:"sort,omitempty" url:"sort,omitempty"` +// Defines the fields that are included in the response body of +// a request to the [UpdateCustomer](api-endpoint:Customers-UpdateCustomer) or +// [BulkUpdateCustomers](api-endpoint:Customers-BulkUpdateCustomers) endpoint. +// +// Either `errors` or `customer` is present in a given response (never both). +type UpdateCustomerResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The updated customer. + Customer *Customer `json:"customer,omitempty" url:"customer,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (t *TerminalActionQuery) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func (u *UpdateCustomerResponse) GetExtraProperties() map[string]interface{} { + return u.extraProperties } -func (t *TerminalActionQuery) UnmarshalJSON(data []byte) error { - type unmarshaler TerminalActionQuery +func (u *UpdateCustomerResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpdateCustomerResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TerminalActionQuery(value) + *u = UpdateCustomerResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *t) + extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { return err } - t.extraProperties = extraProperties + u.extraProperties = extraProperties - t._rawJSON = json.RawMessage(data) + u._rawJSON = json.RawMessage(data) return nil } -func (t *TerminalActionQuery) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { +func (u *UpdateCustomerResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(t); err == nil { + if value, err := core.StringifyJSON(u); err == nil { return value } - return fmt.Sprintf("%#v", t) + return fmt.Sprintf("%#v", u) } -type TerminalActionQueryFilter struct { - // `TerminalAction`s associated with a specific device. If no device is specified then all - // `TerminalAction`s for the merchant will be displayed. - DeviceID *string `json:"device_id,omitempty" url:"device_id,omitempty"` - // Time range for the beginning of the reporting period. Inclusive. - // Default value: The current time minus one day. - // Note that `TerminalAction`s are available for 30 days after creation. - CreatedAt *TimeRange `json:"created_at,omitempty" url:"created_at,omitempty"` - // Filter results with the desired status of the `TerminalAction` - // Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` - Status *string `json:"status,omitempty" url:"status,omitempty"` - // Filter results with the requested ActionType. - // See [TerminalActionActionType](#type-terminalactionactiontype) for possible values - Type *TerminalActionActionType `json:"type,omitempty" url:"type,omitempty"` +// Describes a `UpdateInvoice` response. +type UpdateInvoiceResponse struct { + // The updated invoice. + Invoice *Invoice `json:"invoice,omitempty" url:"invoice,omitempty"` + // Information about errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (t *TerminalActionQueryFilter) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func (u *UpdateInvoiceResponse) GetExtraProperties() map[string]interface{} { + return u.extraProperties } -func (t *TerminalActionQueryFilter) UnmarshalJSON(data []byte) error { - type unmarshaler TerminalActionQueryFilter +func (u *UpdateInvoiceResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpdateInvoiceResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TerminalActionQueryFilter(value) + *u = UpdateInvoiceResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *t) + extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { return err } - t.extraProperties = extraProperties + u.extraProperties = extraProperties - t._rawJSON = json.RawMessage(data) + u._rawJSON = json.RawMessage(data) return nil } -func (t *TerminalActionQueryFilter) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { +func (u *UpdateInvoiceResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(t); err == nil { + if value, err := core.StringifyJSON(u); err == nil { return value } - return fmt.Sprintf("%#v", t) + return fmt.Sprintf("%#v", u) } -type TerminalActionQuerySort struct { - // The order in which results are listed. - // - // - `ASC` - Oldest to newest. - // - `DESC` - Newest to oldest (default). - // See [SortOrder](#type-sortorder) for possible values - SortOrder *SortOrder `json:"sort_order,omitempty" url:"sort_order,omitempty"` +type UpdateItemModifierListsResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The database [timestamp](https://developer.squareup.com/docs/build-basics/common-data-types/working-with-dates) of this update in RFC 3339 format, e.g., `2016-09-04T23:59:33.123Z`. + UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (t *TerminalActionQuerySort) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func (u *UpdateItemModifierListsResponse) GetExtraProperties() map[string]interface{} { + return u.extraProperties } -func (t *TerminalActionQuerySort) UnmarshalJSON(data []byte) error { - type unmarshaler TerminalActionQuerySort +func (u *UpdateItemModifierListsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpdateItemModifierListsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TerminalActionQuerySort(value) + *u = UpdateItemModifierListsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *t) + extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { return err } - t.extraProperties = extraProperties + u.extraProperties = extraProperties - t._rawJSON = json.RawMessage(data) + u._rawJSON = json.RawMessage(data) return nil } -func (t *TerminalActionQuerySort) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { +func (u *UpdateItemModifierListsResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(t); err == nil { + if value, err := core.StringifyJSON(u); err == nil { return value } - return fmt.Sprintf("%#v", t) + return fmt.Sprintf("%#v", u) } -// Represents a checkout processed by the Square Terminal. -type TerminalCheckout struct { - // A unique ID for this `TerminalCheckout`. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The amount of money (including the tax amount) that the Square Terminal device should try to collect. - AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` - // An optional user-defined reference ID that can be used to associate - // this `TerminalCheckout` to another entity in an external system. For example, an order - // ID generated by a third-party shopping cart. The ID is also associated with any payments - // used to complete the checkout. - ReferenceID *string `json:"reference_id,omitempty" url:"reference_id,omitempty"` - // An optional note to associate with the checkout, as well as with any payments used to complete the checkout. - // Note: maximum 500 characters - Note *string `json:"note,omitempty" url:"note,omitempty"` - // The reference to the Square order ID for the checkout request. Supported only in the US. - OrderID *string `json:"order_id,omitempty" url:"order_id,omitempty"` - // Payment-specific options for the checkout request. Supported only in the US. - PaymentOptions *PaymentOptions `json:"payment_options,omitempty" url:"payment_options,omitempty"` - // Options to control the display and behavior of the Square Terminal device. - DeviceOptions *DeviceCheckoutOptions `json:"device_options,omitempty" url:"device_options,omitempty"` - // An RFC 3339 duration, after which the checkout is automatically canceled. - // A `TerminalCheckout` that is `PENDING` is automatically `CANCELED` and has a cancellation reason - // of `TIMED_OUT`. - // - // Default: 5 minutes from creation - // - // Maximum: 5 minutes - DeadlineDuration *string `json:"deadline_duration,omitempty" url:"deadline_duration,omitempty"` - // The status of the `TerminalCheckout`. - // Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` - Status *string `json:"status,omitempty" url:"status,omitempty"` - // The reason why `TerminalCheckout` is canceled. Present if the status is `CANCELED`. - // See [ActionCancelReason](#type-actioncancelreason) for possible values - CancelReason *ActionCancelReason `json:"cancel_reason,omitempty" url:"cancel_reason,omitempty"` - // A list of IDs for payments created by this `TerminalCheckout`. - PaymentIDs []string `json:"payment_ids,omitempty" url:"payment_ids,omitempty"` - // The time when the `TerminalCheckout` was created, as an RFC 3339 timestamp. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The time when the `TerminalCheckout` was last updated, as an RFC 3339 timestamp. +type UpdateItemTaxesResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The database [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) of this update in RFC 3339 format, e.g., `2016-09-04T23:59:33.123Z`. UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` - // The ID of the application that created the checkout. - AppID *string `json:"app_id,omitempty" url:"app_id,omitempty"` - // The location of the device where the `TerminalCheckout` was directed. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` - // The type of payment the terminal should attempt to capture from. Defaults to `CARD_PRESENT`. - // See [CheckoutOptionsPaymentType](#type-checkoutoptionspaymenttype) for possible values - PaymentType *CheckoutOptionsPaymentType `json:"payment_type,omitempty" url:"payment_type,omitempty"` - // An optional ID of the team member associated with creating the checkout. - TeamMemberID *string `json:"team_member_id,omitempty" url:"team_member_id,omitempty"` - // An optional ID of the customer associated with the checkout. - CustomerID *string `json:"customer_id,omitempty" url:"customer_id,omitempty"` - // The amount the developer is taking as a fee for facilitating the payment on behalf - // of the seller. - // - // The amount cannot be more than 90% of the total amount of the payment. - // - // The amount must be specified in the smallest denomination of the applicable currency (for example, US dollar amounts are specified in cents). For more information, see [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts). - // - // The fee currency code must match the currency associated with the seller that is accepting the payment. The application must be from a developer account in the same country and using the same currency code as the seller. - // - // For more information about the application fee scenario, see [Take Payments and Collect Fees](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees). - // - // To set this field, PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS OAuth permission is required. For more information, see [Permissions](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees#permissions). - // - // Supported only in the US. - AppFeeMoney *Money `json:"app_fee_money,omitempty" url:"app_fee_money,omitempty"` - // Optional additional payment information to include on the customer's card statement as - // part of the statement description. This can be, for example, an invoice number, ticket number, - // or short description that uniquely identifies the purchase. Supported only in the US. - StatementDescriptionIdentifier *string `json:"statement_description_identifier,omitempty" url:"statement_description_identifier,omitempty"` - // The amount designated as a tip, in addition to `amount_money`. This may only be set for a - // checkout that has tipping disabled (`tip_settings.allow_tipping` is `false`). Supported only in - // the US. - TipMoney *Money `json:"tip_money,omitempty" url:"tip_money,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (t *TerminalCheckout) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func (u *UpdateItemTaxesResponse) GetExtraProperties() map[string]interface{} { + return u.extraProperties } -func (t *TerminalCheckout) UnmarshalJSON(data []byte) error { - type unmarshaler TerminalCheckout +func (u *UpdateItemTaxesResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpdateItemTaxesResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TerminalCheckout(value) + *u = UpdateItemTaxesResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *t) + extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { return err } - t.extraProperties = extraProperties + u.extraProperties = extraProperties - t._rawJSON = json.RawMessage(data) + u._rawJSON = json.RawMessage(data) return nil } -func (t *TerminalCheckout) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { +func (u *UpdateItemTaxesResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(t); err == nil { + if value, err := core.StringifyJSON(u); err == nil { return value } - return fmt.Sprintf("%#v", t) + return fmt.Sprintf("%#v", u) } -type TerminalCheckoutQuery struct { - // Options for filtering returned `TerminalCheckout` objects. - Filter *TerminalCheckoutQueryFilter `json:"filter,omitempty" url:"filter,omitempty"` - // Option for sorting returned `TerminalCheckout` objects. - Sort *TerminalCheckoutQuerySort `json:"sort,omitempty" url:"sort,omitempty"` +// Represents an [UpdateLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-UpdateLocationCustomAttributeDefinition) response. +// Either `custom_attribute_definition` or `errors` is present in the response. +type UpdateLocationCustomAttributeDefinitionResponse struct { + // The updated custom attribute definition. + CustomAttributeDefinition *CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"custom_attribute_definition,omitempty"` + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (t *TerminalCheckoutQuery) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func (u *UpdateLocationCustomAttributeDefinitionResponse) GetExtraProperties() map[string]interface{} { + return u.extraProperties } -func (t *TerminalCheckoutQuery) UnmarshalJSON(data []byte) error { - type unmarshaler TerminalCheckoutQuery +func (u *UpdateLocationCustomAttributeDefinitionResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpdateLocationCustomAttributeDefinitionResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TerminalCheckoutQuery(value) + *u = UpdateLocationCustomAttributeDefinitionResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *t) + extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { return err } - t.extraProperties = extraProperties + u.extraProperties = extraProperties - t._rawJSON = json.RawMessage(data) + u._rawJSON = json.RawMessage(data) return nil } -func (t *TerminalCheckoutQuery) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { +func (u *UpdateLocationCustomAttributeDefinitionResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(t); err == nil { + if value, err := core.StringifyJSON(u); err == nil { return value } - return fmt.Sprintf("%#v", t) + return fmt.Sprintf("%#v", u) } -type TerminalCheckoutQueryFilter struct { - // The `TerminalCheckout` objects associated with a specific device. If no device is specified, then all - // `TerminalCheckout` objects for the merchant are displayed. - DeviceID *string `json:"device_id,omitempty" url:"device_id,omitempty"` - // The time range for the beginning of the reporting period, which is inclusive. - // Default value: The current time minus one day. - // Note that `TerminalCheckout`s are available for 30 days after creation. - CreatedAt *TimeRange `json:"created_at,omitempty" url:"created_at,omitempty"` - // Filtered results with the desired status of the `TerminalCheckout`. - // Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` - Status *string `json:"status,omitempty" url:"status,omitempty"` +// The response object returned by the [UpdateLocation](api-endpoint:Locations-UpdateLocation) endpoint. +type UpdateLocationResponse struct { + // Information about errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The updated `Location` object. + Location *Location `json:"location,omitempty" url:"location,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (t *TerminalCheckoutQueryFilter) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func (u *UpdateLocationResponse) GetExtraProperties() map[string]interface{} { + return u.extraProperties } -func (t *TerminalCheckoutQueryFilter) UnmarshalJSON(data []byte) error { - type unmarshaler TerminalCheckoutQueryFilter +func (u *UpdateLocationResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpdateLocationResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TerminalCheckoutQueryFilter(value) + *u = UpdateLocationResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *t) + extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { return err } - t.extraProperties = extraProperties + u.extraProperties = extraProperties - t._rawJSON = json.RawMessage(data) + u._rawJSON = json.RawMessage(data) return nil } -func (t *TerminalCheckoutQueryFilter) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { +func (u *UpdateLocationResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(t); err == nil { + if value, err := core.StringifyJSON(u); err == nil { return value } - return fmt.Sprintf("%#v", t) + return fmt.Sprintf("%#v", u) } -type TerminalCheckoutQuerySort struct { - // The order in which results are listed. - // Default: `DESC` - // See [SortOrder](#type-sortorder) for possible values - SortOrder *SortOrder `json:"sort_order,omitempty" url:"sort_order,omitempty"` +type UpdateLocationSettingsResponse struct { + // Any errors that occurred when updating the location settings. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The updated location settings. + LocationSettings *CheckoutLocationSettings `json:"location_settings,omitempty" url:"location_settings,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (t *TerminalCheckoutQuerySort) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func (u *UpdateLocationSettingsResponse) GetExtraProperties() map[string]interface{} { + return u.extraProperties } -func (t *TerminalCheckoutQuerySort) UnmarshalJSON(data []byte) error { - type unmarshaler TerminalCheckoutQuerySort +func (u *UpdateLocationSettingsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpdateLocationSettingsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TerminalCheckoutQuerySort(value) + *u = UpdateLocationSettingsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *t) + extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { return err } - t.extraProperties = extraProperties + u.extraProperties = extraProperties - t._rawJSON = json.RawMessage(data) + u._rawJSON = json.RawMessage(data) return nil } -func (t *TerminalCheckoutQuerySort) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { +func (u *UpdateLocationSettingsResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(t); err == nil { + if value, err := core.StringifyJSON(u); err == nil { return value } - return fmt.Sprintf("%#v", t) + return fmt.Sprintf("%#v", u) } -// Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit network) payment refunds. -type TerminalRefund struct { - // A unique ID for this `TerminalRefund`. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The reference to the payment refund created by completing this `TerminalRefund`. - RefundID *string `json:"refund_id,omitempty" url:"refund_id,omitempty"` - // The unique ID of the payment being refunded. - PaymentID string `json:"payment_id" url:"payment_id"` - // The reference to the Square order ID for the payment identified by the `payment_id`. - OrderID *string `json:"order_id,omitempty" url:"order_id,omitempty"` - // The amount of money, inclusive of `tax_money`, that the `TerminalRefund` should return. - // This value is limited to the amount taken in the original payment minus any completed or - // pending refunds. - AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` - // A description of the reason for the refund. - Reason string `json:"reason" url:"reason"` - // The unique ID of the device intended for this `TerminalRefund`. - // The Id can be retrieved from /v2/devices api. - DeviceID string `json:"device_id" url:"device_id"` - // The RFC 3339 duration, after which the refund is automatically canceled. - // A `TerminalRefund` that is `PENDING` is automatically `CANCELED` and has a cancellation reason - // of `TIMED_OUT`. - // - // Default: 5 minutes from creation. - // - // Maximum: 5 minutes - DeadlineDuration *string `json:"deadline_duration,omitempty" url:"deadline_duration,omitempty"` - // The status of the `TerminalRefund`. - // Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, or `COMPLETED`. - Status *string `json:"status,omitempty" url:"status,omitempty"` - // Present if the status is `CANCELED`. - // See [ActionCancelReason](#type-actioncancelreason) for possible values - CancelReason *ActionCancelReason `json:"cancel_reason,omitempty" url:"cancel_reason,omitempty"` - // The time when the `TerminalRefund` was created, as an RFC 3339 timestamp. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The time when the `TerminalRefund` was last updated, as an RFC 3339 timestamp. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` - // The ID of the application that created the refund. - AppID *string `json:"app_id,omitempty" url:"app_id,omitempty"` - // The location of the device where the `TerminalRefund` was directed. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` +// Represents an [UpdateMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-UpdateMerchantCustomAttributeDefinition) response. +// Either `custom_attribute_definition` or `errors` is present in the response. +type UpdateMerchantCustomAttributeDefinitionResponse struct { + // The updated custom attribute definition. + CustomAttributeDefinition *CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"custom_attribute_definition,omitempty"` + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (t *TerminalRefund) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func (u *UpdateMerchantCustomAttributeDefinitionResponse) GetExtraProperties() map[string]interface{} { + return u.extraProperties } -func (t *TerminalRefund) UnmarshalJSON(data []byte) error { - type unmarshaler TerminalRefund +func (u *UpdateMerchantCustomAttributeDefinitionResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpdateMerchantCustomAttributeDefinitionResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TerminalRefund(value) + *u = UpdateMerchantCustomAttributeDefinitionResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *t) + extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { return err } - t.extraProperties = extraProperties + u.extraProperties = extraProperties - t._rawJSON = json.RawMessage(data) + u._rawJSON = json.RawMessage(data) return nil } -func (t *TerminalRefund) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { +func (u *UpdateMerchantCustomAttributeDefinitionResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(t); err == nil { + if value, err := core.StringifyJSON(u); err == nil { return value } - return fmt.Sprintf("%#v", t) + return fmt.Sprintf("%#v", u) } -type TerminalRefundQuery struct { - // The filter for the Terminal refund query. - Filter *TerminalRefundQueryFilter `json:"filter,omitempty" url:"filter,omitempty"` - // The sort order for the Terminal refund query. - Sort *TerminalRefundQuerySort `json:"sort,omitempty" url:"sort,omitempty"` +type UpdateMerchantSettingsResponse struct { + // Any errors that occurred when updating the merchant settings. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The updated merchant settings. + MerchantSettings *CheckoutMerchantSettings `json:"merchant_settings,omitempty" url:"merchant_settings,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (t *TerminalRefundQuery) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func (u *UpdateMerchantSettingsResponse) GetExtraProperties() map[string]interface{} { + return u.extraProperties } -func (t *TerminalRefundQuery) UnmarshalJSON(data []byte) error { - type unmarshaler TerminalRefundQuery +func (u *UpdateMerchantSettingsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpdateMerchantSettingsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TerminalRefundQuery(value) + *u = UpdateMerchantSettingsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *t) + extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { return err } - t.extraProperties = extraProperties + u.extraProperties = extraProperties - t._rawJSON = json.RawMessage(data) + u._rawJSON = json.RawMessage(data) return nil } -func (t *TerminalRefundQuery) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { +func (u *UpdateMerchantSettingsResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(t); err == nil { + if value, err := core.StringifyJSON(u); err == nil { return value } - return fmt.Sprintf("%#v", t) + return fmt.Sprintf("%#v", u) } -type TerminalRefundQueryFilter struct { - // `TerminalRefund` objects associated with a specific device. If no device is specified, then all - // `TerminalRefund` objects for the signed-in account are displayed. - DeviceID *string `json:"device_id,omitempty" url:"device_id,omitempty"` - // The timestamp for the beginning of the reporting period, in RFC 3339 format. Inclusive. - // Default value: The current time minus one day. - // Note that `TerminalRefund`s are available for 30 days after creation. - CreatedAt *TimeRange `json:"created_at,omitempty" url:"created_at,omitempty"` - // Filtered results with the desired status of the `TerminalRefund`. - // Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, or `COMPLETED`. - Status *string `json:"status,omitempty" url:"status,omitempty"` +// Represents a response from updating an order custom attribute definition. +type UpdateOrderCustomAttributeDefinitionResponse struct { + // The updated order custom attribute definition. + CustomAttributeDefinition *CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"custom_attribute_definition,omitempty"` + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (t *TerminalRefundQueryFilter) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func (u *UpdateOrderCustomAttributeDefinitionResponse) GetExtraProperties() map[string]interface{} { + return u.extraProperties } -func (t *TerminalRefundQueryFilter) UnmarshalJSON(data []byte) error { - type unmarshaler TerminalRefundQueryFilter +func (u *UpdateOrderCustomAttributeDefinitionResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpdateOrderCustomAttributeDefinitionResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TerminalRefundQueryFilter(value) + *u = UpdateOrderCustomAttributeDefinitionResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *t) + extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { return err } - t.extraProperties = extraProperties + u.extraProperties = extraProperties - t._rawJSON = json.RawMessage(data) + u._rawJSON = json.RawMessage(data) return nil } -func (t *TerminalRefundQueryFilter) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { +func (u *UpdateOrderCustomAttributeDefinitionResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(t); err == nil { + if value, err := core.StringifyJSON(u); err == nil { return value } - return fmt.Sprintf("%#v", t) + return fmt.Sprintf("%#v", u) } -type TerminalRefundQuerySort struct { - // The order in which results are listed. - // - // - `ASC` - Oldest to newest. - // - `DESC` - Newest to oldest (default). - SortOrder *string `json:"sort_order,omitempty" url:"sort_order,omitempty"` +// Defines the fields that are included in the response body of +// a request to the [UpdateOrder](api-endpoint:Orders-UpdateOrder) endpoint. +type UpdateOrderResponse struct { + // The updated order. + Order *Order `json:"order,omitempty" url:"order,omitempty"` + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (t *TerminalRefundQuerySort) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func (u *UpdateOrderResponse) GetExtraProperties() map[string]interface{} { + return u.extraProperties } -func (t *TerminalRefundQuerySort) UnmarshalJSON(data []byte) error { - type unmarshaler TerminalRefundQuerySort +func (u *UpdateOrderResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpdateOrderResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TerminalRefundQuerySort(value) + *u = UpdateOrderResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *t) + extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { return err } - t.extraProperties = extraProperties + u.extraProperties = extraProperties - t._rawJSON = json.RawMessage(data) + u._rawJSON = json.RawMessage(data) return nil } -func (t *TerminalRefundQuerySort) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { +func (u *UpdateOrderResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(t); err == nil { + if value, err := core.StringifyJSON(u); err == nil { return value } - return fmt.Sprintf("%#v", t) + return fmt.Sprintf("%#v", u) } -// Defines the fields that are included in the response body of -// a request to the [TestWebhookSubscription]($e/WebhookSubscriptions/TestWebhookSubscription) endpoint. -// -// Note: If there are errors processing the request, the [SubscriptionTestResult]($m/SubscriptionTestResult) field is not -// present. -type TestWebhookSubscriptionResponse struct { - // Information on errors encountered during the request. +type UpdatePaymentLinkResponse struct { + // Any errors that occurred when updating the payment link. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The [SubscriptionTestResult](entity:SubscriptionTestResult). - SubscriptionTestResult *SubscriptionTestResult `json:"subscription_test_result,omitempty" url:"subscription_test_result,omitempty"` + // The updated payment link. + PaymentLink *PaymentLink `json:"payment_link,omitempty" url:"payment_link,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (t *TestWebhookSubscriptionResponse) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func (u *UpdatePaymentLinkResponse) GetExtraProperties() map[string]interface{} { + return u.extraProperties } -func (t *TestWebhookSubscriptionResponse) UnmarshalJSON(data []byte) error { - type unmarshaler TestWebhookSubscriptionResponse +func (u *UpdatePaymentLinkResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpdatePaymentLinkResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TestWebhookSubscriptionResponse(value) + *u = UpdatePaymentLinkResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *t) + extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { return err } - t.extraProperties = extraProperties + u.extraProperties = extraProperties - t._rawJSON = json.RawMessage(data) + u._rawJSON = json.RawMessage(data) return nil } -func (t *TestWebhookSubscriptionResponse) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { +func (u *UpdatePaymentLinkResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(t); err == nil { + if value, err := core.StringifyJSON(u); err == nil { return value } - return fmt.Sprintf("%#v", t) + return fmt.Sprintf("%#v", u) } -// Represents a generic time range. The start and end values are -// represented in RFC 3339 format. Time ranges are customized to be -// inclusive or exclusive based on the needs of a particular endpoint. -// Refer to the relevant endpoint-specific documentation to determine -// how time ranges are handled. -type TimeRange struct { - // A datetime value in RFC 3339 format indicating when the time range - // starts. - StartAt *string `json:"start_at,omitempty" url:"start_at,omitempty"` - // A datetime value in RFC 3339 format indicating when the time range - // ends. - EndAt *string `json:"end_at,omitempty" url:"end_at,omitempty"` +// Defines the response returned by +// [UpdatePayment](api-endpoint:Payments-UpdatePayment). +type UpdatePaymentResponse struct { + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The updated payment. + Payment *Payment `json:"payment,omitempty" url:"payment,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (t *TimeRange) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func (u *UpdatePaymentResponse) GetExtraProperties() map[string]interface{} { + return u.extraProperties } -func (t *TimeRange) UnmarshalJSON(data []byte) error { - type unmarshaler TimeRange +func (u *UpdatePaymentResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpdatePaymentResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TimeRange(value) + *u = UpdatePaymentResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *t) + extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { return err } - t.extraProperties = extraProperties + u.extraProperties = extraProperties - t._rawJSON = json.RawMessage(data) + u._rawJSON = json.RawMessage(data) return nil } -func (t *TimeRange) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { +func (u *UpdatePaymentResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(t); err == nil { + if value, err := core.StringifyJSON(u); err == nil { return value } - return fmt.Sprintf("%#v", t) + return fmt.Sprintf("%#v", u) } -type TipSettings struct { - // Indicates whether tipping is enabled for this checkout. Defaults to false. - AllowTipping *bool `json:"allow_tipping,omitempty" url:"allow_tipping,omitempty"` - // Indicates whether tip options should be presented on the screen before presenting - // the signature screen during card payment. Defaults to false. - SeparateTipScreen *bool `json:"separate_tip_screen,omitempty" url:"separate_tip_screen,omitempty"` - // Indicates whether custom tip amounts are allowed during the checkout flow. Defaults to false. - CustomTipField *bool `json:"custom_tip_field,omitempty" url:"custom_tip_field,omitempty"` - // A list of tip percentages that should be presented during the checkout flow, specified as - // up to 3 non-negative integers from 0 to 100 (inclusive). Defaults to 15, 20, and 25. - TipPercentages []int `json:"tip_percentages,omitempty" url:"tip_percentages,omitempty"` - // Enables the "Smart Tip Amounts" behavior. - // Exact tipping options depend on the region in which the Square seller is active. - // - // For payments under 10.00, in the Australia, Canada, Ireland, United Kingdom, and United States, tipping options are presented as no tip, .50, 1.00 or 2.00. - // - // For payment amounts of 10.00 or greater, tipping options are presented as the following percentages: 0%, 5%, 10%, 15%. - // - // If set to true, the `tip_percentages` settings is ignored. - // Defaults to false. - // - // To learn more about smart tipping, see [Accept Tips with the Square App](https://squareup.com/help/us/en/article/5069-accept-tips-with-the-square-app). - SmartTipping *bool `json:"smart_tipping,omitempty" url:"smart_tipping,omitempty"` +// The response to a request to update a `Shift`. The response contains +// the updated `Shift` object and might contain a set of `Error` objects if +// the request resulted in errors. +type UpdateShiftResponse struct { + // The updated `Shift`. + Shift *Shift `json:"shift,omitempty" url:"shift,omitempty"` + // Any errors that occurred during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (t *TipSettings) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func (u *UpdateShiftResponse) GetExtraProperties() map[string]interface{} { + return u.extraProperties } -func (t *TipSettings) UnmarshalJSON(data []byte) error { - type unmarshaler TipSettings +func (u *UpdateShiftResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpdateShiftResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TipSettings(value) + *u = UpdateShiftResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *t) + extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { return err } - t.extraProperties = extraProperties + u.extraProperties = extraProperties - t._rawJSON = json.RawMessage(data) + u._rawJSON = json.RawMessage(data) return nil } -func (t *TipSettings) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { +func (u *UpdateShiftResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(t); err == nil { + if value, err := core.StringifyJSON(u); err == nil { return value } - return fmt.Sprintf("%#v", t) + return fmt.Sprintf("%#v", u) } -// Represents a transaction processed with Square, either with the -// Connect API or with Square Point of Sale. -// -// The `tenders` field of this object lists all methods of payment used to pay in -// the transaction. -type Transaction struct { - // The transaction's unique ID, issued by Square payments servers. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The ID of the transaction's associated location. - LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` - // The timestamp for when the transaction was created, in RFC 3339 format. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The tenders used to pay in the transaction. - Tenders []*Tender `json:"tenders,omitempty" url:"tenders,omitempty"` - // Refunds that have been applied to any tender in the transaction. - Refunds []*Refund `json:"refunds,omitempty" url:"refunds,omitempty"` - // If the transaction was created with the [Charge](api-endpoint:Transactions-Charge) - // endpoint, this value is the same as the value provided for the `reference_id` - // parameter in the request to that endpoint. Otherwise, it is not set. - ReferenceID *string `json:"reference_id,omitempty" url:"reference_id,omitempty"` - // The Square product that processed the transaction. - // See [TransactionProduct](#type-transactionproduct) for possible values - Product *TransactionProduct `json:"product,omitempty" url:"product,omitempty"` - // If the transaction was created in the Square Point of Sale app, this value - // is the ID generated for the transaction by Square Point of Sale. - // - // This ID has no relationship to the transaction's canonical `id`, which is - // generated by Square's backend servers. This value is generated for bookkeeping - // purposes, in case the transaction cannot immediately be completed (for example, - // if the transaction is processed in offline mode). - // - // It is not currently possible with the Connect API to perform a transaction - // lookup by this value. - ClientID *string `json:"client_id,omitempty" url:"client_id,omitempty"` - // The shipping address provided in the request, if any. - ShippingAddress *Address `json:"shipping_address,omitempty" url:"shipping_address,omitempty"` - // The order_id is an identifier for the order associated with this transaction, if any. - OrderID *string `json:"order_id,omitempty" url:"order_id,omitempty"` +// Defines output parameters in a response from the +// [UpdateSubscription](api-endpoint:Subscriptions-UpdateSubscription) endpoint. +type UpdateSubscriptionResponse struct { + // Errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The updated subscription. + Subscription *Subscription `json:"subscription,omitempty" url:"subscription,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (t *Transaction) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func (u *UpdateSubscriptionResponse) GetExtraProperties() map[string]interface{} { + return u.extraProperties } -func (t *Transaction) UnmarshalJSON(data []byte) error { - type unmarshaler Transaction +func (u *UpdateSubscriptionResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpdateSubscriptionResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = Transaction(value) + *u = UpdateSubscriptionResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *t) + extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { return err } - t.extraProperties = extraProperties + u.extraProperties = extraProperties - t._rawJSON = json.RawMessage(data) + u._rawJSON = json.RawMessage(data) return nil } -func (t *Transaction) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { +func (u *UpdateSubscriptionResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(t); err == nil { + if value, err := core.StringifyJSON(u); err == nil { return value } - return fmt.Sprintf("%#v", t) + return fmt.Sprintf("%#v", u) } -// Indicates the Square product used to process a transaction. -type TransactionProduct string - -const ( - TransactionProductRegister TransactionProduct = "REGISTER" - TransactionProductExternalAPI TransactionProduct = "EXTERNAL_API" - TransactionProductBilling TransactionProduct = "BILLING" - TransactionProductAppointments TransactionProduct = "APPOINTMENTS" - TransactionProductInvoices TransactionProduct = "INVOICES" - TransactionProductOnlineStore TransactionProduct = "ONLINE_STORE" - TransactionProductPayroll TransactionProduct = "PAYROLL" - TransactionProductOther TransactionProduct = "OTHER" -) +// Represents an update request for a `TeamMember` object. +type UpdateTeamMemberRequest struct { + // The data used to update the `TeamMember` object. + TeamMember *TeamMember `json:"team_member,omitempty" url:"team_member,omitempty"` -func NewTransactionProductFromString(s string) (TransactionProduct, error) { - switch s { - case "REGISTER": - return TransactionProductRegister, nil - case "EXTERNAL_API": - return TransactionProductExternalAPI, nil - case "BILLING": - return TransactionProductBilling, nil - case "APPOINTMENTS": - return TransactionProductAppointments, nil - case "INVOICES": - return TransactionProductInvoices, nil - case "ONLINE_STORE": - return TransactionProductOnlineStore, nil - case "PAYROLL": - return TransactionProductPayroll, nil - case "OTHER": - return TransactionProductOther, nil - } - var t TransactionProduct - return "", fmt.Errorf("%s is not a valid %T", s, t) + extraProperties map[string]interface{} + _rawJSON json.RawMessage } -func (t TransactionProduct) Ptr() *TransactionProduct { - return &t +func (u *UpdateTeamMemberRequest) GetExtraProperties() map[string]interface{} { + return u.extraProperties } -// The transaction type used in the disputed payment. -type TransactionType string - -const ( - TransactionTypeDebit TransactionType = "DEBIT" - TransactionTypeCredit TransactionType = "CREDIT" -) +func (u *UpdateTeamMemberRequest) UnmarshalJSON(data []byte) error { + type unmarshaler UpdateTeamMemberRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UpdateTeamMemberRequest(value) -func NewTransactionTypeFromString(s string) (TransactionType, error) { - switch s { - case "DEBIT": - return TransactionTypeDebit, nil - case "CREDIT": - return TransactionTypeCredit, nil + extraProperties, err := core.ExtractExtraProperties(data, *u) + if err != nil { + return err } - var t TransactionType - return "", fmt.Errorf("%s is not a valid %T", s, t) + u.extraProperties = extraProperties + + u._rawJSON = json.RawMessage(data) + return nil } -func (t TransactionType) Ptr() *TransactionType { - return &t +func (u *UpdateTeamMemberRequest) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) } -// A response that contains the unlinked `GiftCard` object. If the request resulted in errors, -// the response contains a set of `Error` objects. -type UnlinkCustomerFromGiftCardResponse struct { - // Any errors that occurred during the request. +// Represents a response from an update request containing the updated `TeamMember` object or error messages. +type UpdateTeamMemberResponse struct { + // The successfully updated `TeamMember` object. + TeamMember *TeamMember `json:"team_member,omitempty" url:"team_member,omitempty"` + // The errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The gift card with the ID of the unlinked customer removed from the `customer_ids` field. - // If no other customers are linked, the `customer_ids` field is also removed. - GiftCard *GiftCard `json:"gift_card,omitempty" url:"gift_card,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UnlinkCustomerFromGiftCardResponse) GetExtraProperties() map[string]interface{} { +func (u *UpdateTeamMemberResponse) GetExtraProperties() map[string]interface{} { return u.extraProperties } -func (u *UnlinkCustomerFromGiftCardResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UnlinkCustomerFromGiftCardResponse +func (u *UpdateTeamMemberResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpdateTeamMemberResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UnlinkCustomerFromGiftCardResponse(value) + *u = UpdateTeamMemberResponse(value) extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { @@ -52845,7 +69361,7 @@ func (u *UnlinkCustomerFromGiftCardResponse) UnmarshalJSON(data []byte) error { return nil } -func (u *UnlinkCustomerFromGiftCardResponse) String() string { +func (u *UpdateTeamMemberResponse) String() string { if len(u._rawJSON) > 0 { if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value @@ -52857,29 +69373,78 @@ func (u *UnlinkCustomerFromGiftCardResponse) String() string { return fmt.Sprintf("%#v", u) } -// Represents an [UpdateBookingCustomAttributeDefinition]($e/BookingCustomAttributes/UpdateBookingCustomAttributeDefinition) response. -// Either `custom_attribute_definition` or `errors` is present in the response. -type UpdateBookingCustomAttributeDefinitionResponse struct { - // The updated custom attribute definition. - CustomAttributeDefinition *CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"custom_attribute_definition,omitempty"` - // Any errors that occurred during the request. +// Represents an input to a call to [UpdateVendor](api-endpoint:Vendors-UpdateVendor). +type UpdateVendorRequest 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,omitempty" url:"idempotency_key,omitempty"` + // The specified [Vendor](entity:Vendor) to be updated. + Vendor *Vendor `json:"vendor,omitempty" url:"vendor,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (u *UpdateVendorRequest) GetExtraProperties() map[string]interface{} { + return u.extraProperties +} + +func (u *UpdateVendorRequest) UnmarshalJSON(data []byte) error { + type unmarshaler UpdateVendorRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UpdateVendorRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *u) + if err != nil { + return err + } + u.extraProperties = extraProperties + + u._rawJSON = json.RawMessage(data) + return nil +} + +func (u *UpdateVendorRequest) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) +} + +// Represents an output from a call to [UpdateVendor](api-endpoint:Vendors-UpdateVendor). +type UpdateVendorResponse struct { + // Errors occurred when the request fails. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The [Vendor](entity:Vendor) that has been updated. + Vendor *Vendor `json:"vendor,omitempty" url:"vendor,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpdateBookingCustomAttributeDefinitionResponse) GetExtraProperties() map[string]interface{} { +func (u *UpdateVendorResponse) GetExtraProperties() map[string]interface{} { return u.extraProperties } -func (u *UpdateBookingCustomAttributeDefinitionResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpdateBookingCustomAttributeDefinitionResponse +func (u *UpdateVendorResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpdateVendorResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpdateBookingCustomAttributeDefinitionResponse(value) + *u = UpdateVendorResponse(value) extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { @@ -52891,7 +69456,7 @@ func (u *UpdateBookingCustomAttributeDefinitionResponse) UnmarshalJSON(data []by return nil } -func (u *UpdateBookingCustomAttributeDefinitionResponse) String() string { +func (u *UpdateVendorResponse) String() string { if len(u._rawJSON) > 0 { if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value @@ -52903,27 +69468,29 @@ func (u *UpdateBookingCustomAttributeDefinitionResponse) String() string { return fmt.Sprintf("%#v", u) } -type UpdateBookingResponse struct { - // The booking that was updated. - Booking *Booking `json:"booking,omitempty" url:"booking,omitempty"` - // Errors that occurred during the request. +// Represents a response from an update request containing the updated `WageSetting` object +// or error messages. +type UpdateWageSettingResponse struct { + // The successfully updated `WageSetting` object. + WageSetting *WageSetting `json:"wage_setting,omitempty" url:"wage_setting,omitempty"` + // The errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpdateBookingResponse) GetExtraProperties() map[string]interface{} { +func (u *UpdateWageSettingResponse) GetExtraProperties() map[string]interface{} { return u.extraProperties } -func (u *UpdateBookingResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpdateBookingResponse +func (u *UpdateWageSettingResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpdateWageSettingResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpdateBookingResponse(value) + *u = UpdateWageSettingResponse(value) extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { @@ -52935,7 +69502,7 @@ func (u *UpdateBookingResponse) UnmarshalJSON(data []byte) error { return nil } -func (u *UpdateBookingResponse) String() string { +func (u *UpdateWageSettingResponse) String() string { if len(u._rawJSON) > 0 { if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value @@ -52947,30 +69514,32 @@ func (u *UpdateBookingResponse) String() string { return fmt.Sprintf("%#v", u) } -// A response to a request to update a `BreakType`. The response contains -// the requested `BreakType` objects and might contain a set of `Error` objects if -// the request resulted in errors. -type UpdateBreakTypeResponse struct { - // The response object. - BreakType *BreakType `json:"break_type,omitempty" url:"break_type,omitempty"` - // Any errors that occurred during the request. +// Defines the fields that are included in the response body of +// a request to the [UpdateWebhookSubscription](api-endpoint:WebhookSubscriptions-UpdateWebhookSubscription) endpoint. +// +// Note: If there are errors processing the request, the [Subscription](entity:WebhookSubscription) is not +// present. +type UpdateWebhookSubscriptionResponse struct { + // Information on errors encountered during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The updated [Subscription](entity:WebhookSubscription). + Subscription *WebhookSubscription `json:"subscription,omitempty" url:"subscription,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpdateBreakTypeResponse) GetExtraProperties() map[string]interface{} { +func (u *UpdateWebhookSubscriptionResponse) GetExtraProperties() map[string]interface{} { return u.extraProperties } -func (u *UpdateBreakTypeResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpdateBreakTypeResponse +func (u *UpdateWebhookSubscriptionResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpdateWebhookSubscriptionResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpdateBreakTypeResponse(value) + *u = UpdateWebhookSubscriptionResponse(value) extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { @@ -52982,7 +69551,7 @@ func (u *UpdateBreakTypeResponse) UnmarshalJSON(data []byte) error { return nil } -func (u *UpdateBreakTypeResponse) String() string { +func (u *UpdateWebhookSubscriptionResponse) String() string { if len(u._rawJSON) > 0 { if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value @@ -52994,28 +69563,32 @@ func (u *UpdateBreakTypeResponse) String() string { return fmt.Sprintf("%#v", u) } -type UpdateCatalogImageRequest struct { - // A unique string that identifies this UpdateCatalogImage request. - // Keys can be any valid string but must be unique for every UpdateCatalogImage request. - // - // See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information. - IdempotencyKey string `json:"idempotency_key" url:"idempotency_key"` +// Defines the fields that are included in the response body of +// a request to the [UpdateWebhookSubscriptionSignatureKey](api-endpoint:WebhookSubscriptions-UpdateWebhookSubscriptionSignatureKey) endpoint. +// +// Note: If there are errors processing the request, the [Subscription](entity:WebhookSubscription) is not +// present. +type UpdateWebhookSubscriptionSignatureKeyResponse struct { + // Information on errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The new Square-generated signature key used to validate the origin of the webhook event. + SignatureKey *string `json:"signature_key,omitempty" url:"signature_key,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpdateCatalogImageRequest) GetExtraProperties() map[string]interface{} { +func (u *UpdateWebhookSubscriptionSignatureKeyResponse) GetExtraProperties() map[string]interface{} { return u.extraProperties } -func (u *UpdateCatalogImageRequest) UnmarshalJSON(data []byte) error { - type unmarshaler UpdateCatalogImageRequest +func (u *UpdateWebhookSubscriptionSignatureKeyResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpdateWebhookSubscriptionSignatureKeyResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpdateCatalogImageRequest(value) + *u = UpdateWebhookSubscriptionSignatureKeyResponse(value) extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { @@ -53027,7 +69600,7 @@ func (u *UpdateCatalogImageRequest) UnmarshalJSON(data []byte) error { return nil } -func (u *UpdateCatalogImageRequest) String() string { +func (u *UpdateWebhookSubscriptionSignatureKeyResponse) String() string { if len(u._rawJSON) > 0 { if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value @@ -53039,28 +69612,30 @@ func (u *UpdateCatalogImageRequest) String() string { return fmt.Sprintf("%#v", u) } -type UpdateCatalogImageResponse struct { +// The response to a request to update a `WorkweekConfig` object. The response contains +// the updated `WorkweekConfig` object and might contain a set of `Error` objects if +// the request resulted in errors. +type UpdateWorkweekConfigResponse struct { + // The response object. + WorkweekConfig *WorkweekConfig `json:"workweek_config,omitempty" url:"workweek_config,omitempty"` // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The newly updated `CatalogImage` including a Square-generated - // URL for the encapsulated image file. - Image *CatalogObject `json:"image,omitempty" url:"image,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpdateCatalogImageResponse) GetExtraProperties() map[string]interface{} { +func (u *UpdateWorkweekConfigResponse) GetExtraProperties() map[string]interface{} { return u.extraProperties } -func (u *UpdateCatalogImageResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpdateCatalogImageResponse +func (u *UpdateWorkweekConfigResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpdateWorkweekConfigResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpdateCatalogImageResponse(value) + *u = UpdateWorkweekConfigResponse(value) extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { @@ -53072,7 +69647,7 @@ func (u *UpdateCatalogImageResponse) UnmarshalJSON(data []byte) error { return nil } -func (u *UpdateCatalogImageResponse) String() string { +func (u *UpdateWorkweekConfigResponse) String() string { if len(u._rawJSON) > 0 { if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value @@ -53084,11 +69659,11 @@ func (u *UpdateCatalogImageResponse) String() string { return fmt.Sprintf("%#v", u) } -// Represents an [UpdateCustomerCustomAttributeDefinition]($e/CustomerCustomAttributes/UpdateCustomerCustomAttributeDefinition) response. +// Represents an [UpsertBookingCustomAttribute](api-endpoint:BookingCustomAttributes-UpsertBookingCustomAttribute) response. // Either `custom_attribute_definition` or `errors` is present in the response. -type UpdateCustomerCustomAttributeDefinitionResponse struct { - // The updated custom attribute definition. - CustomAttributeDefinition *CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"custom_attribute_definition,omitempty"` +type UpsertBookingCustomAttributeResponse struct { + // The new or updated custom attribute. + CustomAttribute *CustomAttribute `json:"custom_attribute,omitempty" url:"custom_attribute,omitempty"` // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` @@ -53096,17 +69671,17 @@ type UpdateCustomerCustomAttributeDefinitionResponse struct { _rawJSON json.RawMessage } -func (u *UpdateCustomerCustomAttributeDefinitionResponse) GetExtraProperties() map[string]interface{} { +func (u *UpsertBookingCustomAttributeResponse) GetExtraProperties() map[string]interface{} { return u.extraProperties } -func (u *UpdateCustomerCustomAttributeDefinitionResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpdateCustomerCustomAttributeDefinitionResponse +func (u *UpsertBookingCustomAttributeResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpsertBookingCustomAttributeResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpdateCustomerCustomAttributeDefinitionResponse(value) + *u = UpsertBookingCustomAttributeResponse(value) extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { @@ -53118,7 +69693,7 @@ func (u *UpdateCustomerCustomAttributeDefinitionResponse) UnmarshalJSON(data []b return nil } -func (u *UpdateCustomerCustomAttributeDefinitionResponse) String() string { +func (u *UpsertBookingCustomAttributeResponse) String() string { if len(u._rawJSON) > 0 { if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value @@ -53130,31 +69705,29 @@ func (u *UpdateCustomerCustomAttributeDefinitionResponse) String() string { return fmt.Sprintf("%#v", u) } -// Defines the fields that are included in the response body of -// a request to the [UpdateCustomerGroup]($e/CustomerGroups/UpdateCustomerGroup) endpoint. -// -// Either `errors` or `group` is present in a given response (never both). -type UpdateCustomerGroupResponse struct { +type UpsertCatalogObjectResponse struct { // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The successfully updated customer group. - Group *CustomerGroup `json:"group,omitempty" url:"group,omitempty"` + // The successfully created or updated CatalogObject. + CatalogObject *CatalogObject `json:"catalog_object,omitempty" url:"catalog_object,omitempty"` + // The mapping between client and server IDs for this upsert. + IDMappings []*CatalogIDMapping `json:"id_mappings,omitempty" url:"id_mappings,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpdateCustomerGroupResponse) GetExtraProperties() map[string]interface{} { +func (u *UpsertCatalogObjectResponse) GetExtraProperties() map[string]interface{} { return u.extraProperties } -func (u *UpdateCustomerGroupResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpdateCustomerGroupResponse +func (u *UpsertCatalogObjectResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpsertCatalogObjectResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpdateCustomerGroupResponse(value) + *u = UpsertCatalogObjectResponse(value) extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { @@ -53166,7 +69739,7 @@ func (u *UpdateCustomerGroupResponse) UnmarshalJSON(data []byte) error { return nil } -func (u *UpdateCustomerGroupResponse) String() string { +func (u *UpsertCatalogObjectResponse) String() string { if len(u._rawJSON) > 0 { if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value @@ -53178,32 +69751,29 @@ func (u *UpdateCustomerGroupResponse) String() string { return fmt.Sprintf("%#v", u) } -// Defines the fields that are included in the response body of -// a request to the [UpdateCustomer]($e/Customers/UpdateCustomer) or -// [BulkUpdateCustomers]($e/Customers/BulkUpdateCustomers) endpoint. -// -// Either `errors` or `customer` is present in a given response (never both). -type UpdateCustomerResponse struct { +// Represents an [UpsertCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-UpsertCustomerCustomAttribute) response. +// Either `custom_attribute_definition` or `errors` is present in the response. +type UpsertCustomerCustomAttributeResponse struct { + // The new or updated custom attribute. + CustomAttribute *CustomAttribute `json:"custom_attribute,omitempty" url:"custom_attribute,omitempty"` // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The updated customer. - Customer *Customer `json:"customer,omitempty" url:"customer,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpdateCustomerResponse) GetExtraProperties() map[string]interface{} { +func (u *UpsertCustomerCustomAttributeResponse) GetExtraProperties() map[string]interface{} { return u.extraProperties } -func (u *UpdateCustomerResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpdateCustomerResponse +func (u *UpsertCustomerCustomAttributeResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpsertCustomerCustomAttributeResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpdateCustomerResponse(value) + *u = UpsertCustomerCustomAttributeResponse(value) extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { @@ -53215,7 +69785,7 @@ func (u *UpdateCustomerResponse) UnmarshalJSON(data []byte) error { return nil } -func (u *UpdateCustomerResponse) String() string { +func (u *UpsertCustomerCustomAttributeResponse) String() string { if len(u._rawJSON) > 0 { if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value @@ -53227,28 +69797,29 @@ func (u *UpdateCustomerResponse) String() string { return fmt.Sprintf("%#v", u) } -// Describes a `UpdateInvoice` response. -type UpdateInvoiceResponse struct { - // The updated invoice. - Invoice *Invoice `json:"invoice,omitempty" url:"invoice,omitempty"` - // Information about errors encountered during the request. +// Represents an [UpsertLocationCustomAttribute](api-endpoint:LocationCustomAttributes-UpsertLocationCustomAttribute) response. +// Either `custom_attribute_definition` or `errors` is present in the response. +type UpsertLocationCustomAttributeResponse struct { + // The new or updated custom attribute. + CustomAttribute *CustomAttribute `json:"custom_attribute,omitempty" url:"custom_attribute,omitempty"` + // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpdateInvoiceResponse) GetExtraProperties() map[string]interface{} { +func (u *UpsertLocationCustomAttributeResponse) GetExtraProperties() map[string]interface{} { return u.extraProperties } -func (u *UpdateInvoiceResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpdateInvoiceResponse +func (u *UpsertLocationCustomAttributeResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpsertLocationCustomAttributeResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpdateInvoiceResponse(value) + *u = UpsertLocationCustomAttributeResponse(value) extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { @@ -53260,7 +69831,7 @@ func (u *UpdateInvoiceResponse) UnmarshalJSON(data []byte) error { return nil } -func (u *UpdateInvoiceResponse) String() string { +func (u *UpsertLocationCustomAttributeResponse) String() string { if len(u._rawJSON) > 0 { if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value @@ -53272,27 +69843,29 @@ func (u *UpdateInvoiceResponse) String() string { return fmt.Sprintf("%#v", u) } -type UpdateItemModifierListsResponse struct { +// Represents an [UpsertMerchantCustomAttribute](api-endpoint:MerchantCustomAttributes-UpsertMerchantCustomAttribute) response. +// Either `custom_attribute_definition` or `errors` is present in the response. +type UpsertMerchantCustomAttributeResponse struct { + // The new or updated custom attribute. + CustomAttribute *CustomAttribute `json:"custom_attribute,omitempty" url:"custom_attribute,omitempty"` // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The database [timestamp](https://developer.squareup.com/docs/build-basics/common-data-types/working-with-dates) of this update in RFC 3339 format, e.g., `2016-09-04T23:59:33.123Z`. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpdateItemModifierListsResponse) GetExtraProperties() map[string]interface{} { +func (u *UpsertMerchantCustomAttributeResponse) GetExtraProperties() map[string]interface{} { return u.extraProperties } -func (u *UpdateItemModifierListsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpdateItemModifierListsResponse +func (u *UpsertMerchantCustomAttributeResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpsertMerchantCustomAttributeResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpdateItemModifierListsResponse(value) + *u = UpsertMerchantCustomAttributeResponse(value) extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { @@ -53304,7 +69877,7 @@ func (u *UpdateItemModifierListsResponse) UnmarshalJSON(data []byte) error { return nil } -func (u *UpdateItemModifierListsResponse) String() string { +func (u *UpsertMerchantCustomAttributeResponse) String() string { if len(u._rawJSON) > 0 { if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value @@ -53316,27 +69889,28 @@ func (u *UpdateItemModifierListsResponse) String() string { return fmt.Sprintf("%#v", u) } -type UpdateItemTaxesResponse struct { +// Represents a response from upserting order custom attribute definitions. +type UpsertOrderCustomAttributeResponse struct { + // The order custom attribute that was created or modified. + CustomAttribute *CustomAttribute `json:"custom_attribute,omitempty" url:"custom_attribute,omitempty"` // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The database [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) of this update in RFC 3339 format, e.g., `2016-09-04T23:59:33.123Z`. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpdateItemTaxesResponse) GetExtraProperties() map[string]interface{} { +func (u *UpsertOrderCustomAttributeResponse) GetExtraProperties() map[string]interface{} { return u.extraProperties } -func (u *UpdateItemTaxesResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpdateItemTaxesResponse +func (u *UpsertOrderCustomAttributeResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpsertOrderCustomAttributeResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpdateItemTaxesResponse(value) + *u = UpsertOrderCustomAttributeResponse(value) extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { @@ -53348,7 +69922,7 @@ func (u *UpdateItemTaxesResponse) UnmarshalJSON(data []byte) error { return nil } -func (u *UpdateItemTaxesResponse) String() string { +func (u *UpsertOrderCustomAttributeResponse) String() string { if len(u._rawJSON) > 0 { if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value @@ -53360,29 +69934,28 @@ func (u *UpdateItemTaxesResponse) String() string { return fmt.Sprintf("%#v", u) } -// Represents an [UpdateLocationCustomAttributeDefinition]($e/LocationCustomAttributes/UpdateLocationCustomAttributeDefinition) response. -// Either `custom_attribute_definition` or `errors` is present in the response. -type UpdateLocationCustomAttributeDefinitionResponse struct { - // The updated custom attribute definition. - CustomAttributeDefinition *CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"custom_attribute_definition,omitempty"` +// Represents an `UpsertSnippet` response. The response can include either `snippet` or `errors`. +type UpsertSnippetResponse struct { // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The new or updated snippet. + Snippet *Snippet `json:"snippet,omitempty" url:"snippet,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpdateLocationCustomAttributeDefinitionResponse) GetExtraProperties() map[string]interface{} { +func (u *UpsertSnippetResponse) GetExtraProperties() map[string]interface{} { return u.extraProperties } -func (u *UpdateLocationCustomAttributeDefinitionResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpdateLocationCustomAttributeDefinitionResponse +func (u *UpsertSnippetResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpsertSnippetResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpdateLocationCustomAttributeDefinitionResponse(value) + *u = UpsertSnippetResponse(value) extraProperties, err := core.ExtractExtraProperties(data, *u) if err != nil { @@ -53394,7 +69967,7 @@ func (u *UpdateLocationCustomAttributeDefinitionResponse) UnmarshalJSON(data []b return nil } -func (u *UpdateLocationCustomAttributeDefinitionResponse) String() string { +func (u *UpsertSnippetResponse) String() string { if len(u._rawJSON) > 0 { if value, err := core.StringifyJSON(u._rawJSON); err == nil { return value @@ -53406,1174 +69979,1632 @@ func (u *UpdateLocationCustomAttributeDefinitionResponse) String() string { return fmt.Sprintf("%#v", u) } -// The response object returned by the [UpdateLocation]($e/Locations/UpdateLocation) endpoint. -type UpdateLocationResponse struct { - // Information about errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The updated `Location` object. - Location *Location `json:"location,omitempty" url:"location,omitempty"` +type V1CreateRefundRequestType string + +const ( + V1CreateRefundRequestTypeFull V1CreateRefundRequestType = "FULL" + V1CreateRefundRequestTypePartial V1CreateRefundRequestType = "PARTIAL" +) + +func NewV1CreateRefundRequestTypeFromString(s string) (V1CreateRefundRequestType, error) { + switch s { + case "FULL": + return V1CreateRefundRequestTypeFull, nil + case "PARTIAL": + return V1CreateRefundRequestTypePartial, nil + } + var t V1CreateRefundRequestType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (v V1CreateRefundRequestType) Ptr() *V1CreateRefundRequestType { + return &v +} + +type V1Device struct { + // The device's Square-issued ID. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The device's merchant-specified name. + Name *string `json:"name,omitempty" url:"name,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpdateLocationResponse) GetExtraProperties() map[string]interface{} { - return u.extraProperties +func (v *V1Device) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (u *UpdateLocationResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpdateLocationResponse +func (v *V1Device) UnmarshalJSON(data []byte) error { + type unmarshaler V1Device var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpdateLocationResponse(value) + *v = V1Device(value) - extraProperties, err := core.ExtractExtraProperties(data, *u) + extraProperties, err := core.ExtractExtraProperties(data, *v) if err != nil { return err } - u.extraProperties = extraProperties + v.extraProperties = extraProperties - u._rawJSON = json.RawMessage(data) + v._rawJSON = json.RawMessage(data) return nil } -func (u *UpdateLocationResponse) String() string { - if len(u._rawJSON) > 0 { - if value, err := core.StringifyJSON(u._rawJSON); err == nil { +func (v *V1Device) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(u); err == nil { + if value, err := core.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", u) + return fmt.Sprintf("%#v", v) } -type UpdateLocationSettingsResponse struct { - // Any errors that occurred when updating the location settings. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The updated location settings. - LocationSettings *CheckoutLocationSettings `json:"location_settings,omitempty" url:"location_settings,omitempty"` - +type V1GetPaymentRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpdateLocationSettingsResponse) GetExtraProperties() map[string]interface{} { - return u.extraProperties +func (v *V1GetPaymentRequest) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (u *UpdateLocationSettingsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpdateLocationSettingsResponse +func (v *V1GetPaymentRequest) UnmarshalJSON(data []byte) error { + type unmarshaler V1GetPaymentRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpdateLocationSettingsResponse(value) + *v = V1GetPaymentRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *u) + extraProperties, err := core.ExtractExtraProperties(data, *v) if err != nil { return err } - u.extraProperties = extraProperties + v.extraProperties = extraProperties - u._rawJSON = json.RawMessage(data) + v._rawJSON = json.RawMessage(data) return nil } -func (u *UpdateLocationSettingsResponse) String() string { - if len(u._rawJSON) > 0 { - if value, err := core.StringifyJSON(u._rawJSON); err == nil { +func (v *V1GetPaymentRequest) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(u); err == nil { + if value, err := core.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", u) + return fmt.Sprintf("%#v", v) } -// Represents an [UpdateMerchantCustomAttributeDefinition]($e/MerchantCustomAttributes/UpdateMerchantCustomAttributeDefinition) response. -// Either `custom_attribute_definition` or `errors` is present in the response. -type UpdateMerchantCustomAttributeDefinitionResponse struct { - // The updated custom attribute definition. - CustomAttributeDefinition *CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"custom_attribute_definition,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - +type V1GetSettlementRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpdateMerchantCustomAttributeDefinitionResponse) GetExtraProperties() map[string]interface{} { - return u.extraProperties +func (v *V1GetSettlementRequest) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (u *UpdateMerchantCustomAttributeDefinitionResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpdateMerchantCustomAttributeDefinitionResponse +func (v *V1GetSettlementRequest) UnmarshalJSON(data []byte) error { + type unmarshaler V1GetSettlementRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpdateMerchantCustomAttributeDefinitionResponse(value) + *v = V1GetSettlementRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *u) + extraProperties, err := core.ExtractExtraProperties(data, *v) if err != nil { return err } - u.extraProperties = extraProperties + v.extraProperties = extraProperties - u._rawJSON = json.RawMessage(data) + v._rawJSON = json.RawMessage(data) return nil } -func (u *UpdateMerchantCustomAttributeDefinitionResponse) String() string { - if len(u._rawJSON) > 0 { - if value, err := core.StringifyJSON(u._rawJSON); err == nil { +func (v *V1GetSettlementRequest) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(u); err == nil { + if value, err := core.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", u) + return fmt.Sprintf("%#v", v) } -type UpdateMerchantSettingsResponse struct { - // Any errors that occurred when updating the merchant settings. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The updated merchant settings. - MerchantSettings *CheckoutMerchantSettings `json:"merchant_settings,omitempty" url:"merchant_settings,omitempty"` +// Published when the inventory quantity for a catalog item is updated. +type V1InventoryUpdatedWebhook struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The ID of the target merchant associated with the event. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The type of event this represents, i.e. `INVENTORY_UPDATED`. + EventType *string `json:"event_type,omitempty" url:"event_type,omitempty"` + // The ID of the V1 Item whose inventory was updated. + EntityID *string `json:"entity_id,omitempty" url:"entity_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpdateMerchantSettingsResponse) GetExtraProperties() map[string]interface{} { - return u.extraProperties +func (v *V1InventoryUpdatedWebhook) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (u *UpdateMerchantSettingsResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpdateMerchantSettingsResponse +func (v *V1InventoryUpdatedWebhook) UnmarshalJSON(data []byte) error { + type unmarshaler V1InventoryUpdatedWebhook var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpdateMerchantSettingsResponse(value) + *v = V1InventoryUpdatedWebhook(value) - extraProperties, err := core.ExtractExtraProperties(data, *u) + extraProperties, err := core.ExtractExtraProperties(data, *v) if err != nil { return err } - u.extraProperties = extraProperties + v.extraProperties = extraProperties - u._rawJSON = json.RawMessage(data) + v._rawJSON = json.RawMessage(data) return nil } -func (u *UpdateMerchantSettingsResponse) String() string { - if len(u._rawJSON) > 0 { - if value, err := core.StringifyJSON(u._rawJSON); err == nil { +func (v *V1InventoryUpdatedWebhook) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(u); err == nil { + if value, err := core.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", u) + return fmt.Sprintf("%#v", v) } -// Represents a response from updating an order custom attribute definition. -type UpdateOrderCustomAttributeDefinitionResponse struct { - // The updated order custom attribute definition. - CustomAttributeDefinition *CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"custom_attribute_definition,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - +type V1ListLocationsRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpdateOrderCustomAttributeDefinitionResponse) GetExtraProperties() map[string]interface{} { - return u.extraProperties +func (v *V1ListLocationsRequest) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (u *UpdateOrderCustomAttributeDefinitionResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpdateOrderCustomAttributeDefinitionResponse +func (v *V1ListLocationsRequest) UnmarshalJSON(data []byte) error { + type unmarshaler V1ListLocationsRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpdateOrderCustomAttributeDefinitionResponse(value) + *v = V1ListLocationsRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *u) + extraProperties, err := core.ExtractExtraProperties(data, *v) if err != nil { return err } - u.extraProperties = extraProperties + v.extraProperties = extraProperties - u._rawJSON = json.RawMessage(data) + v._rawJSON = json.RawMessage(data) return nil } -func (u *UpdateOrderCustomAttributeDefinitionResponse) String() string { - if len(u._rawJSON) > 0 { - if value, err := core.StringifyJSON(u._rawJSON); err == nil { +func (v *V1ListLocationsRequest) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(u); err == nil { + if value, err := core.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", u) + return fmt.Sprintf("%#v", v) } -// Defines the fields that are included in the response body of -// a request to the [UpdateOrder]($e/Orders/UpdateOrder) endpoint. -type UpdateOrderResponse struct { - // The updated order. - Order *Order `json:"order,omitempty" url:"order,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +type V1ListLocationsResponse struct { + Items []*V1Merchant `json:"items,omitempty" url:"items,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpdateOrderResponse) GetExtraProperties() map[string]interface{} { - return u.extraProperties +func (v *V1ListLocationsResponse) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (u *UpdateOrderResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpdateOrderResponse +func (v *V1ListLocationsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler V1ListLocationsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpdateOrderResponse(value) + *v = V1ListLocationsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *u) + extraProperties, err := core.ExtractExtraProperties(data, *v) if err != nil { return err } - u.extraProperties = extraProperties + v.extraProperties = extraProperties - u._rawJSON = json.RawMessage(data) + v._rawJSON = json.RawMessage(data) return nil } -func (u *UpdateOrderResponse) String() string { - if len(u._rawJSON) > 0 { - if value, err := core.StringifyJSON(u._rawJSON); err == nil { +func (v *V1ListLocationsResponse) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(u); err == nil { + if value, err := core.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", u) + return fmt.Sprintf("%#v", v) } -type UpdatePaymentLinkResponse struct { - // Any errors that occurred when updating the payment link. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The updated payment link. - PaymentLink *PaymentLink `json:"payment_link,omitempty" url:"payment_link,omitempty"` +type V1ListPaymentsRequest struct { + // The order in which payments are listed in the response. + // See [SortOrder](#type-sortorder) for possible values + Order *SortOrder `json:"order,omitempty" url:"order,omitempty"` + // The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year. + BeginTime *string `json:"begin_time,omitempty" url:"begin_time,omitempty"` + // The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time. + EndTime *string `json:"end_time,omitempty" url:"end_time,omitempty"` + // The maximum number of payments to return in a single response. This value cannot exceed 200. + Limit *int `json:"limit,omitempty" url:"limit,omitempty"` + // A pagination cursor to retrieve the next set of results for your + // original query to the endpoint. + BatchToken *string `json:"batch_token,omitempty" url:"batch_token,omitempty"` + // Indicates whether or not to include partial payments in the response. Partial payments will have the tenders collected so far, but the itemizations will be empty until the payment is completed. + IncludePartial *bool `json:"include_partial,omitempty" url:"include_partial,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpdatePaymentLinkResponse) GetExtraProperties() map[string]interface{} { - return u.extraProperties +func (v *V1ListPaymentsRequest) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (u *UpdatePaymentLinkResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpdatePaymentLinkResponse +func (v *V1ListPaymentsRequest) UnmarshalJSON(data []byte) error { + type unmarshaler V1ListPaymentsRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpdatePaymentLinkResponse(value) + *v = V1ListPaymentsRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *u) + extraProperties, err := core.ExtractExtraProperties(data, *v) if err != nil { return err } - u.extraProperties = extraProperties + v.extraProperties = extraProperties - u._rawJSON = json.RawMessage(data) + v._rawJSON = json.RawMessage(data) return nil } -func (u *UpdatePaymentLinkResponse) String() string { - if len(u._rawJSON) > 0 { - if value, err := core.StringifyJSON(u._rawJSON); err == nil { +func (v *V1ListPaymentsRequest) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(u); err == nil { + if value, err := core.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", u) + return fmt.Sprintf("%#v", v) } -// Defines the response returned by -// [UpdatePayment]($e/Payments/UpdatePayment). -type UpdatePaymentResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The updated payment. - Payment *Payment `json:"payment,omitempty" url:"payment,omitempty"` +type V1ListPaymentsResponse struct { + Items []*V1Payment `json:"items,omitempty" url:"items,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpdatePaymentResponse) GetExtraProperties() map[string]interface{} { - return u.extraProperties +func (v *V1ListPaymentsResponse) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (u *UpdatePaymentResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpdatePaymentResponse +func (v *V1ListPaymentsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler V1ListPaymentsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpdatePaymentResponse(value) + *v = V1ListPaymentsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *u) + extraProperties, err := core.ExtractExtraProperties(data, *v) if err != nil { return err } - u.extraProperties = extraProperties + v.extraProperties = extraProperties - u._rawJSON = json.RawMessage(data) + v._rawJSON = json.RawMessage(data) return nil } -func (u *UpdatePaymentResponse) String() string { - if len(u._rawJSON) > 0 { - if value, err := core.StringifyJSON(u._rawJSON); err == nil { +func (v *V1ListPaymentsResponse) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(u); err == nil { + if value, err := core.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", u) + return fmt.Sprintf("%#v", v) } -// The response to a request to update a `Shift`. The response contains -// the updated `Shift` object and might contain a set of `Error` objects if -// the request resulted in errors. -type UpdateShiftResponse struct { - // The updated `Shift`. - Shift *Shift `json:"shift,omitempty" url:"shift,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +type V1ListRefundsRequest struct { + // The order in which payments are listed in the response. + // See [SortOrder](#type-sortorder) for possible values + Order *SortOrder `json:"order,omitempty" url:"order,omitempty"` + // The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year. + BeginTime *string `json:"begin_time,omitempty" url:"begin_time,omitempty"` + // The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time. + EndTime *string `json:"end_time,omitempty" url:"end_time,omitempty"` + // The approximate number of refunds to return in a single response. Default: 100. Max: 200. Response may contain more results than the prescribed limit when refunds are made simultaneously to multiple tenders in a payment or when refunds are generated in an exchange to account for the value of returned goods. + Limit *int `json:"limit,omitempty" url:"limit,omitempty"` + // A pagination cursor to retrieve the next set of results for your + // original query to the endpoint. + BatchToken *string `json:"batch_token,omitempty" url:"batch_token,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpdateShiftResponse) GetExtraProperties() map[string]interface{} { - return u.extraProperties +func (v *V1ListRefundsRequest) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (u *UpdateShiftResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpdateShiftResponse +func (v *V1ListRefundsRequest) UnmarshalJSON(data []byte) error { + type unmarshaler V1ListRefundsRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpdateShiftResponse(value) + *v = V1ListRefundsRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *u) + extraProperties, err := core.ExtractExtraProperties(data, *v) if err != nil { return err } - u.extraProperties = extraProperties + v.extraProperties = extraProperties - u._rawJSON = json.RawMessage(data) + v._rawJSON = json.RawMessage(data) return nil } - -func (u *UpdateShiftResponse) String() string { - if len(u._rawJSON) > 0 { - if value, err := core.StringifyJSON(u._rawJSON); err == nil { + +func (v *V1ListRefundsRequest) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(u); err == nil { + if value, err := core.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", u) + return fmt.Sprintf("%#v", v) } -// Defines output parameters in a response from the -// [UpdateSubscription]($e/Subscriptions/UpdateSubscription) endpoint. -type UpdateSubscriptionResponse struct { - // Errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The updated subscription. - Subscription *Subscription `json:"subscription,omitempty" url:"subscription,omitempty"` +type V1ListRefundsResponse struct { + Items []*V1Refund `json:"items,omitempty" url:"items,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpdateSubscriptionResponse) GetExtraProperties() map[string]interface{} { - return u.extraProperties +func (v *V1ListRefundsResponse) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (u *UpdateSubscriptionResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpdateSubscriptionResponse +func (v *V1ListRefundsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler V1ListRefundsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpdateSubscriptionResponse(value) + *v = V1ListRefundsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *u) + extraProperties, err := core.ExtractExtraProperties(data, *v) if err != nil { return err } - u.extraProperties = extraProperties + v.extraProperties = extraProperties - u._rawJSON = json.RawMessage(data) + v._rawJSON = json.RawMessage(data) return nil } -func (u *UpdateSubscriptionResponse) String() string { - if len(u._rawJSON) > 0 { - if value, err := core.StringifyJSON(u._rawJSON); err == nil { +func (v *V1ListRefundsResponse) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(u); err == nil { + if value, err := core.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", u) + return fmt.Sprintf("%#v", v) } -// Represents an update request for a `TeamMember` object. -type UpdateTeamMemberRequest struct { - // The data used to update the `TeamMember` object. - TeamMember *TeamMember `json:"team_member,omitempty" url:"team_member,omitempty"` +type V1ListSettlementsRequest struct { + // The order in which settlements are listed in the response. + // See [SortOrder](#type-sortorder) for possible values + Order *SortOrder `json:"order,omitempty" url:"order,omitempty"` + // The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year. + BeginTime *string `json:"begin_time,omitempty" url:"begin_time,omitempty"` + // The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time. + EndTime *string `json:"end_time,omitempty" url:"end_time,omitempty"` + // The maximum number of settlements to return in a single response. This value cannot exceed 200. + Limit *int `json:"limit,omitempty" url:"limit,omitempty"` + // Provide this parameter to retrieve only settlements with a particular status (SENT or FAILED). + // See [V1ListSettlementsRequestStatus](#type-v1listsettlementsrequeststatus) for possible values + Status *V1ListSettlementsRequestStatus `json:"status,omitempty" url:"status,omitempty"` + // A pagination cursor to retrieve the next set of results for your + // original query to the endpoint. + BatchToken *string `json:"batch_token,omitempty" url:"batch_token,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpdateTeamMemberRequest) GetExtraProperties() map[string]interface{} { - return u.extraProperties +func (v *V1ListSettlementsRequest) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (u *UpdateTeamMemberRequest) UnmarshalJSON(data []byte) error { - type unmarshaler UpdateTeamMemberRequest +func (v *V1ListSettlementsRequest) UnmarshalJSON(data []byte) error { + type unmarshaler V1ListSettlementsRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpdateTeamMemberRequest(value) + *v = V1ListSettlementsRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *u) + extraProperties, err := core.ExtractExtraProperties(data, *v) if err != nil { return err } - u.extraProperties = extraProperties + v.extraProperties = extraProperties - u._rawJSON = json.RawMessage(data) + v._rawJSON = json.RawMessage(data) return nil } -func (u *UpdateTeamMemberRequest) String() string { - if len(u._rawJSON) > 0 { - if value, err := core.StringifyJSON(u._rawJSON); err == nil { +func (v *V1ListSettlementsRequest) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(u); err == nil { + if value, err := core.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", u) + return fmt.Sprintf("%#v", v) } -// Represents a response from an update request containing the updated `TeamMember` object or error messages. -type UpdateTeamMemberResponse struct { - // The successfully updated `TeamMember` object. - TeamMember *TeamMember `json:"team_member,omitempty" url:"team_member,omitempty"` - // The errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +type V1ListSettlementsRequestStatus string + +const ( + V1ListSettlementsRequestStatusSent V1ListSettlementsRequestStatus = "SENT" + V1ListSettlementsRequestStatusFailed V1ListSettlementsRequestStatus = "FAILED" +) + +func NewV1ListSettlementsRequestStatusFromString(s string) (V1ListSettlementsRequestStatus, error) { + switch s { + case "SENT": + return V1ListSettlementsRequestStatusSent, nil + case "FAILED": + return V1ListSettlementsRequestStatusFailed, nil + } + var t V1ListSettlementsRequestStatus + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (v V1ListSettlementsRequestStatus) Ptr() *V1ListSettlementsRequestStatus { + return &v +} + +type V1ListSettlementsResponse struct { + Items []*V1Settlement `json:"items,omitempty" url:"items,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpdateTeamMemberResponse) GetExtraProperties() map[string]interface{} { - return u.extraProperties +func (v *V1ListSettlementsResponse) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (u *UpdateTeamMemberResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpdateTeamMemberResponse +func (v *V1ListSettlementsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler V1ListSettlementsResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpdateTeamMemberResponse(value) + *v = V1ListSettlementsResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *u) + extraProperties, err := core.ExtractExtraProperties(data, *v) if err != nil { return err } - u.extraProperties = extraProperties + v.extraProperties = extraProperties - u._rawJSON = json.RawMessage(data) + v._rawJSON = json.RawMessage(data) return nil } -func (u *UpdateTeamMemberResponse) String() string { - if len(u._rawJSON) > 0 { - if value, err := core.StringifyJSON(u._rawJSON); err == nil { +func (v *V1ListSettlementsResponse) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(u); err == nil { + if value, err := core.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", u) + return fmt.Sprintf("%#v", v) } -// Represents an input to a call to [UpdateVendor]($e/Vendors/UpdateVendor). -type UpdateVendorRequest 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,omitempty" url:"idempotency_key,omitempty"` - // The specified [Vendor](entity:Vendor) to be updated. - Vendor *Vendor `json:"vendor,omitempty" url:"vendor,omitempty"` - +// Deprecated. V1ListWebhooksRequest +type V1ListWebhooksRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpdateVendorRequest) GetExtraProperties() map[string]interface{} { - return u.extraProperties +func (v *V1ListWebhooksRequest) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (u *UpdateVendorRequest) UnmarshalJSON(data []byte) error { - type unmarshaler UpdateVendorRequest +func (v *V1ListWebhooksRequest) UnmarshalJSON(data []byte) error { + type unmarshaler V1ListWebhooksRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpdateVendorRequest(value) + *v = V1ListWebhooksRequest(value) - extraProperties, err := core.ExtractExtraProperties(data, *u) + extraProperties, err := core.ExtractExtraProperties(data, *v) if err != nil { return err } - u.extraProperties = extraProperties + v.extraProperties = extraProperties - u._rawJSON = json.RawMessage(data) + v._rawJSON = json.RawMessage(data) return nil } -func (u *UpdateVendorRequest) String() string { - if len(u._rawJSON) > 0 { - if value, err := core.StringifyJSON(u._rawJSON); err == nil { +func (v *V1ListWebhooksRequest) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(u); err == nil { + if value, err := core.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", u) + return fmt.Sprintf("%#v", v) } -// Represents an output from a call to [UpdateVendor]($e/Vendors/UpdateVendor). -type UpdateVendorResponse struct { - // Errors occurred when the request fails. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The [Vendor](entity:Vendor) that has been updated. - Vendor *Vendor `json:"vendor,omitempty" url:"vendor,omitempty"` +// Deprecated. V1ListWebhooksResponse +type V1ListWebhooksResponse struct { + // A list of webhook event enums. + // See [V1WebhooksEvents](#type-v1webhooksevents) for possible values + Events []V1WebhooksEvents `json:"events,omitempty" url:"events,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpdateVendorResponse) GetExtraProperties() map[string]interface{} { - return u.extraProperties +func (v *V1ListWebhooksResponse) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (u *UpdateVendorResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpdateVendorResponse +func (v *V1ListWebhooksResponse) UnmarshalJSON(data []byte) error { + type unmarshaler V1ListWebhooksResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpdateVendorResponse(value) + *v = V1ListWebhooksResponse(value) - extraProperties, err := core.ExtractExtraProperties(data, *u) + extraProperties, err := core.ExtractExtraProperties(data, *v) if err != nil { return err } - u.extraProperties = extraProperties + v.extraProperties = extraProperties - u._rawJSON = json.RawMessage(data) + v._rawJSON = json.RawMessage(data) return nil } -func (u *UpdateVendorResponse) String() string { - if len(u._rawJSON) > 0 { - if value, err := core.StringifyJSON(u._rawJSON); err == nil { +func (v *V1ListWebhooksResponse) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(u); err == nil { + if value, err := core.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", u) + return fmt.Sprintf("%#v", v) } -// Represents a response from an update request containing the updated `WageSetting` object -// or error messages. -type UpdateWageSettingResponse struct { - // The successfully updated `WageSetting` object. - WageSetting *WageSetting `json:"wage_setting,omitempty" url:"wage_setting,omitempty"` - // The errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Defines the fields that are included in the response body of +// a request to the **RetrieveBusiness** endpoint. +type V1Merchant struct { + // The merchant account's unique identifier. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The name associated with the merchant account. + Name *string `json:"name,omitempty" url:"name,omitempty"` + // The email address associated with the merchant account. + Email *string `json:"email,omitempty" url:"email,omitempty"` + // Indicates whether the merchant account corresponds to a single-location account (LOCATION) or a business account (BUSINESS). This value is almost always LOCATION. + // See [V1MerchantAccountType](#type-v1merchantaccounttype) for possible values + AccountType *V1MerchantAccountType `json:"account_type,omitempty" url:"account_type,omitempty"` + // Capabilities that are enabled for the merchant's Square account. Capabilities that are not listed in this array are not enabled for the account. + AccountCapabilities []string `json:"account_capabilities,omitempty" url:"account_capabilities,omitempty"` + // The country associated with the merchant account, in ISO 3166-1-alpha-2 format. + CountryCode *string `json:"country_code,omitempty" url:"country_code,omitempty"` + // The language associated with the merchant account, in BCP 47 format. + LanguageCode *string `json:"language_code,omitempty" url:"language_code,omitempty"` + // The currency associated with the merchant account, in ISO 4217 format. For example, the currency code for US dollars is USD. + CurrencyCode *string `json:"currency_code,omitempty" url:"currency_code,omitempty"` + // The name of the merchant's business. + BusinessName *string `json:"business_name,omitempty" url:"business_name,omitempty"` + // The address of the merchant's business. + BusinessAddress *Address `json:"business_address,omitempty" url:"business_address,omitempty"` + // The phone number of the merchant's business. + BusinessPhone *V1PhoneNumber `json:"business_phone,omitempty" url:"business_phone,omitempty"` + // The type of business operated by the merchant. + // See [V1MerchantBusinessType](#type-v1merchantbusinesstype) for possible values + BusinessType *V1MerchantBusinessType `json:"business_type,omitempty" url:"business_type,omitempty"` + // The merchant's shipping address. + ShippingAddress *Address `json:"shipping_address,omitempty" url:"shipping_address,omitempty"` + // Additional information for a single-location account specified by its associated business account, if it has one. + LocationDetails *V1MerchantLocationDetails `json:"location_details,omitempty" url:"location_details,omitempty"` + // The URL of the merchant's online store. + MarketURL *string `json:"market_url,omitempty" url:"market_url,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpdateWageSettingResponse) GetExtraProperties() map[string]interface{} { - return u.extraProperties +func (v *V1Merchant) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (u *UpdateWageSettingResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpdateWageSettingResponse +func (v *V1Merchant) UnmarshalJSON(data []byte) error { + type unmarshaler V1Merchant var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpdateWageSettingResponse(value) + *v = V1Merchant(value) - extraProperties, err := core.ExtractExtraProperties(data, *u) + extraProperties, err := core.ExtractExtraProperties(data, *v) if err != nil { return err } - u.extraProperties = extraProperties + v.extraProperties = extraProperties - u._rawJSON = json.RawMessage(data) + v._rawJSON = json.RawMessage(data) return nil } -func (u *UpdateWageSettingResponse) String() string { - if len(u._rawJSON) > 0 { - if value, err := core.StringifyJSON(u._rawJSON); err == nil { +func (v *V1Merchant) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(u); err == nil { + if value, err := core.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", u) + return fmt.Sprintf("%#v", v) } -// Defines the fields that are included in the response body of -// a request to the [UpdateWebhookSubscription]($e/WebhookSubscriptions/UpdateWebhookSubscription) endpoint. -// -// Note: If there are errors processing the request, the [Subscription]($m/WebhookSubscription) is not -// present. -type UpdateWebhookSubscriptionResponse struct { - // Information on errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The updated [Subscription](entity:WebhookSubscription). - Subscription *WebhookSubscription `json:"subscription,omitempty" url:"subscription,omitempty"` +type V1MerchantAccountType string + +const ( + V1MerchantAccountTypeLocation V1MerchantAccountType = "LOCATION" + V1MerchantAccountTypeBusiness V1MerchantAccountType = "BUSINESS" +) + +func NewV1MerchantAccountTypeFromString(s string) (V1MerchantAccountType, error) { + switch s { + case "LOCATION": + return V1MerchantAccountTypeLocation, nil + case "BUSINESS": + return V1MerchantAccountTypeBusiness, nil + } + var t V1MerchantAccountType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (v V1MerchantAccountType) Ptr() *V1MerchantAccountType { + return &v +} + +type V1MerchantBusinessType string + +const ( + V1MerchantBusinessTypeAccounting V1MerchantBusinessType = "ACCOUNTING" + V1MerchantBusinessTypeApparelAndAccessoryShops V1MerchantBusinessType = "APPAREL_AND_ACCESSORY_SHOPS" + V1MerchantBusinessTypeArtDealersGalleries V1MerchantBusinessType = "ART_DEALERS_GALLERIES" + V1MerchantBusinessTypeArtDesignAndPhotography V1MerchantBusinessType = "ART_DESIGN_AND_PHOTOGRAPHY" + V1MerchantBusinessTypeBarClubLounge V1MerchantBusinessType = "BAR_CLUB_LOUNGE" + V1MerchantBusinessTypeBeautyAndBarberShops V1MerchantBusinessType = "BEAUTY_AND_BARBER_SHOPS" + V1MerchantBusinessTypeBookStores V1MerchantBusinessType = "BOOK_STORES" + V1MerchantBusinessTypeBusinessServices V1MerchantBusinessType = "BUSINESS_SERVICES" + V1MerchantBusinessTypeCatering V1MerchantBusinessType = "CATERING" + V1MerchantBusinessTypeCharitableSocialServiceOrganizations V1MerchantBusinessType = "CHARITABLE_SOCIAL_SERVICE_ORGANIZATIONS" + V1MerchantBusinessTypeCharitibleOrgs V1MerchantBusinessType = "CHARITIBLE_ORGS" + V1MerchantBusinessTypeCleaningServices V1MerchantBusinessType = "CLEANING_SERVICES" + V1MerchantBusinessTypeComputerEquipmentSoftwareMaintenanceRepairServices V1MerchantBusinessType = "COMPUTER_EQUIPMENT_SOFTWARE_MAINTENANCE_REPAIR_SERVICES" + V1MerchantBusinessTypeConsultant V1MerchantBusinessType = "CONSULTANT" + V1MerchantBusinessTypeContractors V1MerchantBusinessType = "CONTRACTORS" + V1MerchantBusinessTypeDeliveryServices V1MerchantBusinessType = "DELIVERY_SERVICES" + V1MerchantBusinessTypeDentistry V1MerchantBusinessType = "DENTISTRY" + V1MerchantBusinessTypeEducation V1MerchantBusinessType = "EDUCATION" + V1MerchantBusinessTypeFoodStoresConvenienceStoresAndSpecialtyMarkets V1MerchantBusinessType = "FOOD_STORES_CONVENIENCE_STORES_AND_SPECIALTY_MARKETS" + V1MerchantBusinessTypeFoodTruckCart V1MerchantBusinessType = "FOOD_TRUCK_CART" + V1MerchantBusinessTypeFurnitureHomeAndOfficeEquipment V1MerchantBusinessType = "FURNITURE_HOME_AND_OFFICE_EQUIPMENT" + V1MerchantBusinessTypeFurnitureHomeGoods V1MerchantBusinessType = "FURNITURE_HOME_GOODS" + V1MerchantBusinessTypeHotelsAndLodging V1MerchantBusinessType = "HOTELS_AND_LODGING" + V1MerchantBusinessTypeIndividualUse V1MerchantBusinessType = "INDIVIDUAL_USE" + V1MerchantBusinessTypeJewelryAndWatches V1MerchantBusinessType = "JEWELRY_AND_WATCHES" + V1MerchantBusinessTypeLandscapingAndHorticulturalServices V1MerchantBusinessType = "LANDSCAPING_AND_HORTICULTURAL_SERVICES" + V1MerchantBusinessTypeLanguageSchools V1MerchantBusinessType = "LANGUAGE_SCHOOLS" + V1MerchantBusinessTypeLegalServices V1MerchantBusinessType = "LEGAL_SERVICES" + V1MerchantBusinessTypeMedicalPractitioners V1MerchantBusinessType = "MEDICAL_PRACTITIONERS" + V1MerchantBusinessTypeMedicalServicesAndHealthPractitioners V1MerchantBusinessType = "MEDICAL_SERVICES_AND_HEALTH_PRACTITIONERS" + V1MerchantBusinessTypeMembershipOrganizations V1MerchantBusinessType = "MEMBERSHIP_ORGANIZATIONS" + V1MerchantBusinessTypeMusicAndEntertainment V1MerchantBusinessType = "MUSIC_AND_ENTERTAINMENT" + V1MerchantBusinessTypeOther V1MerchantBusinessType = "OTHER" + V1MerchantBusinessTypeOutdoorMarkets V1MerchantBusinessType = "OUTDOOR_MARKETS" + V1MerchantBusinessTypePersonalServices V1MerchantBusinessType = "PERSONAL_SERVICES" + V1MerchantBusinessTypePoliticalOrganizations V1MerchantBusinessType = "POLITICAL_ORGANIZATIONS" + V1MerchantBusinessTypeProfessionalServices V1MerchantBusinessType = "PROFESSIONAL_SERVICES" + V1MerchantBusinessTypeRealEstate V1MerchantBusinessType = "REAL_ESTATE" + V1MerchantBusinessTypeRecreationServices V1MerchantBusinessType = "RECREATION_SERVICES" + V1MerchantBusinessTypeRepairShopsAndRelatedServices V1MerchantBusinessType = "REPAIR_SHOPS_AND_RELATED_SERVICES" + V1MerchantBusinessTypeRestaurants V1MerchantBusinessType = "RESTAURANTS" + V1MerchantBusinessTypeRetailShops V1MerchantBusinessType = "RETAIL_SHOPS" + V1MerchantBusinessTypeSchoolsAndEducationalServices V1MerchantBusinessType = "SCHOOLS_AND_EDUCATIONAL_SERVICES" + V1MerchantBusinessTypeSportingGoods V1MerchantBusinessType = "SPORTING_GOODS" + V1MerchantBusinessTypeTaxicabsAndLimousines V1MerchantBusinessType = "TAXICABS_AND_LIMOUSINES" + V1MerchantBusinessTypeTicketSales V1MerchantBusinessType = "TICKET_SALES" + V1MerchantBusinessTypeTourism V1MerchantBusinessType = "TOURISM" + V1MerchantBusinessTypeTravelTourism V1MerchantBusinessType = "TRAVEL_TOURISM" + V1MerchantBusinessTypeVeterinaryServices V1MerchantBusinessType = "VETERINARY_SERVICES" + V1MerchantBusinessTypeWebDevDesign V1MerchantBusinessType = "WEB_DEV_DESIGN" +) + +func NewV1MerchantBusinessTypeFromString(s string) (V1MerchantBusinessType, error) { + switch s { + case "ACCOUNTING": + return V1MerchantBusinessTypeAccounting, nil + case "APPAREL_AND_ACCESSORY_SHOPS": + return V1MerchantBusinessTypeApparelAndAccessoryShops, nil + case "ART_DEALERS_GALLERIES": + return V1MerchantBusinessTypeArtDealersGalleries, nil + case "ART_DESIGN_AND_PHOTOGRAPHY": + return V1MerchantBusinessTypeArtDesignAndPhotography, nil + case "BAR_CLUB_LOUNGE": + return V1MerchantBusinessTypeBarClubLounge, nil + case "BEAUTY_AND_BARBER_SHOPS": + return V1MerchantBusinessTypeBeautyAndBarberShops, nil + case "BOOK_STORES": + return V1MerchantBusinessTypeBookStores, nil + case "BUSINESS_SERVICES": + return V1MerchantBusinessTypeBusinessServices, nil + case "CATERING": + return V1MerchantBusinessTypeCatering, nil + case "CHARITABLE_SOCIAL_SERVICE_ORGANIZATIONS": + return V1MerchantBusinessTypeCharitableSocialServiceOrganizations, nil + case "CHARITIBLE_ORGS": + return V1MerchantBusinessTypeCharitibleOrgs, nil + case "CLEANING_SERVICES": + return V1MerchantBusinessTypeCleaningServices, nil + case "COMPUTER_EQUIPMENT_SOFTWARE_MAINTENANCE_REPAIR_SERVICES": + return V1MerchantBusinessTypeComputerEquipmentSoftwareMaintenanceRepairServices, nil + case "CONSULTANT": + return V1MerchantBusinessTypeConsultant, nil + case "CONTRACTORS": + return V1MerchantBusinessTypeContractors, nil + case "DELIVERY_SERVICES": + return V1MerchantBusinessTypeDeliveryServices, nil + case "DENTISTRY": + return V1MerchantBusinessTypeDentistry, nil + case "EDUCATION": + return V1MerchantBusinessTypeEducation, nil + case "FOOD_STORES_CONVENIENCE_STORES_AND_SPECIALTY_MARKETS": + return V1MerchantBusinessTypeFoodStoresConvenienceStoresAndSpecialtyMarkets, nil + case "FOOD_TRUCK_CART": + return V1MerchantBusinessTypeFoodTruckCart, nil + case "FURNITURE_HOME_AND_OFFICE_EQUIPMENT": + return V1MerchantBusinessTypeFurnitureHomeAndOfficeEquipment, nil + case "FURNITURE_HOME_GOODS": + return V1MerchantBusinessTypeFurnitureHomeGoods, nil + case "HOTELS_AND_LODGING": + return V1MerchantBusinessTypeHotelsAndLodging, nil + case "INDIVIDUAL_USE": + return V1MerchantBusinessTypeIndividualUse, nil + case "JEWELRY_AND_WATCHES": + return V1MerchantBusinessTypeJewelryAndWatches, nil + case "LANDSCAPING_AND_HORTICULTURAL_SERVICES": + return V1MerchantBusinessTypeLandscapingAndHorticulturalServices, nil + case "LANGUAGE_SCHOOLS": + return V1MerchantBusinessTypeLanguageSchools, nil + case "LEGAL_SERVICES": + return V1MerchantBusinessTypeLegalServices, nil + case "MEDICAL_PRACTITIONERS": + return V1MerchantBusinessTypeMedicalPractitioners, nil + case "MEDICAL_SERVICES_AND_HEALTH_PRACTITIONERS": + return V1MerchantBusinessTypeMedicalServicesAndHealthPractitioners, nil + case "MEMBERSHIP_ORGANIZATIONS": + return V1MerchantBusinessTypeMembershipOrganizations, nil + case "MUSIC_AND_ENTERTAINMENT": + return V1MerchantBusinessTypeMusicAndEntertainment, nil + case "OTHER": + return V1MerchantBusinessTypeOther, nil + case "OUTDOOR_MARKETS": + return V1MerchantBusinessTypeOutdoorMarkets, nil + case "PERSONAL_SERVICES": + return V1MerchantBusinessTypePersonalServices, nil + case "POLITICAL_ORGANIZATIONS": + return V1MerchantBusinessTypePoliticalOrganizations, nil + case "PROFESSIONAL_SERVICES": + return V1MerchantBusinessTypeProfessionalServices, nil + case "REAL_ESTATE": + return V1MerchantBusinessTypeRealEstate, nil + case "RECREATION_SERVICES": + return V1MerchantBusinessTypeRecreationServices, nil + case "REPAIR_SHOPS_AND_RELATED_SERVICES": + return V1MerchantBusinessTypeRepairShopsAndRelatedServices, nil + case "RESTAURANTS": + return V1MerchantBusinessTypeRestaurants, nil + case "RETAIL_SHOPS": + return V1MerchantBusinessTypeRetailShops, nil + case "SCHOOLS_AND_EDUCATIONAL_SERVICES": + return V1MerchantBusinessTypeSchoolsAndEducationalServices, nil + case "SPORTING_GOODS": + return V1MerchantBusinessTypeSportingGoods, nil + case "TAXICABS_AND_LIMOUSINES": + return V1MerchantBusinessTypeTaxicabsAndLimousines, nil + case "TICKET_SALES": + return V1MerchantBusinessTypeTicketSales, nil + case "TOURISM": + return V1MerchantBusinessTypeTourism, nil + case "TRAVEL_TOURISM": + return V1MerchantBusinessTypeTravelTourism, nil + case "VETERINARY_SERVICES": + return V1MerchantBusinessTypeVeterinaryServices, nil + case "WEB_DEV_DESIGN": + return V1MerchantBusinessTypeWebDevDesign, nil + } + var t V1MerchantBusinessType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (v V1MerchantBusinessType) Ptr() *V1MerchantBusinessType { + return &v +} + +// Additional information for a single-location account specified by its associated business account, if it has one. +type V1MerchantLocationDetails struct { + // The nickname assigned to the single-location account by the parent business. This value appears in the parent business's multi-location dashboard. + Nickname *string `json:"nickname,omitempty" url:"nickname,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpdateWebhookSubscriptionResponse) GetExtraProperties() map[string]interface{} { - return u.extraProperties +func (v *V1MerchantLocationDetails) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (u *UpdateWebhookSubscriptionResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpdateWebhookSubscriptionResponse +func (v *V1MerchantLocationDetails) UnmarshalJSON(data []byte) error { + type unmarshaler V1MerchantLocationDetails var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpdateWebhookSubscriptionResponse(value) + *v = V1MerchantLocationDetails(value) - extraProperties, err := core.ExtractExtraProperties(data, *u) + extraProperties, err := core.ExtractExtraProperties(data, *v) if err != nil { return err } - u.extraProperties = extraProperties + v.extraProperties = extraProperties - u._rawJSON = json.RawMessage(data) + v._rawJSON = json.RawMessage(data) return nil } -func (u *UpdateWebhookSubscriptionResponse) String() string { - if len(u._rawJSON) > 0 { - if value, err := core.StringifyJSON(u._rawJSON); err == nil { +func (v *V1MerchantLocationDetails) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(u); err == nil { + if value, err := core.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", u) + return fmt.Sprintf("%#v", v) } -// Defines the fields that are included in the response body of -// a request to the [UpdateWebhookSubscriptionSignatureKey]($e/WebhookSubscriptions/UpdateWebhookSubscriptionSignatureKey) endpoint. -// -// Note: If there are errors processing the request, the [Subscription]($m/WebhookSubscription) is not -// present. -type UpdateWebhookSubscriptionSignatureKeyResponse struct { - // Information on errors encountered during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The new Square-generated signature key used to validate the origin of the webhook event. - SignatureKey *string `json:"signature_key,omitempty" url:"signature_key,omitempty"` +type V1Money struct { + // Amount in the lowest denominated value of this Currency. E.g. in USD + // these are cents, in JPY they are Yen (which do not have a 'cent' concept). + Amount *int `json:"amount,omitempty" url:"amount,omitempty"` + // See [Currency](#type-currency) for possible values + CurrencyCode *Currency `json:"currency_code,omitempty" url:"currency_code,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpdateWebhookSubscriptionSignatureKeyResponse) GetExtraProperties() map[string]interface{} { - return u.extraProperties +func (v *V1Money) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (u *UpdateWebhookSubscriptionSignatureKeyResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpdateWebhookSubscriptionSignatureKeyResponse +func (v *V1Money) UnmarshalJSON(data []byte) error { + type unmarshaler V1Money var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpdateWebhookSubscriptionSignatureKeyResponse(value) + *v = V1Money(value) - extraProperties, err := core.ExtractExtraProperties(data, *u) + extraProperties, err := core.ExtractExtraProperties(data, *v) if err != nil { return err } - u.extraProperties = extraProperties + v.extraProperties = extraProperties - u._rawJSON = json.RawMessage(data) + v._rawJSON = json.RawMessage(data) return nil } -func (u *UpdateWebhookSubscriptionSignatureKeyResponse) String() string { - if len(u._rawJSON) > 0 { - if value, err := core.StringifyJSON(u._rawJSON); err == nil { +func (v *V1Money) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(u); err == nil { + if value, err := core.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", u) -} - -// The response to a request to update a `WorkweekConfig` object. The response contains -// the updated `WorkweekConfig` object and might contain a set of `Error` objects if -// the request resulted in errors. -type UpdateWorkweekConfigResponse struct { - // The response object. - WorkweekConfig *WorkweekConfig `json:"workweek_config,omitempty" url:"workweek_config,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage + return fmt.Sprintf("%#v", v) } -func (u *UpdateWorkweekConfigResponse) GetExtraProperties() map[string]interface{} { - return u.extraProperties +// A payment represents a paid transaction between a Square merchant and a +// customer. Payment details are usually available from Connect API endpoints +// within a few minutes after the transaction completes. +// +// Each Payment object includes several fields that end in `_money`. These fields +// describe the various amounts of money that contribute to the payment total: +// +//
    +//
  • +// Monetary values are positive if they represent an +// increase in the amount of money the merchant receives (e.g., +// tax_money, tip_money). +//
  • +//
  • +// Monetary values are negative if they represent an +// decrease in the amount of money the merchant receives (e.g., +// discount_money, refunded_money). +//
  • +//
+type V1Payment struct { + // The payment's unique identifier. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // The unique identifier of the merchant that took the payment. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The time when the payment was created, in ISO 8601 format. Reflects the time of the first payment if the object represents an incomplete partial payment, and the time of the last or complete payment otherwise. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The unique identifier of the Square account that took the payment. + CreatorID *string `json:"creator_id,omitempty" url:"creator_id,omitempty"` + // The device that took the payment. + Device *V1Device `json:"device,omitempty" url:"device,omitempty"` + // The URL of the payment's detail page in the merchant dashboard. The merchant must be signed in to the merchant dashboard to view this page. + PaymentURL *string `json:"payment_url,omitempty" url:"payment_url,omitempty"` + // The URL of the receipt for the payment. Note that for split tender + // payments, this URL corresponds to the receipt for the first tender + // listed in the payment's tender field. Each Tender object has its own + // receipt_url field you can use to get the other receipts associated with + // a split tender payment. + ReceiptURL *string `json:"receipt_url,omitempty" url:"receipt_url,omitempty"` + // The sum of all inclusive taxes associated with the payment. + InclusiveTaxMoney *V1Money `json:"inclusive_tax_money,omitempty" url:"inclusive_tax_money,omitempty"` + // The sum of all additive taxes associated with the payment. + AdditiveTaxMoney *V1Money `json:"additive_tax_money,omitempty" url:"additive_tax_money,omitempty"` + // The total of all taxes applied to the payment. This is always the sum of inclusive_tax_money and additive_tax_money. + TaxMoney *V1Money `json:"tax_money,omitempty" url:"tax_money,omitempty"` + // The total of all tips applied to the payment. + TipMoney *V1Money `json:"tip_money,omitempty" url:"tip_money,omitempty"` + // The total of all discounts applied to the payment. + DiscountMoney *V1Money `json:"discount_money,omitempty" url:"discount_money,omitempty"` + // The total of all discounts applied to the payment. + TotalCollectedMoney *V1Money `json:"total_collected_money,omitempty" url:"total_collected_money,omitempty"` + // The total of all processing fees collected by Square for the payment. + ProcessingFeeMoney *V1Money `json:"processing_fee_money,omitempty" url:"processing_fee_money,omitempty"` + // The amount to be deposited into the merchant's bank account for the payment. + NetTotalMoney *V1Money `json:"net_total_money,omitempty" url:"net_total_money,omitempty"` + // The total of all refunds applied to the payment. + RefundedMoney *V1Money `json:"refunded_money,omitempty" url:"refunded_money,omitempty"` + // The total of all sales, including any applicable taxes, rounded to the smallest legal unit of currency (e.g., the nearest penny in USD, the nearest nickel in CAD) + SwedishRoundingMoney *V1Money `json:"swedish_rounding_money,omitempty" url:"swedish_rounding_money,omitempty"` + // The total of all sales, including any applicable taxes. + GrossSalesMoney *V1Money `json:"gross_sales_money,omitempty" url:"gross_sales_money,omitempty"` + // The total of all sales, minus any applicable taxes. + NetSalesMoney *V1Money `json:"net_sales_money,omitempty" url:"net_sales_money,omitempty"` + // All of the inclusive taxes associated with the payment. + InclusiveTax []*V1PaymentTax `json:"inclusive_tax,omitempty" url:"inclusive_tax,omitempty"` + // All of the additive taxes associated with the payment. + AdditiveTax []*V1PaymentTax `json:"additive_tax,omitempty" url:"additive_tax,omitempty"` + // All of the tenders associated with the payment. + Tender []*V1Tender `json:"tender,omitempty" url:"tender,omitempty"` + // All of the refunds applied to the payment. Note that the value of all refunds on a payment can exceed the value of all tenders if a merchant chooses to refund money to a tender after previously accepting returned goods as part of an exchange. + Refunds []*V1Refund `json:"refunds,omitempty" url:"refunds,omitempty"` + // The items purchased in the payment. + Itemizations []*V1PaymentItemization `json:"itemizations,omitempty" url:"itemizations,omitempty"` + // The total of all surcharges applied to the payment. + SurchargeMoney *V1Money `json:"surcharge_money,omitempty" url:"surcharge_money,omitempty"` + // A list of all surcharges associated with the payment. + Surcharges []*V1PaymentSurcharge `json:"surcharges,omitempty" url:"surcharges,omitempty"` + // Indicates whether or not the payment is only partially paid for. + // If true, this payment will have the tenders collected so far, but the + // itemizations will be empty until the payment is completed. + IsPartial *bool `json:"is_partial,omitempty" url:"is_partial,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (v *V1Payment) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (u *UpdateWorkweekConfigResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpdateWorkweekConfigResponse +func (v *V1Payment) UnmarshalJSON(data []byte) error { + type unmarshaler V1Payment var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpdateWorkweekConfigResponse(value) + *v = V1Payment(value) - extraProperties, err := core.ExtractExtraProperties(data, *u) + extraProperties, err := core.ExtractExtraProperties(data, *v) if err != nil { return err } - u.extraProperties = extraProperties + v.extraProperties = extraProperties - u._rawJSON = json.RawMessage(data) + v._rawJSON = json.RawMessage(data) return nil } -func (u *UpdateWorkweekConfigResponse) String() string { - if len(u._rawJSON) > 0 { - if value, err := core.StringifyJSON(u._rawJSON); err == nil { +func (v *V1Payment) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(u); err == nil { + if value, err := core.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", u) + return fmt.Sprintf("%#v", v) } -// Represents an [UpsertBookingCustomAttribute]($e/BookingCustomAttributes/UpsertBookingCustomAttribute) response. -// Either `custom_attribute_definition` or `errors` is present in the response. -type UpsertBookingCustomAttributeResponse struct { - // The new or updated custom attribute. - CustomAttribute *CustomAttribute `json:"custom_attribute,omitempty" url:"custom_attribute,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// V1PaymentDiscount +type V1PaymentDiscount struct { + // The discount's name. + Name *string `json:"name,omitempty" url:"name,omitempty"` + // The amount of money that this discount adds to the payment (note that this value is always negative or zero). + AppliedMoney *V1Money `json:"applied_money,omitempty" url:"applied_money,omitempty"` + // The ID of the applied discount, if available. Discounts applied in older versions of Square Register might not have an ID. + DiscountID *string `json:"discount_id,omitempty" url:"discount_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpsertBookingCustomAttributeResponse) GetExtraProperties() map[string]interface{} { - return u.extraProperties +func (v *V1PaymentDiscount) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (u *UpsertBookingCustomAttributeResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpsertBookingCustomAttributeResponse +func (v *V1PaymentDiscount) UnmarshalJSON(data []byte) error { + type unmarshaler V1PaymentDiscount var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpsertBookingCustomAttributeResponse(value) + *v = V1PaymentDiscount(value) - extraProperties, err := core.ExtractExtraProperties(data, *u) + extraProperties, err := core.ExtractExtraProperties(data, *v) if err != nil { return err } - u.extraProperties = extraProperties + v.extraProperties = extraProperties - u._rawJSON = json.RawMessage(data) + v._rawJSON = json.RawMessage(data) return nil } -func (u *UpsertBookingCustomAttributeResponse) String() string { - if len(u._rawJSON) > 0 { - if value, err := core.StringifyJSON(u._rawJSON); err == nil { +func (v *V1PaymentDiscount) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(u); err == nil { + if value, err := core.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", u) + return fmt.Sprintf("%#v", v) } -type UpsertCatalogObjectResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The successfully created or updated CatalogObject. - CatalogObject *CatalogObject `json:"catalog_object,omitempty" url:"catalog_object,omitempty"` - // The mapping between client and server IDs for this upsert. - IDMappings []*CatalogIDMapping `json:"id_mappings,omitempty" url:"id_mappings,omitempty"` +// V1PaymentItemDetail +type V1PaymentItemDetail struct { + // The name of the item's merchant-defined category, if any. + CategoryName *string `json:"category_name,omitempty" url:"category_name,omitempty"` + // The item's merchant-defined SKU, if any. + Sku *string `json:"sku,omitempty" url:"sku,omitempty"` + // The unique ID of the item purchased, if any. + ItemID *string `json:"item_id,omitempty" url:"item_id,omitempty"` + // The unique ID of the item variation purchased, if any. + ItemVariationID *string `json:"item_variation_id,omitempty" url:"item_variation_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpsertCatalogObjectResponse) GetExtraProperties() map[string]interface{} { - return u.extraProperties +func (v *V1PaymentItemDetail) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (u *UpsertCatalogObjectResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpsertCatalogObjectResponse +func (v *V1PaymentItemDetail) UnmarshalJSON(data []byte) error { + type unmarshaler V1PaymentItemDetail var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpsertCatalogObjectResponse(value) + *v = V1PaymentItemDetail(value) - extraProperties, err := core.ExtractExtraProperties(data, *u) + extraProperties, err := core.ExtractExtraProperties(data, *v) if err != nil { return err } - u.extraProperties = extraProperties + v.extraProperties = extraProperties - u._rawJSON = json.RawMessage(data) + v._rawJSON = json.RawMessage(data) return nil } -func (u *UpsertCatalogObjectResponse) String() string { - if len(u._rawJSON) > 0 { - if value, err := core.StringifyJSON(u._rawJSON); err == nil { +func (v *V1PaymentItemDetail) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(u); err == nil { + if value, err := core.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", u) + return fmt.Sprintf("%#v", v) } -// Represents an [UpsertCustomerCustomAttribute]($e/CustomerCustomAttributes/UpsertCustomerCustomAttribute) response. -// Either `custom_attribute_definition` or `errors` is present in the response. -type UpsertCustomerCustomAttributeResponse struct { - // The new or updated custom attribute. - CustomAttribute *CustomAttribute `json:"custom_attribute,omitempty" url:"custom_attribute,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// Payment include an` itemizations` field that lists the items purchased, +// along with associated fees, modifiers, and discounts. Each itemization has an +// `itemization_type` field that indicates which of the following the itemization +// represents: +// +//
    +//
  • An item variation from the merchant's item library
  • +//
  • A custom monetary amount
  • +//
  • +// An action performed on a Square gift card, such as activating or +// reloading it. +//
  • +//
+// +// \*Note**: itemization information included in a `Payment` object reflects +// details collected **at the time of the payment\*\*. Details such as the name or +// price of items might have changed since the payment was processed. +type V1PaymentItemization struct { + // The item's name. + Name *string `json:"name,omitempty" url:"name,omitempty"` + // The quantity of the item purchased. This can be a decimal value. + Quantity *float64 `json:"quantity,omitempty" url:"quantity,omitempty"` + // The type of purchase that the itemization represents, such as an ITEM or CUSTOM_AMOUNT + // See [V1PaymentItemizationItemizationType](#type-v1paymentitemizationitemizationtype) for possible values + ItemizationType *V1PaymentItemizationItemizationType `json:"itemization_type,omitempty" url:"itemization_type,omitempty"` + // Details of the item, including its unique identifier and the identifier of the item variation purchased. + ItemDetail *V1PaymentItemDetail `json:"item_detail,omitempty" url:"item_detail,omitempty"` + // Notes entered by the merchant about the item at the time of payment, if any. + Notes *string `json:"notes,omitempty" url:"notes,omitempty"` + // The name of the item variation purchased, if any. + ItemVariationName *string `json:"item_variation_name,omitempty" url:"item_variation_name,omitempty"` + // The total cost of the item, including all taxes and discounts. + TotalMoney *V1Money `json:"total_money,omitempty" url:"total_money,omitempty"` + // The cost of a single unit of this item. + SingleQuantityMoney *V1Money `json:"single_quantity_money,omitempty" url:"single_quantity_money,omitempty"` + // The total cost of the itemization and its modifiers, not including taxes or discounts. + GrossSalesMoney *V1Money `json:"gross_sales_money,omitempty" url:"gross_sales_money,omitempty"` + // The total of all discounts applied to the itemization. This value is always negative or zero. + DiscountMoney *V1Money `json:"discount_money,omitempty" url:"discount_money,omitempty"` + // The sum of gross_sales_money and discount_money. + NetSalesMoney *V1Money `json:"net_sales_money,omitempty" url:"net_sales_money,omitempty"` + // All taxes applied to this itemization. + Taxes []*V1PaymentTax `json:"taxes,omitempty" url:"taxes,omitempty"` + // All discounts applied to this itemization. + Discounts []*V1PaymentDiscount `json:"discounts,omitempty" url:"discounts,omitempty"` + // All modifier options applied to this itemization. + Modifiers []*V1PaymentModifier `json:"modifiers,omitempty" url:"modifiers,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpsertCustomerCustomAttributeResponse) GetExtraProperties() map[string]interface{} { - return u.extraProperties +func (v *V1PaymentItemization) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (u *UpsertCustomerCustomAttributeResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpsertCustomerCustomAttributeResponse +func (v *V1PaymentItemization) UnmarshalJSON(data []byte) error { + type unmarshaler V1PaymentItemization var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpsertCustomerCustomAttributeResponse(value) + *v = V1PaymentItemization(value) - extraProperties, err := core.ExtractExtraProperties(data, *u) + extraProperties, err := core.ExtractExtraProperties(data, *v) if err != nil { return err } - u.extraProperties = extraProperties + v.extraProperties = extraProperties - u._rawJSON = json.RawMessage(data) + v._rawJSON = json.RawMessage(data) return nil } -func (u *UpsertCustomerCustomAttributeResponse) String() string { - if len(u._rawJSON) > 0 { - if value, err := core.StringifyJSON(u._rawJSON); err == nil { +func (v *V1PaymentItemization) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(u); err == nil { + if value, err := core.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", u) + return fmt.Sprintf("%#v", v) } -// Represents an [UpsertLocationCustomAttribute]($e/LocationCustomAttributes/UpsertLocationCustomAttribute) response. -// Either `custom_attribute_definition` or `errors` is present in the response. -type UpsertLocationCustomAttributeResponse struct { - // The new or updated custom attribute. - CustomAttribute *CustomAttribute `json:"custom_attribute,omitempty" url:"custom_attribute,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +type V1PaymentItemizationItemizationType string + +const ( + V1PaymentItemizationItemizationTypeItem V1PaymentItemizationItemizationType = "ITEM" + V1PaymentItemizationItemizationTypeCustomAmount V1PaymentItemizationItemizationType = "CUSTOM_AMOUNT" + V1PaymentItemizationItemizationTypeGiftCardActivation V1PaymentItemizationItemizationType = "GIFT_CARD_ACTIVATION" + V1PaymentItemizationItemizationTypeGiftCardReload V1PaymentItemizationItemizationType = "GIFT_CARD_RELOAD" + V1PaymentItemizationItemizationTypeGiftCardUnknown V1PaymentItemizationItemizationType = "GIFT_CARD_UNKNOWN" + V1PaymentItemizationItemizationTypeOther V1PaymentItemizationItemizationType = "OTHER" +) + +func NewV1PaymentItemizationItemizationTypeFromString(s string) (V1PaymentItemizationItemizationType, error) { + switch s { + case "ITEM": + return V1PaymentItemizationItemizationTypeItem, nil + case "CUSTOM_AMOUNT": + return V1PaymentItemizationItemizationTypeCustomAmount, nil + case "GIFT_CARD_ACTIVATION": + return V1PaymentItemizationItemizationTypeGiftCardActivation, nil + case "GIFT_CARD_RELOAD": + return V1PaymentItemizationItemizationTypeGiftCardReload, nil + case "GIFT_CARD_UNKNOWN": + return V1PaymentItemizationItemizationTypeGiftCardUnknown, nil + case "OTHER": + return V1PaymentItemizationItemizationTypeOther, nil + } + var t V1PaymentItemizationItemizationType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (v V1PaymentItemizationItemizationType) Ptr() *V1PaymentItemizationItemizationType { + return &v +} + +// V1PaymentModifier +type V1PaymentModifier struct { + // The modifier option's name. + Name *string `json:"name,omitempty" url:"name,omitempty"` + // The amount of money that this modifier option adds to the payment. + AppliedMoney *V1Money `json:"applied_money,omitempty" url:"applied_money,omitempty"` + // The ID of the applied modifier option, if available. Modifier options applied in older versions of Square Register might not have an ID. + ModifierOptionID *string `json:"modifier_option_id,omitempty" url:"modifier_option_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpsertLocationCustomAttributeResponse) GetExtraProperties() map[string]interface{} { - return u.extraProperties +func (v *V1PaymentModifier) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (u *UpsertLocationCustomAttributeResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpsertLocationCustomAttributeResponse +func (v *V1PaymentModifier) UnmarshalJSON(data []byte) error { + type unmarshaler V1PaymentModifier var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpsertLocationCustomAttributeResponse(value) + *v = V1PaymentModifier(value) - extraProperties, err := core.ExtractExtraProperties(data, *u) + extraProperties, err := core.ExtractExtraProperties(data, *v) if err != nil { return err } - u.extraProperties = extraProperties + v.extraProperties = extraProperties - u._rawJSON = json.RawMessage(data) + v._rawJSON = json.RawMessage(data) return nil } -func (u *UpsertLocationCustomAttributeResponse) String() string { - if len(u._rawJSON) > 0 { - if value, err := core.StringifyJSON(u._rawJSON); err == nil { +func (v *V1PaymentModifier) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(u); err == nil { + if value, err := core.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", u) + return fmt.Sprintf("%#v", v) } -// Represents an [UpsertMerchantCustomAttribute]($e/MerchantCustomAttributes/UpsertMerchantCustomAttribute) response. -// Either `custom_attribute_definition` or `errors` is present in the response. -type UpsertMerchantCustomAttributeResponse struct { - // The new or updated custom attribute. - CustomAttribute *CustomAttribute `json:"custom_attribute,omitempty" url:"custom_attribute,omitempty"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` +// V1PaymentSurcharge +type V1PaymentSurcharge struct { + // The name of the surcharge. + Name *string `json:"name,omitempty" url:"name,omitempty"` + // The amount of money applied to the order as a result of the surcharge. + AppliedMoney *V1Money `json:"applied_money,omitempty" url:"applied_money,omitempty"` + // The amount of the surcharge as a percentage. The percentage is provided as a string representing the decimal equivalent of the percentage. For example, "0.7" corresponds to a 7% surcharge. Exactly one of rate or amount_money should be set. + Rate *string `json:"rate,omitempty" url:"rate,omitempty"` + // The amount of the surcharge as a Money object. Exactly one of rate or amount_money should be set. + AmountMoney *V1Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` + // Indicates the source of the surcharge. For example, if it was applied as an automatic gratuity for a large group. + // See [V1PaymentSurchargeType](#type-v1paymentsurchargetype) for possible values + Type *V1PaymentSurchargeType `json:"type,omitempty" url:"type,omitempty"` + // Indicates whether the surcharge is taxable. + Taxable *bool `json:"taxable,omitempty" url:"taxable,omitempty"` + // The list of taxes that should be applied to the surcharge. + Taxes []*V1PaymentTax `json:"taxes,omitempty" url:"taxes,omitempty"` + // A Square-issued unique identifier associated with the surcharge. + SurchargeID *string `json:"surcharge_id,omitempty" url:"surcharge_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpsertMerchantCustomAttributeResponse) GetExtraProperties() map[string]interface{} { - return u.extraProperties +func (v *V1PaymentSurcharge) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (u *UpsertMerchantCustomAttributeResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpsertMerchantCustomAttributeResponse +func (v *V1PaymentSurcharge) UnmarshalJSON(data []byte) error { + type unmarshaler V1PaymentSurcharge var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpsertMerchantCustomAttributeResponse(value) + *v = V1PaymentSurcharge(value) - extraProperties, err := core.ExtractExtraProperties(data, *u) + extraProperties, err := core.ExtractExtraProperties(data, *v) if err != nil { return err } - u.extraProperties = extraProperties + v.extraProperties = extraProperties - u._rawJSON = json.RawMessage(data) + v._rawJSON = json.RawMessage(data) return nil } -func (u *UpsertMerchantCustomAttributeResponse) String() string { - if len(u._rawJSON) > 0 { - if value, err := core.StringifyJSON(u._rawJSON); err == nil { +func (v *V1PaymentSurcharge) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(u); err == nil { + if value, err := core.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", u) + return fmt.Sprintf("%#v", v) +} + +type V1PaymentSurchargeType string + +const ( + V1PaymentSurchargeTypeUnknown V1PaymentSurchargeType = "UNKNOWN" + V1PaymentSurchargeTypeAutoGratuity V1PaymentSurchargeType = "AUTO_GRATUITY" + V1PaymentSurchargeTypeCustom V1PaymentSurchargeType = "CUSTOM" +) + +func NewV1PaymentSurchargeTypeFromString(s string) (V1PaymentSurchargeType, error) { + switch s { + case "UNKNOWN": + return V1PaymentSurchargeTypeUnknown, nil + case "AUTO_GRATUITY": + return V1PaymentSurchargeTypeAutoGratuity, nil + case "CUSTOM": + return V1PaymentSurchargeTypeCustom, nil + } + var t V1PaymentSurchargeType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (v V1PaymentSurchargeType) Ptr() *V1PaymentSurchargeType { + return &v } -// Represents a response from upserting order custom attribute definitions. -type UpsertOrderCustomAttributeResponse struct { - // The order custom attribute that was created or modified. - CustomAttribute *CustomAttribute `json:"custom_attribute,omitempty" url:"custom_attribute,omitempty"` +// V1PaymentTax +type V1PaymentTax struct { // Any errors that occurred during the request. Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + // The merchant-defined name of the tax. + Name *string `json:"name,omitempty" url:"name,omitempty"` + // The amount of money that this tax adds to the payment. + AppliedMoney *V1Money `json:"applied_money,omitempty" url:"applied_money,omitempty"` + // The rate of the tax, as a string representation of a decimal number. A value of 0.07 corresponds to a rate of 7%. + Rate *string `json:"rate,omitempty" url:"rate,omitempty"` + // Whether the tax is an ADDITIVE tax or an INCLUSIVE tax. + // See [V1PaymentTaxInclusionType](#type-v1paymenttaxinclusiontype) for possible values + InclusionType *V1PaymentTaxInclusionType `json:"inclusion_type,omitempty" url:"inclusion_type,omitempty"` + // The ID of the tax, if available. Taxes applied in older versions of Square Register might not have an ID. + FeeID *string `json:"fee_id,omitempty" url:"fee_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpsertOrderCustomAttributeResponse) GetExtraProperties() map[string]interface{} { - return u.extraProperties +func (v *V1PaymentTax) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (u *UpsertOrderCustomAttributeResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpsertOrderCustomAttributeResponse +func (v *V1PaymentTax) UnmarshalJSON(data []byte) error { + type unmarshaler V1PaymentTax var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpsertOrderCustomAttributeResponse(value) + *v = V1PaymentTax(value) - extraProperties, err := core.ExtractExtraProperties(data, *u) + extraProperties, err := core.ExtractExtraProperties(data, *v) if err != nil { return err } - u.extraProperties = extraProperties + v.extraProperties = extraProperties - u._rawJSON = json.RawMessage(data) + v._rawJSON = json.RawMessage(data) return nil } -func (u *UpsertOrderCustomAttributeResponse) String() string { - if len(u._rawJSON) > 0 { - if value, err := core.StringifyJSON(u._rawJSON); err == nil { +func (v *V1PaymentTax) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(u); err == nil { + if value, err := core.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", u) + return fmt.Sprintf("%#v", v) } -// Represents an `UpsertSnippet` response. The response can include either `snippet` or `errors`. -type UpsertSnippetResponse struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The new or updated snippet. - Snippet *Snippet `json:"snippet,omitempty" url:"snippet,omitempty"` +type V1PaymentTaxInclusionType string + +const ( + V1PaymentTaxInclusionTypeAdditive V1PaymentTaxInclusionType = "ADDITIVE" + V1PaymentTaxInclusionTypeInclusive V1PaymentTaxInclusionType = "INCLUSIVE" +) + +func NewV1PaymentTaxInclusionTypeFromString(s string) (V1PaymentTaxInclusionType, error) { + switch s { + case "ADDITIVE": + return V1PaymentTaxInclusionTypeAdditive, nil + case "INCLUSIVE": + return V1PaymentTaxInclusionTypeInclusive, nil + } + var t V1PaymentTaxInclusionType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (v V1PaymentTaxInclusionType) Ptr() *V1PaymentTaxInclusionType { + return &v +} + +// Published when a charge is made or refunded through the Square +// Point of Sale app or the Transactions API. +type V1PaymentUpdatedWebhook struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The ID of the target merchant associated with the event. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The type of event this represents, i.e. `PAYMENT_UPDATED`. + EventType *string `json:"event_type,omitempty" url:"event_type,omitempty"` + // The ID of the updated V1 Payment. + EntityID *string `json:"entity_id,omitempty" url:"entity_id,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (u *UpsertSnippetResponse) GetExtraProperties() map[string]interface{} { - return u.extraProperties +func (v *V1PaymentUpdatedWebhook) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (u *UpsertSnippetResponse) UnmarshalJSON(data []byte) error { - type unmarshaler UpsertSnippetResponse +func (v *V1PaymentUpdatedWebhook) UnmarshalJSON(data []byte) error { + type unmarshaler V1PaymentUpdatedWebhook var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = UpsertSnippetResponse(value) + *v = V1PaymentUpdatedWebhook(value) - extraProperties, err := core.ExtractExtraProperties(data, *u) + extraProperties, err := core.ExtractExtraProperties(data, *v) if err != nil { return err } - u.extraProperties = extraProperties + v.extraProperties = extraProperties - u._rawJSON = json.RawMessage(data) + v._rawJSON = json.RawMessage(data) return nil } -func (u *UpsertSnippetResponse) String() string { - if len(u._rawJSON) > 0 { - if value, err := core.StringifyJSON(u._rawJSON); err == nil { +func (v *V1PaymentUpdatedWebhook) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(u); err == nil { + if value, err := core.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", u) + return fmt.Sprintf("%#v", v) } -type V1Device struct { - // The device's Square-issued ID. - ID *string `json:"id,omitempty" url:"id,omitempty"` - // The device's merchant-specified name. - Name *string `json:"name,omitempty" url:"name,omitempty"` +// Represents a phone number. +type V1PhoneNumber struct { + // The phone number's international calling code. For US phone numbers, this value is +1. + CallingCode string `json:"calling_code" url:"calling_code"` + // The phone number. + Number string `json:"number" url:"number"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (v *V1Device) GetExtraProperties() map[string]interface{} { +func (v *V1PhoneNumber) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *V1Device) UnmarshalJSON(data []byte) error { - type unmarshaler V1Device +func (v *V1PhoneNumber) UnmarshalJSON(data []byte) error { + type unmarshaler V1PhoneNumber var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = V1Device(value) + *v = V1PhoneNumber(value) extraProperties, err := core.ExtractExtraProperties(data, *v) if err != nil { @@ -54585,7 +71616,7 @@ func (v *V1Device) UnmarshalJSON(data []byte) error { return nil } -func (v *V1Device) String() string { +func (v *V1PhoneNumber) String() string { if len(v._rawJSON) > 0 { if value, err := core.StringifyJSON(v._rawJSON); err == nil { return value @@ -54597,28 +71628,60 @@ func (v *V1Device) String() string { return fmt.Sprintf("%#v", v) } -type V1GetPaymentRequest = interface{} - -type V1GetSettlementRequest = interface{} - -type V1ListOrdersResponse struct { - Items []*V1Order `json:"items,omitempty" url:"items,omitempty"` +// V1Refund +type V1Refund struct { + // The type of refund + // See [V1RefundType](#type-v1refundtype) for possible values + Type *V1RefundType `json:"type,omitempty" url:"type,omitempty"` + // The merchant-specified reason for the refund. + Reason *string `json:"reason,omitempty" url:"reason,omitempty"` + // The amount of money refunded. This amount is always negative. + RefundedMoney *V1Money `json:"refunded_money,omitempty" url:"refunded_money,omitempty"` + // The amount of processing fee money refunded. This amount is always positive. + RefundedProcessingFeeMoney *V1Money `json:"refunded_processing_fee_money,omitempty" url:"refunded_processing_fee_money,omitempty"` + // The total amount of tax money refunded. This amount is always negative. + RefundedTaxMoney *V1Money `json:"refunded_tax_money,omitempty" url:"refunded_tax_money,omitempty"` + // The amount of additive tax money refunded. This amount is always negative. + RefundedAdditiveTaxMoney *V1Money `json:"refunded_additive_tax_money,omitempty" url:"refunded_additive_tax_money,omitempty"` + // All of the additive taxes associated with the refund. + RefundedAdditiveTax []*V1PaymentTax `json:"refunded_additive_tax,omitempty" url:"refunded_additive_tax,omitempty"` + // The amount of inclusive tax money refunded. This amount is always negative. + RefundedInclusiveTaxMoney *V1Money `json:"refunded_inclusive_tax_money,omitempty" url:"refunded_inclusive_tax_money,omitempty"` + // All of the inclusive taxes associated with the refund. + RefundedInclusiveTax []*V1PaymentTax `json:"refunded_inclusive_tax,omitempty" url:"refunded_inclusive_tax,omitempty"` + // The amount of tip money refunded. This amount is always negative. + RefundedTipMoney *V1Money `json:"refunded_tip_money,omitempty" url:"refunded_tip_money,omitempty"` + // The amount of discount money refunded. This amount is always positive. + RefundedDiscountMoney *V1Money `json:"refunded_discount_money,omitempty" url:"refunded_discount_money,omitempty"` + // The amount of surcharge money refunded. This amount is always negative. + RefundedSurchargeMoney *V1Money `json:"refunded_surcharge_money,omitempty" url:"refunded_surcharge_money,omitempty"` + // A list of all surcharges associated with the refund. + RefundedSurcharges []*V1PaymentSurcharge `json:"refunded_surcharges,omitempty" url:"refunded_surcharges,omitempty"` + // The time when the merchant initiated the refund for Square to process, in ISO 8601 format. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The time when Square processed the refund on behalf of the merchant, in ISO 8601 format. + ProcessedAt *string `json:"processed_at,omitempty" url:"processed_at,omitempty"` + // A Square-issued ID associated with the refund. For single-tender refunds, payment_id is the ID of the original payment ID. For split-tender refunds, payment_id is the ID of the original tender. For exchange-based refunds (is_exchange == true), payment_id is the ID of the original payment ID even if the payment includes other tenders. + PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // Indicates whether or not the refund is associated with an exchange. If is_exchange is true, the refund reflects the value of goods returned in the exchange not the total money refunded. + IsExchange *bool `json:"is_exchange,omitempty" url:"is_exchange,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (v *V1ListOrdersResponse) GetExtraProperties() map[string]interface{} { +func (v *V1Refund) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *V1ListOrdersResponse) UnmarshalJSON(data []byte) error { - type unmarshaler V1ListOrdersResponse +func (v *V1Refund) UnmarshalJSON(data []byte) error { + type unmarshaler V1Refund var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = V1ListOrdersResponse(value) + *v = V1Refund(value) extraProperties, err := core.ExtractExtraProperties(data, *v) if err != nil { @@ -54630,7 +71693,7 @@ func (v *V1ListOrdersResponse) UnmarshalJSON(data []byte) error { return nil } -func (v *V1ListOrdersResponse) String() string { +func (v *V1Refund) String() string { if len(v._rawJSON) > 0 { if value, err := core.StringifyJSON(v._rawJSON); err == nil { return value @@ -54642,28 +71705,44 @@ func (v *V1ListOrdersResponse) String() string { return fmt.Sprintf("%#v", v) } -type V1Money struct { - // Amount in the lowest denominated value of this Currency. E.g. in USD - // these are cents, in JPY they are Yen (which do not have a 'cent' concept). - Amount *int `json:"amount,omitempty" url:"amount,omitempty"` - // See [Currency](#type-currency) for possible values - CurrencyCode *Currency `json:"currency_code,omitempty" url:"currency_code,omitempty"` +type V1RefundType string + +const ( + V1RefundTypeFull V1RefundType = "FULL" + V1RefundTypePartial V1RefundType = "PARTIAL" +) +func NewV1RefundTypeFromString(s string) (V1RefundType, error) { + switch s { + case "FULL": + return V1RefundTypeFull, nil + case "PARTIAL": + return V1RefundTypePartial, nil + } + var t V1RefundType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (v V1RefundType) Ptr() *V1RefundType { + return &v +} + +type V1RetrieveBusinessRequest struct { extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (v *V1Money) GetExtraProperties() map[string]interface{} { +func (v *V1RetrieveBusinessRequest) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *V1Money) UnmarshalJSON(data []byte) error { - type unmarshaler V1Money +func (v *V1RetrieveBusinessRequest) UnmarshalJSON(data []byte) error { + type unmarshaler V1RetrieveBusinessRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = V1Money(value) + *v = V1RetrieveBusinessRequest(value) extraProperties, err := core.ExtractExtraProperties(data, *v) if err != nil { @@ -54675,7 +71754,7 @@ func (v *V1Money) UnmarshalJSON(data []byte) error { return nil } -func (v *V1Money) String() string { +func (v *V1RetrieveBusinessRequest) String() string { if len(v._rawJSON) > 0 { if value, err := core.StringifyJSON(v._rawJSON); err == nil { return value @@ -54687,75 +71766,37 @@ func (v *V1Money) String() string { return fmt.Sprintf("%#v", v) } -// V1Order -type V1Order struct { - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - // The order's unique identifier. +// V1Settlement +type V1Settlement struct { + // The settlement's unique identifier. ID *string `json:"id,omitempty" url:"id,omitempty"` - // The email address of the order's buyer. - BuyerEmail *string `json:"buyer_email,omitempty" url:"buyer_email,omitempty"` - // The name of the order's buyer. - RecipientName *string `json:"recipient_name,omitempty" url:"recipient_name,omitempty"` - // The phone number to use for the order's delivery. - RecipientPhoneNumber *string `json:"recipient_phone_number,omitempty" url:"recipient_phone_number,omitempty"` - // Whether the tax is an ADDITIVE tax or an INCLUSIVE tax. - // See [V1OrderState](#type-v1orderstate) for possible values - State *V1OrderState `json:"state,omitempty" url:"state,omitempty"` - // The address to ship the order to. - ShippingAddress *Address `json:"shipping_address,omitempty" url:"shipping_address,omitempty"` - // The amount of all items purchased in the order, before taxes and shipping. - SubtotalMoney *V1Money `json:"subtotal_money,omitempty" url:"subtotal_money,omitempty"` - // The shipping cost for the order. - TotalShippingMoney *V1Money `json:"total_shipping_money,omitempty" url:"total_shipping_money,omitempty"` - // The total of all taxes applied to the order. - TotalTaxMoney *V1Money `json:"total_tax_money,omitempty" url:"total_tax_money,omitempty"` - // The total cost of the order. - TotalPriceMoney *V1Money `json:"total_price_money,omitempty" url:"total_price_money,omitempty"` - // The total of all discounts applied to the order. - TotalDiscountMoney *V1Money `json:"total_discount_money,omitempty" url:"total_discount_money,omitempty"` - // The time when the order was created, in ISO 8601 format. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` - // The time when the order was last modified, in ISO 8601 format. - UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"` - // The time when the order expires if no action is taken, in ISO 8601 format. - ExpiresAt *string `json:"expires_at,omitempty" url:"expires_at,omitempty"` - // The unique identifier of the payment associated with the order. - PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` - // A note provided by the buyer when the order was created, if any. - BuyerNote *string `json:"buyer_note,omitempty" url:"buyer_note,omitempty"` - // A note provided by the merchant when the order's state was set to COMPLETED, if any - CompletedNote *string `json:"completed_note,omitempty" url:"completed_note,omitempty"` - // A note provided by the merchant when the order's state was set to REFUNDED, if any. - RefundedNote *string `json:"refunded_note,omitempty" url:"refunded_note,omitempty"` - // A note provided by the merchant when the order's state was set to CANCELED, if any. - CanceledNote *string `json:"canceled_note,omitempty" url:"canceled_note,omitempty"` - // The tender used to pay for the order. - Tender *V1Tender `json:"tender,omitempty" url:"tender,omitempty"` - // The history of actions associated with the order. - OrderHistory []*V1OrderHistoryEntry `json:"order_history,omitempty" url:"order_history,omitempty"` - // The promo code provided by the buyer, if any. - PromoCode *string `json:"promo_code,omitempty" url:"promo_code,omitempty"` - // For Bitcoin transactions, the address that the buyer sent Bitcoin to. - BtcReceiveAddress *string `json:"btc_receive_address,omitempty" url:"btc_receive_address,omitempty"` - // For Bitcoin transactions, the price of the buyer's order in satoshi (100 million satoshi equals 1 BTC). - BtcPriceSatoshi *float64 `json:"btc_price_satoshi,omitempty" url:"btc_price_satoshi,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *V1Order) GetExtraProperties() map[string]interface{} { + // The settlement's current status. + // See [V1SettlementStatus](#type-v1settlementstatus) for possible values + Status *V1SettlementStatus `json:"status,omitempty" url:"status,omitempty"` + // The amount of money involved in the settlement. A positive amount indicates a deposit, and a negative amount indicates a withdrawal. This amount is never zero. + TotalMoney *V1Money `json:"total_money,omitempty" url:"total_money,omitempty"` + // The time when the settlement was submitted for deposit or withdrawal, in ISO 8601 format. + InitiatedAt *string `json:"initiated_at,omitempty" url:"initiated_at,omitempty"` + // The Square-issued unique identifier for the bank account associated with the settlement. + BankAccountID *string `json:"bank_account_id,omitempty" url:"bank_account_id,omitempty"` + // The entries included in this settlement. + Entries []*V1SettlementEntry `json:"entries,omitempty" url:"entries,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (v *V1Settlement) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *V1Order) UnmarshalJSON(data []byte) error { - type unmarshaler V1Order +func (v *V1Settlement) UnmarshalJSON(data []byte) error { + type unmarshaler V1Settlement var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = V1Order(value) + *v = V1Settlement(value) extraProperties, err := core.ExtractExtraProperties(data, *v) if err != nil { @@ -54767,7 +71808,7 @@ func (v *V1Order) UnmarshalJSON(data []byte) error { return nil } -func (v *V1Order) String() string { +func (v *V1Settlement) String() string { if len(v._rawJSON) > 0 { if value, err := core.StringifyJSON(v._rawJSON); err == nil { return value @@ -54779,29 +71820,33 @@ func (v *V1Order) String() string { return fmt.Sprintf("%#v", v) } -// V1OrderHistoryEntry -type V1OrderHistoryEntry struct { - // The type of action performed on the order. - // See [V1OrderHistoryEntryAction](#type-v1orderhistoryentryaction) for possible values - Action *V1OrderHistoryEntryAction `json:"action,omitempty" url:"action,omitempty"` - // The time when the action was performed, in ISO 8601 format. - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` +// V1SettlementEntry +type V1SettlementEntry struct { + // The settlement's unique identifier. + PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"` + // The settlement's current status. + // See [V1SettlementEntryType](#type-v1settlemententrytype) for possible values + Type *V1SettlementEntryType `json:"type,omitempty" url:"type,omitempty"` + // The total amount of money this entry contributes to the total settlement amount. + AmountMoney *V1Money `json:"amount_money,omitempty" url:"amount_money,omitempty"` + // The amount of all Square fees associated with this settlement entry. This value is always negative or zero. + FeeMoney *V1Money `json:"fee_money,omitempty" url:"fee_money,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (v *V1OrderHistoryEntry) GetExtraProperties() map[string]interface{} { +func (v *V1SettlementEntry) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *V1OrderHistoryEntry) UnmarshalJSON(data []byte) error { - type unmarshaler V1OrderHistoryEntry +func (v *V1SettlementEntry) UnmarshalJSON(data []byte) error { + type unmarshaler V1SettlementEntry var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = V1OrderHistoryEntry(value) + *v = V1SettlementEntry(value) extraProperties, err := core.ExtractExtraProperties(data, *v) if err != nil { @@ -54813,7 +71858,7 @@ func (v *V1OrderHistoryEntry) UnmarshalJSON(data []byte) error { return nil } -func (v *V1OrderHistoryEntry) String() string { +func (v *V1SettlementEntry) String() string { if len(v._rawJSON) > 0 { if value, err := core.StringifyJSON(v._rawJSON); err == nil { return value @@ -54825,99 +71870,126 @@ func (v *V1OrderHistoryEntry) String() string { return fmt.Sprintf("%#v", v) } -type V1OrderHistoryEntryAction string +type V1SettlementEntryType string const ( - V1OrderHistoryEntryActionOrderPlaced V1OrderHistoryEntryAction = "ORDER_PLACED" - V1OrderHistoryEntryActionDeclined V1OrderHistoryEntryAction = "DECLINED" - V1OrderHistoryEntryActionPaymentReceived V1OrderHistoryEntryAction = "PAYMENT_RECEIVED" - V1OrderHistoryEntryActionCanceled V1OrderHistoryEntryAction = "CANCELED" - V1OrderHistoryEntryActionCompleted V1OrderHistoryEntryAction = "COMPLETED" - V1OrderHistoryEntryActionRefunded V1OrderHistoryEntryAction = "REFUNDED" - V1OrderHistoryEntryActionExpired V1OrderHistoryEntryAction = "EXPIRED" + V1SettlementEntryTypeAdjustment V1SettlementEntryType = "ADJUSTMENT" + V1SettlementEntryTypeBalanceCharge V1SettlementEntryType = "BALANCE_CHARGE" + V1SettlementEntryTypeCharge V1SettlementEntryType = "CHARGE" + V1SettlementEntryTypeFreeProcessing V1SettlementEntryType = "FREE_PROCESSING" + V1SettlementEntryTypeHoldAdjustment V1SettlementEntryType = "HOLD_ADJUSTMENT" + V1SettlementEntryTypePaidServiceFee V1SettlementEntryType = "PAID_SERVICE_FEE" + V1SettlementEntryTypePaidServiceFeeRefund V1SettlementEntryType = "PAID_SERVICE_FEE_REFUND" + V1SettlementEntryTypeRedemptionCode V1SettlementEntryType = "REDEMPTION_CODE" + V1SettlementEntryTypeRefund V1SettlementEntryType = "REFUND" + V1SettlementEntryTypeReturnedPayout V1SettlementEntryType = "RETURNED_PAYOUT" + V1SettlementEntryTypeSquareCapitalAdvance V1SettlementEntryType = "SQUARE_CAPITAL_ADVANCE" + V1SettlementEntryTypeSquareCapitalPayment V1SettlementEntryType = "SQUARE_CAPITAL_PAYMENT" + V1SettlementEntryTypeSquareCapitalReversedPayment V1SettlementEntryType = "SQUARE_CAPITAL_REVERSED_PAYMENT" + V1SettlementEntryTypeSubscriptionFee V1SettlementEntryType = "SUBSCRIPTION_FEE" + V1SettlementEntryTypeSubscriptionFeeRefund V1SettlementEntryType = "SUBSCRIPTION_FEE_REFUND" + V1SettlementEntryTypeOther V1SettlementEntryType = "OTHER" + V1SettlementEntryTypeIncentedPayment V1SettlementEntryType = "INCENTED_PAYMENT" + V1SettlementEntryTypeReturnedAchEntry V1SettlementEntryType = "RETURNED_ACH_ENTRY" + V1SettlementEntryTypeReturnedSquare275 V1SettlementEntryType = "RETURNED_SQUARE_275" + V1SettlementEntryTypeSquare275 V1SettlementEntryType = "SQUARE_275" + V1SettlementEntryTypeSquareCard V1SettlementEntryType = "SQUARE_CARD" ) -func NewV1OrderHistoryEntryActionFromString(s string) (V1OrderHistoryEntryAction, error) { +func NewV1SettlementEntryTypeFromString(s string) (V1SettlementEntryType, error) { switch s { - case "ORDER_PLACED": - return V1OrderHistoryEntryActionOrderPlaced, nil - case "DECLINED": - return V1OrderHistoryEntryActionDeclined, nil - case "PAYMENT_RECEIVED": - return V1OrderHistoryEntryActionPaymentReceived, nil - case "CANCELED": - return V1OrderHistoryEntryActionCanceled, nil - case "COMPLETED": - return V1OrderHistoryEntryActionCompleted, nil - case "REFUNDED": - return V1OrderHistoryEntryActionRefunded, nil - case "EXPIRED": - return V1OrderHistoryEntryActionExpired, nil - } - var t V1OrderHistoryEntryAction + case "ADJUSTMENT": + return V1SettlementEntryTypeAdjustment, nil + case "BALANCE_CHARGE": + return V1SettlementEntryTypeBalanceCharge, nil + case "CHARGE": + return V1SettlementEntryTypeCharge, nil + case "FREE_PROCESSING": + return V1SettlementEntryTypeFreeProcessing, nil + case "HOLD_ADJUSTMENT": + return V1SettlementEntryTypeHoldAdjustment, nil + case "PAID_SERVICE_FEE": + return V1SettlementEntryTypePaidServiceFee, nil + case "PAID_SERVICE_FEE_REFUND": + return V1SettlementEntryTypePaidServiceFeeRefund, nil + case "REDEMPTION_CODE": + return V1SettlementEntryTypeRedemptionCode, nil + case "REFUND": + return V1SettlementEntryTypeRefund, nil + case "RETURNED_PAYOUT": + return V1SettlementEntryTypeReturnedPayout, nil + case "SQUARE_CAPITAL_ADVANCE": + return V1SettlementEntryTypeSquareCapitalAdvance, nil + case "SQUARE_CAPITAL_PAYMENT": + return V1SettlementEntryTypeSquareCapitalPayment, nil + case "SQUARE_CAPITAL_REVERSED_PAYMENT": + return V1SettlementEntryTypeSquareCapitalReversedPayment, nil + case "SUBSCRIPTION_FEE": + return V1SettlementEntryTypeSubscriptionFee, nil + case "SUBSCRIPTION_FEE_REFUND": + return V1SettlementEntryTypeSubscriptionFeeRefund, nil + case "OTHER": + return V1SettlementEntryTypeOther, nil + case "INCENTED_PAYMENT": + return V1SettlementEntryTypeIncentedPayment, nil + case "RETURNED_ACH_ENTRY": + return V1SettlementEntryTypeReturnedAchEntry, nil + case "RETURNED_SQUARE_275": + return V1SettlementEntryTypeReturnedSquare275, nil + case "SQUARE_275": + return V1SettlementEntryTypeSquare275, nil + case "SQUARE_CARD": + return V1SettlementEntryTypeSquareCard, nil + } + var t V1SettlementEntryType return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (v V1OrderHistoryEntryAction) Ptr() *V1OrderHistoryEntryAction { +func (v V1SettlementEntryType) Ptr() *V1SettlementEntryType { return &v } -type V1OrderState string +type V1SettlementStatus string const ( - V1OrderStatePending V1OrderState = "PENDING" - V1OrderStateOpen V1OrderState = "OPEN" - V1OrderStateCompleted V1OrderState = "COMPLETED" - V1OrderStateCanceled V1OrderState = "CANCELED" - V1OrderStateRefunded V1OrderState = "REFUNDED" - V1OrderStateRejected V1OrderState = "REJECTED" + V1SettlementStatusFailed V1SettlementStatus = "FAILED" + V1SettlementStatusSent V1SettlementStatus = "SENT" ) -func NewV1OrderStateFromString(s string) (V1OrderState, error) { +func NewV1SettlementStatusFromString(s string) (V1SettlementStatus, error) { switch s { - case "PENDING": - return V1OrderStatePending, nil - case "OPEN": - return V1OrderStateOpen, nil - case "COMPLETED": - return V1OrderStateCompleted, nil - case "CANCELED": - return V1OrderStateCanceled, nil - case "REFUNDED": - return V1OrderStateRefunded, nil - case "REJECTED": - return V1OrderStateRejected, nil + case "FAILED": + return V1SettlementStatusFailed, nil + case "SENT": + return V1SettlementStatusSent, nil } - var t V1OrderState + var t V1SettlementStatus return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (v V1OrderState) Ptr() *V1OrderState { +func (v V1SettlementStatus) Ptr() *V1SettlementStatus { return &v } -// Represents a phone number. -type V1PhoneNumber struct { - // The phone number's international calling code. For US phone numbers, this value is +1. - CallingCode string `json:"calling_code" url:"calling_code"` - // The phone number. - Number string `json:"number" url:"number"` +type V1SubmitBatchRequest struct { + // The set of API actions to perform. + Requests []*BatchRequest `json:"requests,omitempty" url:"requests,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (v *V1PhoneNumber) GetExtraProperties() map[string]interface{} { +func (v *V1SubmitBatchRequest) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *V1PhoneNumber) UnmarshalJSON(data []byte) error { - type unmarshaler V1PhoneNumber +func (v *V1SubmitBatchRequest) UnmarshalJSON(data []byte) error { + type unmarshaler V1SubmitBatchRequest var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = V1PhoneNumber(value) + *v = V1SubmitBatchRequest(value) extraProperties, err := core.ExtractExtraProperties(data, *v) if err != nil { @@ -54929,7 +72001,7 @@ func (v *V1PhoneNumber) UnmarshalJSON(data []byte) error { return nil } -func (v *V1PhoneNumber) String() string { +func (v *V1SubmitBatchRequest) String() string { if len(v._rawJSON) > 0 { if value, err := core.StringifyJSON(v._rawJSON); err == nil { return value @@ -54941,22 +72013,27 @@ func (v *V1PhoneNumber) String() string { return fmt.Sprintf("%#v", v) } -type V1RetrieveOrderRequest struct { +type V1SubmitBatchResponse struct { + // An array of `BatchResponse` objects corresponding to requests. The + // index of each response in the array matches the index of the + // corresponding request. + Items []*BatchResponse `json:"items,omitempty" url:"items,omitempty"` + extraProperties map[string]interface{} _rawJSON json.RawMessage } -func (v *V1RetrieveOrderRequest) GetExtraProperties() map[string]interface{} { +func (v *V1SubmitBatchResponse) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *V1RetrieveOrderRequest) UnmarshalJSON(data []byte) error { - type unmarshaler V1RetrieveOrderRequest +func (v *V1SubmitBatchResponse) UnmarshalJSON(data []byte) error { + type unmarshaler V1SubmitBatchResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = V1RetrieveOrderRequest(value) + *v = V1SubmitBatchResponse(value) extraProperties, err := core.ExtractExtraProperties(data, *v) if err != nil { @@ -54968,7 +72045,7 @@ func (v *V1RetrieveOrderRequest) UnmarshalJSON(data []byte) error { return nil } -func (v *V1RetrieveOrderRequest) String() string { +func (v *V1SubmitBatchResponse) String() string { if len(v._rawJSON) > 0 { if value, err := core.StringifyJSON(v._rawJSON); err == nil { return value @@ -55198,31 +72275,143 @@ func (v V1TenderType) Ptr() *V1TenderType { return &v } -type V1UpdateOrderRequestAction string +// Published when a timecard is created in the Seller Dashboard +// or an employee clocks in using the Square Point of Sale app. +type V1TimecardUpdatedWebhook struct { + // The ID of the target merchant associated with the event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The ID of the target merchant associated with the event. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The type of event this represents, i.e. `TIMECARD_UPDATED`. + EventType *string `json:"event_type,omitempty" url:"event_type,omitempty"` + // The ID of the updated V1 Timecard. + EntityID *string `json:"entity_id,omitempty" url:"entity_id,omitempty"` -const ( - V1UpdateOrderRequestActionComplete V1UpdateOrderRequestAction = "COMPLETE" - V1UpdateOrderRequestActionCancel V1UpdateOrderRequestAction = "CANCEL" - V1UpdateOrderRequestActionRefund V1UpdateOrderRequestAction = "REFUND" -) + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} -func NewV1UpdateOrderRequestActionFromString(s string) (V1UpdateOrderRequestAction, error) { - switch s { - case "COMPLETE": - return V1UpdateOrderRequestActionComplete, nil - case "CANCEL": - return V1UpdateOrderRequestActionCancel, nil - case "REFUND": - return V1UpdateOrderRequestActionRefund, nil +func (v *V1TimecardUpdatedWebhook) GetExtraProperties() map[string]interface{} { + return v.extraProperties +} + +func (v *V1TimecardUpdatedWebhook) UnmarshalJSON(data []byte) error { + type unmarshaler V1TimecardUpdatedWebhook + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - var t V1UpdateOrderRequestAction - return "", fmt.Errorf("%s is not a valid %T", s, t) + *v = V1TimecardUpdatedWebhook(value) + + extraProperties, err := core.ExtractExtraProperties(data, *v) + if err != nil { + return err + } + v.extraProperties = extraProperties + + v._rawJSON = json.RawMessage(data) + return nil } -func (v V1UpdateOrderRequestAction) Ptr() *V1UpdateOrderRequestAction { - return &v +func (v *V1TimecardUpdatedWebhook) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(v); err == nil { + return value + } + return fmt.Sprintf("%#v", v) +} + +// Deprecated. V1UpdateWebhooksRequest +type V1UpdateWebhooksRequest struct { + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (v *V1UpdateWebhooksRequest) GetExtraProperties() map[string]interface{} { + return v.extraProperties +} + +func (v *V1UpdateWebhooksRequest) UnmarshalJSON(data []byte) error { + type unmarshaler V1UpdateWebhooksRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *v = V1UpdateWebhooksRequest(value) + + extraProperties, err := core.ExtractExtraProperties(data, *v) + if err != nil { + return err + } + v.extraProperties = extraProperties + + v._rawJSON = json.RawMessage(data) + return nil +} + +func (v *V1UpdateWebhooksRequest) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(v); err == nil { + return value + } + return fmt.Sprintf("%#v", v) +} + +// Deprecated. V1UpdateWebhooksResponse +type V1UpdateWebhooksResponse struct { + // A list of webhook event enums the location is currently subscribed to. + // See [V1WebhooksEvents](#type-v1webhooksevents) for possible values + Events []V1WebhooksEvents `json:"events,omitempty" url:"events,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (v *V1UpdateWebhooksResponse) GetExtraProperties() map[string]interface{} { + return v.extraProperties +} + +func (v *V1UpdateWebhooksResponse) UnmarshalJSON(data []byte) error { + type unmarshaler V1UpdateWebhooksResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *v = V1UpdateWebhooksResponse(value) + + extraProperties, err := core.ExtractExtraProperties(data, *v) + if err != nil { + return err + } + v.extraProperties = extraProperties + + v._rawJSON = json.RawMessage(data) + return nil +} + +func (v *V1UpdateWebhooksResponse) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(v); err == nil { + return value + } + return fmt.Sprintf("%#v", v) } +// Deprecated. V1WebhooksEvents +type V1WebhooksEvents = string + // Represents a supplier to a seller. type Vendor struct { // A unique Square-generated ID for the [Vendor](entity:Vendor). @@ -55289,7 +72478,7 @@ func (v *Vendor) String() string { return fmt.Sprintf("%#v", v) } -// Represents a contact of a [Vendor]($m/Vendor). +// Represents a contact of a [Vendor](entity:Vendor). type VendorContact struct { // A unique Square-generated ID for the [VendorContact](entity:VendorContact). // This field is required when attempting to update a [VendorContact](entity:VendorContact). @@ -55344,17 +72533,168 @@ func (v *VendorContact) String() string { return fmt.Sprintf("%#v", v) } -// The status of the [Vendor]($m/Vendor), -// whether a [Vendor]($m/Vendor) is active or inactive. +// Published when a [Vendor](entity:Vendor) is created. +type VendorCreatedEvent struct { + // The ID of a seller associated with this event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The ID of a location associated with the event, if the event is associated with the location of the seller. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The type of this event. The value is `"vendor.created".` + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for this event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The RFC 3339-formatted time when the underlying event data object is created. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with this event. + Data *VendorCreatedEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (v *VendorCreatedEvent) GetExtraProperties() map[string]interface{} { + return v.extraProperties +} + +func (v *VendorCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler VendorCreatedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *v = VendorCreatedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *v) + if err != nil { + return err + } + v.extraProperties = extraProperties + + v._rawJSON = json.RawMessage(data) + return nil +} + +func (v *VendorCreatedEvent) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(v); err == nil { + return value + } + return fmt.Sprintf("%#v", v) +} + +// Defines the `vendor.created` event data structure. +type VendorCreatedEventData struct { + // The type of the event data object. The value is `vendor` + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The ID of the event data object. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing the created vendor. + Object *VendorCreatedEventObject `json:"object,omitempty" url:"object,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (v *VendorCreatedEventData) GetExtraProperties() map[string]interface{} { + return v.extraProperties +} + +func (v *VendorCreatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler VendorCreatedEventData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *v = VendorCreatedEventData(value) + + extraProperties, err := core.ExtractExtraProperties(data, *v) + if err != nil { + return err + } + v.extraProperties = extraProperties + + v._rawJSON = json.RawMessage(data) + return nil +} + +func (v *VendorCreatedEventData) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(v); err == nil { + return value + } + return fmt.Sprintf("%#v", v) +} + +type VendorCreatedEventObject struct { + // The operation on the vendor that caused the event to be published. The value is `CREATED`. + // See [Operation](#type-operation) for possible values + Operation *VendorCreatedEventObjectOperation `json:"operation,omitempty" url:"operation,omitempty"` + // The created vendor as the result of the specified operation. + Vendor *Vendor `json:"vendor,omitempty" url:"vendor,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (v *VendorCreatedEventObject) GetExtraProperties() map[string]interface{} { + return v.extraProperties +} + +func (v *VendorCreatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler VendorCreatedEventObject + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *v = VendorCreatedEventObject(value) + + extraProperties, err := core.ExtractExtraProperties(data, *v) + if err != nil { + return err + } + v.extraProperties = extraProperties + + v._rawJSON = json.RawMessage(data) + return nil +} + +func (v *VendorCreatedEventObject) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(v); err == nil { + return value + } + return fmt.Sprintf("%#v", v) +} + +// The operation that can be performed against a vendor to cause the event to be published. +type VendorCreatedEventObjectOperation = string + +// The status of the [Vendor](entity:Vendor), +// whether a [Vendor](entity:Vendor) is active or inactive. type VendorStatus string const ( + VendorStatusDoNotUse VendorStatus = "DO_NOT_USE" VendorStatusActive VendorStatus = "ACTIVE" VendorStatusInactive VendorStatus = "INACTIVE" ) func NewVendorStatusFromString(s string) (VendorStatus, error) { switch s { + case "DO_NOT_USE": + return VendorStatusDoNotUse, nil case "ACTIVE": return VendorStatusActive, nil case "INACTIVE": @@ -55368,17 +72708,168 @@ func (v VendorStatus) Ptr() *VendorStatus { return &v } +// Published when a [Vendor](entity:Vendor) is updated. +type VendorUpdatedEvent struct { + // The ID of a seller associated with this event. + MerchantID *string `json:"merchant_id,omitempty" url:"merchant_id,omitempty"` + // The ID of a seller location associated with this event, if the event is associated with the location. + LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"` + // The type of this event. The value is `"vendor.updated".` + Type *string `json:"type,omitempty" url:"type,omitempty"` + // A unique ID for this webhoook event. + EventID *string `json:"event_id,omitempty" url:"event_id,omitempty"` + // The RFC 3339-formatted time when the underlying event data object is created. + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // The data associated with this event. + Data *VendorUpdatedEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (v *VendorUpdatedEvent) GetExtraProperties() map[string]interface{} { + return v.extraProperties +} + +func (v *VendorUpdatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler VendorUpdatedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *v = VendorUpdatedEvent(value) + + extraProperties, err := core.ExtractExtraProperties(data, *v) + if err != nil { + return err + } + v.extraProperties = extraProperties + + v._rawJSON = json.RawMessage(data) + return nil +} + +func (v *VendorUpdatedEvent) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(v); err == nil { + return value + } + return fmt.Sprintf("%#v", v) +} + +// Defines the `vendor.updated` event data structure. +type VendorUpdatedEventData struct { + // The type of the event data object. The value is `vendor`. + Type *string `json:"type,omitempty" url:"type,omitempty"` + // The ID of the event data object. + ID *string `json:"id,omitempty" url:"id,omitempty"` + // An object containing updated vendor. + Object *VendorUpdatedEventObject `json:"object,omitempty" url:"object,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (v *VendorUpdatedEventData) GetExtraProperties() map[string]interface{} { + return v.extraProperties +} + +func (v *VendorUpdatedEventData) UnmarshalJSON(data []byte) error { + type unmarshaler VendorUpdatedEventData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *v = VendorUpdatedEventData(value) + + extraProperties, err := core.ExtractExtraProperties(data, *v) + if err != nil { + return err + } + v.extraProperties = extraProperties + + v._rawJSON = json.RawMessage(data) + return nil +} + +func (v *VendorUpdatedEventData) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(v); err == nil { + return value + } + return fmt.Sprintf("%#v", v) +} + +type VendorUpdatedEventObject struct { + // The operation on the vendor that caused the event to be published. The value is `UPDATED`. + // See [Operation](#type-operation) for possible values + Operation *VendorUpdatedEventObjectOperation `json:"operation,omitempty" url:"operation,omitempty"` + // The updated vendor as the result of the specified operation. + Vendor *Vendor `json:"vendor,omitempty" url:"vendor,omitempty"` + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (v *VendorUpdatedEventObject) GetExtraProperties() map[string]interface{} { + return v.extraProperties +} + +func (v *VendorUpdatedEventObject) UnmarshalJSON(data []byte) error { + type unmarshaler VendorUpdatedEventObject + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *v = VendorUpdatedEventObject(value) + + extraProperties, err := core.ExtractExtraProperties(data, *v) + if err != nil { + return err + } + v.extraProperties = extraProperties + + v._rawJSON = json.RawMessage(data) + return nil +} + +func (v *VendorUpdatedEventObject) String() string { + if len(v._rawJSON) > 0 { + if value, err := core.StringifyJSON(v._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(v); err == nil { + return value + } + return fmt.Sprintf("%#v", v) +} + +// The operation that can be performed against a vendor to cause the event to be published. +type VendorUpdatedEventObjectOperation = string + // Enumeration of visibility-filter values used to set the ability to view custom attributes or custom attribute definitions. type VisibilityFilter string const ( - VisibilityFilterAll VisibilityFilter = "ALL" - VisibilityFilterRead VisibilityFilter = "READ" - VisibilityFilterReadWrite VisibilityFilter = "READ_WRITE" + VisibilityFilterVisibilityFilterDoNotUse VisibilityFilter = "VISIBILITY_FILTER_DO_NOT_USE" + VisibilityFilterAll VisibilityFilter = "ALL" + VisibilityFilterRead VisibilityFilter = "READ" + VisibilityFilterReadWrite VisibilityFilter = "READ_WRITE" ) func NewVisibilityFilterFromString(s string) (VisibilityFilter, error) { switch s { + case "VISIBILITY_FILTER_DO_NOT_USE": + return VisibilityFilterVisibilityFilterDoNotUse, nil case "ALL": return VisibilityFilterAll, nil case "READ": @@ -55605,17 +73096,20 @@ func (w *WebhookSubscription) String() string { type Weekday string const ( - WeekdayMon Weekday = "MON" - WeekdayTue Weekday = "TUE" - WeekdayWed Weekday = "WED" - WeekdayThu Weekday = "THU" - WeekdayFri Weekday = "FRI" - WeekdaySat Weekday = "SAT" - WeekdaySun Weekday = "SUN" + WeekdayUnknownWeekday Weekday = "UNKNOWN_WEEKDAY" + WeekdayMon Weekday = "MON" + WeekdayTue Weekday = "TUE" + WeekdayWed Weekday = "WED" + WeekdayThu Weekday = "THU" + WeekdayFri Weekday = "FRI" + WeekdaySat Weekday = "SAT" + WeekdaySun Weekday = "SUN" ) func NewWeekdayFromString(s string) (Weekday, error) { switch s { + case "UNKNOWN_WEEKDAY": + return WeekdayUnknownWeekday, nil case "MON": return WeekdayMon, nil case "TUE": diff --git a/v1/batch/client.go b/v1/batch/client.go index 77ea18b..811a2cf 100644 --- a/v1/batch/client.go +++ b/v1/batch/client.go @@ -4,11 +4,11 @@ package batch import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { @@ -37,10 +37,28 @@ func NewClient(opts ...option.RequestOption) *Client { } } +// Bundle multiple requests to Connect V1 API endpoints as a single +// request. +// +// The **V1SubmitBatch** endpoint does not require an access token +// in the request header. Instead, provide an `access_token` parameter for +// each request included in the batch. +// +// **V1SubmitBatch** responds with an array that contains response objects for +// each of the batched requests. There is no guarantee of the order in +// which batched requests are performed. +// +// **IMPORTANT** +// +// You cannot include more than 30 requests in a single batch and +// recursive requests to **V1SubmitBatch** are not allowed. In +// other words, none of the requests included in a batch can itself be a +// request to the **V1SubmitBatch** endpoint. func (c *Client) Submit( ctx context.Context, + request *squaregosdk.BatchRequest, opts ...option.RequestOption, -) error { +) ([]*squaregosdk.BatchResponse, error) { options := core.NewRequestOptions(opts...) baseURL := "https://connect.squareupsandbox.com" @@ -54,6 +72,7 @@ func (c *Client) Submit( headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) + var response []*squaregosdk.BatchResponse if err := c.caller.Call( ctx, &core.CallParams{ @@ -64,9 +83,11 @@ func (c *Client) Submit( BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, + Request: request, + Response: &response, }, ); err != nil { - return err + return nil, err } - return nil + return response, nil } diff --git a/v1/client/client.go b/v1/client/client.go index e7bedf2..a66a84c 100644 --- a/v1/client/client.go +++ b/v1/client/client.go @@ -3,12 +3,13 @@ package client import ( + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" + batch "github.com/square/square-go-sdk/v1/batch" + transactionsclient "github.com/square/square-go-sdk/v1/transactions/client" + webhooks "github.com/square/square-go-sdk/v1/webhooks" http "net/http" os "os" - - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" - batch "github.com/fern-demo/square-go-sdk/v1/batch" ) type Client struct { @@ -16,7 +17,9 @@ type Client struct { caller *core.Caller header http.Header - Batch *batch.Client + Batch *batch.Client + Webhooks *webhooks.Client + Transactions *transactionsclient.Client } func NewClient(opts ...option.RequestOption) *Client { @@ -35,7 +38,9 @@ func NewClient(opts ...option.RequestOption) *Client { MaxAttempts: options.MaxAttempts, }, ), - header: options.ToHeader(), - Batch: batch.NewClient(opts...), + header: options.ToHeader(), + Batch: batch.NewClient(opts...), + Webhooks: webhooks.NewClient(opts...), + Transactions: transactionsclient.NewClient(opts...), } } diff --git a/v1transactions.go b/v1transactions.go deleted file mode 100644 index 52de955..0000000 --- a/v1transactions.go +++ /dev/null @@ -1,27 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package square - -type V1ListOrdersRequest struct { - // The order in which payments are listed in the response. - Order *SortOrder `json:"-" url:"order,omitempty"` - // The maximum number of payments to return in a single response. This value cannot exceed 200. - Limit *int `json:"-" url:"limit,omitempty"` - // A pagination cursor to retrieve the next set of results for your - // original query to the endpoint. - BatchToken *string `json:"-" url:"batch_token,omitempty"` -} - -type V1UpdateOrderRequest struct { - // The action to perform on the order (COMPLETE, CANCEL, or REFUND). - // See [V1UpdateOrderRequestAction](#type-v1updateorderrequestaction) for possible values - Action V1UpdateOrderRequestAction `json:"action" url:"-"` - // The tracking number of the shipment associated with the order. Only valid if action is COMPLETE. - ShippedTrackingNumber *string `json:"shipped_tracking_number,omitempty" url:"-"` - // A merchant-specified note about the completion of the order. Only valid if action is COMPLETE. - CompletedNote *string `json:"completed_note,omitempty" url:"-"` - // A merchant-specified note about the refunding of the order. Only valid if action is REFUND. - RefundedNote *string `json:"refunded_note,omitempty" url:"-"` - // A merchant-specified note about the canceling of the order. Only valid if action is CANCEL. - CanceledNote *string `json:"canceled_note,omitempty" url:"-"` -} diff --git a/v1transactions/client.go b/v1transactions/client.go deleted file mode 100644 index 3adea2d..0000000 --- a/v1transactions/client.go +++ /dev/null @@ -1,179 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package v1transactions - -import ( - context "context" - http "net/http" - os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" -) - -type Client struct { - baseURL string - caller *core.Caller - header http.Header -} - -func NewClient(opts ...option.RequestOption) *Client { - options := core.NewRequestOptions(opts...) - if options.Token == "" { - options.Token = os.Getenv("SQUARE_TOKEN") - } - if options.Version == "" { - options.Version = os.Getenv("VERSION") - } - return &Client{ - baseURL: options.BaseURL, - caller: core.NewCaller( - &core.CallerParams{ - Client: options.HTTPClient, - MaxAttempts: options.MaxAttempts, - }, - ), - header: options.ToHeader(), - } -} - -// Provides summary information for a merchant's online store orders. -func (c *Client) V1ListOrders( - ctx context.Context, - // The ID of the location to list online store orders for. - locationID string, - request *squaregosdk.V1ListOrdersRequest, - opts ...option.RequestOption, -) ([]*squaregosdk.V1Order, error) { - options := core.NewRequestOptions(opts...) - - baseURL := "https://connect.squareupsandbox.com" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/v1/%v/orders", locationID) - - queryParams, err := core.QueryValues(request) - if err != nil { - return nil, err - } - if len(queryParams) > 0 { - endpointURL += "?" + queryParams.Encode() - } - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - var response []*squaregosdk.V1Order - if err := c.caller.Call( - ctx, - &core.CallParams{ - URL: endpointURL, - Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, - Headers: headers, - BodyProperties: options.BodyProperties, - QueryParameters: options.QueryParameters, - Client: options.HTTPClient, - Response: &response, - }, - ); err != nil { - return nil, err - } - return response, nil -} - -// Provides comprehensive information for a single online store order, including the order's history. -func (c *Client) V1RetrieveOrder( - ctx context.Context, - // The ID of the order's associated location. - locationID string, - // The order's Square-issued ID. You obtain this value from Order objects returned by the List Orders endpoint - orderID string, - opts ...option.RequestOption, -) (*squaregosdk.V1Order, error) { - options := core.NewRequestOptions(opts...) - - baseURL := "https://connect.squareupsandbox.com" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL( - baseURL+"/v1/%v/orders/%v", - locationID, - orderID, - ) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - var response *squaregosdk.V1Order - if err := c.caller.Call( - ctx, - &core.CallParams{ - URL: endpointURL, - Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, - Headers: headers, - BodyProperties: options.BodyProperties, - QueryParameters: options.QueryParameters, - Client: options.HTTPClient, - Response: &response, - }, - ); err != nil { - return nil, err - } - return response, nil -} - -// Updates the details of an online store order. Every update you perform on an order corresponds to one of three actions: -func (c *Client) V1UpdateOrder( - ctx context.Context, - // The ID of the order's associated location. - locationID string, - // The order's Square-issued ID. You obtain this value from Order objects returned by the List Orders endpoint - orderID string, - request *squaregosdk.V1UpdateOrderRequest, - opts ...option.RequestOption, -) (*squaregosdk.V1Order, error) { - options := core.NewRequestOptions(opts...) - - baseURL := "https://connect.squareupsandbox.com" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL( - baseURL+"/v1/%v/orders/%v", - locationID, - orderID, - ) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - var response *squaregosdk.V1Order - if err := c.caller.Call( - ctx, - &core.CallParams{ - URL: endpointURL, - Method: http.MethodPut, - MaxAttempts: options.MaxAttempts, - Headers: headers, - BodyProperties: options.BodyProperties, - QueryParameters: options.QueryParameters, - Client: options.HTTPClient, - Request: request, - Response: &response, - }, - ); err != nil { - return nil, err - } - return response, nil -} diff --git a/vendors/client.go b/vendors/client.go index 1de4997..1aa8252 100644 --- a/vendors/client.go +++ b/vendors/client.go @@ -4,12 +4,11 @@ package vendors import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" ) type Client struct { @@ -38,7 +37,7 @@ func NewClient(opts ...option.RequestOption) *Client { } } -// Creates one or more [Vendor]($m/Vendor) objects to represent suppliers to a seller. +// Creates one or more [Vendor](entity:Vendor) objects to represent suppliers to a seller. func (c *Client) BatchCreate( ctx context.Context, request *squaregosdk.BatchCreateVendorsRequest, @@ -77,7 +76,7 @@ func (c *Client) BatchCreate( return response, nil } -// Retrieves one or more vendors of specified [Vendor]($m/Vendor) IDs. +// Retrieves one or more vendors of specified [Vendor](entity:Vendor) IDs. func (c *Client) BatchGet( ctx context.Context, request *squaregosdk.BatchGetVendorsRequest, @@ -116,7 +115,7 @@ func (c *Client) BatchGet( return response, nil } -// Updates one or more of existing [Vendor]($m/Vendor) objects as suppliers to a seller. +// Updates one or more of existing [Vendor](entity:Vendor) objects as suppliers to a seller. func (c *Client) BatchUpdate( ctx context.Context, request *squaregosdk.BatchUpdateVendorsRequest, @@ -155,7 +154,7 @@ func (c *Client) BatchUpdate( return response, nil } -// Creates a single [Vendor]($m/Vendor) object to represent a supplier to a seller. +// Creates a single [Vendor](entity:Vendor) object to represent a supplier to a seller. func (c *Client) Create( ctx context.Context, request *squaregosdk.CreateVendorRequest, @@ -194,7 +193,7 @@ func (c *Client) Create( return response, nil } -// Searches for vendors using a filter against supported [Vendor]($m/Vendor) properties and a supported sorter. +// Searches for vendors using a filter against supported [Vendor](entity:Vendor) properties and a supported sorter. func (c *Client) Search( ctx context.Context, request *squaregosdk.SearchVendorsRequest, @@ -233,7 +232,7 @@ func (c *Client) Search( return response, nil } -// Retrieves the vendor of a specified [Vendor]($m/Vendor) ID. +// Retrieves the vendor of a specified [Vendor](entity:Vendor) ID. func (c *Client) Get( ctx context.Context, // ID of the [Vendor](entity:Vendor) to retrieve. @@ -272,7 +271,7 @@ func (c *Client) Get( return response, nil } -// Updates an existing [Vendor]($m/Vendor) object as a supplier to a seller. +// Updates an existing [Vendor](entity:Vendor) object as a supplier to a seller. func (c *Client) Update( ctx context.Context, // ID of the [Vendor](entity:Vendor) to retrieve. diff --git a/webhooks/client/client.go b/webhooks/client/client.go index aad6794..0c94c92 100644 --- a/webhooks/client/client.go +++ b/webhooks/client/client.go @@ -3,13 +3,12 @@ package client import ( + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" + eventtypes "github.com/square/square-go-sdk/webhooks/eventtypes" + subscriptions "github.com/square/square-go-sdk/webhooks/subscriptions" http "net/http" os "os" - - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" - eventtypes "github.com/fern-demo/square-go-sdk/webhooks/eventtypes" - subscriptions "github.com/fern-demo/square-go-sdk/webhooks/subscriptions" ) type Client struct { diff --git a/webhooks/eventtypes/client.go b/webhooks/eventtypes/client.go index ec0e702..d0ec23c 100644 --- a/webhooks/eventtypes/client.go +++ b/webhooks/eventtypes/client.go @@ -4,13 +4,12 @@ package eventtypes import ( context "context" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" + webhooks "github.com/square/square-go-sdk/webhooks" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" - webhooks "github.com/fern-demo/square-go-sdk/webhooks" ) type Client struct { diff --git a/webhooks/subscriptions.go b/webhooks/subscriptions.go index 30e7981..aef660c 100644 --- a/webhooks/subscriptions.go +++ b/webhooks/subscriptions.go @@ -3,7 +3,7 @@ package webhooks import ( - squaregosdk "github.com/fern-demo/square-go-sdk" + squaregosdk "github.com/square/square-go-sdk" ) type CreateWebhookSubscriptionRequest struct { diff --git a/webhooks/subscriptions/client.go b/webhooks/subscriptions/client.go index ccc4fe5..294b1e1 100644 --- a/webhooks/subscriptions/client.go +++ b/webhooks/subscriptions/client.go @@ -5,13 +5,12 @@ package subscriptions import ( context "context" fmt "fmt" + squaregosdk "github.com/square/square-go-sdk" + core "github.com/square/square-go-sdk/core" + option "github.com/square/square-go-sdk/option" + webhooks "github.com/square/square-go-sdk/webhooks" http "net/http" os "os" - - squaregosdk "github.com/fern-demo/square-go-sdk" - core "github.com/fern-demo/square-go-sdk/core" - option "github.com/fern-demo/square-go-sdk/option" - webhooks "github.com/fern-demo/square-go-sdk/webhooks" ) type Client struct {