From 3ab7dc0117117dd5f4da17e190441d587e00a2d2 Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Thu, 22 Jan 2026 18:32:20 +0000 Subject: [PATCH 1/2] SDK regeneration --- .fern/metadata.json | 7 +- apple_pay.go | 2 +- applepay/client.go | 8 +- applepay/raw_client.go | 8 +- bank_accounts.go | 358 ++++++++- bankaccounts/client.go | 45 +- bankaccounts/raw_client.go | 93 ++- bookings.go | 2 +- bookings/client/client.go | 16 +- bookings/client/raw_client.go | 8 +- bookings/custom_attribute_definitions.go | 10 +- bookings/custom_attributes.go | 14 +- bookings/customattributedefinitions/client.go | 10 +- .../customattributedefinitions/raw_client.go | 10 +- bookings/customattributes/client.go | 10 +- bookings/customattributes/raw_client.go | 10 +- bookings/error_codes.go | 9 + bookings/locationprofiles/client.go | 10 +- bookings/locationprofiles/raw_client.go | 4 +- bookings/teammemberprofiles/client.go | 10 +- bookings/teammemberprofiles/raw_client.go | 10 +- cards.go | 2 +- cards/client.go | 8 +- cards/raw_client.go | 8 +- cashdrawers/client/client.go | 6 +- cashdrawers/error_codes.go | 9 + cashdrawers/shifts.go | 6 +- cashdrawers/shifts/client.go | 10 +- cashdrawers/shifts/raw_client.go | 10 +- catalog.go | 2 +- catalog/client/client.go | 12 +- catalog/client/raw_client.go | 8 +- catalog/error_codes.go | 9 + catalog/images.go | 6 +- catalog/images/client.go | 10 +- catalog/images/raw_client.go | 10 +- catalog/object.go | 6 +- catalog/object/client.go | 10 +- catalog/object/raw_client.go | 10 +- channels.go | 2 +- channels/client.go | 8 +- channels/raw_client.go | 8 +- checkout.go | 2 +- checkout/client/client.go | 10 +- checkout/client/raw_client.go | 8 +- checkout/error_codes.go | 9 + checkout/payment_links.go | 22 +- checkout/paymentlinks/client.go | 10 +- checkout/paymentlinks/raw_client.go | 10 +- client/client.go | 82 +-- client/client_test.go | 2 +- core/request_option.go | 8 +- customers.go | 2 +- customers/cards.go | 6 +- customers/cards/client.go | 10 +- customers/cards/raw_client.go | 10 +- customers/client/client.go | 18 +- customers/client/raw_client.go | 8 +- customers/custom_attribute_definitions.go | 14 +- customers/custom_attributes.go | 6 +- .../customattributedefinitions/client.go | 10 +- .../customattributedefinitions/raw_client.go | 10 +- customers/customattributes/client.go | 10 +- customers/customattributes/raw_client.go | 10 +- customers/error_codes.go | 9 + customers/groups.go | 10 +- customers/groups/client.go | 10 +- customers/groups/raw_client.go | 10 +- customers/segments/client.go | 10 +- customers/segments/raw_client.go | 10 +- devices.go | 2 +- devices/client/client.go | 10 +- devices/client/raw_client.go | 8 +- devices/codes.go | 14 +- devices/codes/client.go | 10 +- devices/codes/raw_client.go | 10 +- devices/error_codes.go | 9 + disputes.go | 2 +- disputes/client/client.go | 10 +- disputes/client/raw_client.go | 8 +- disputes/error_codes.go | 9 + disputes/evidence/client.go | 10 +- disputes/evidence/raw_client.go | 10 +- employees.go | 2 +- employees/client.go | 8 +- employees/raw_client.go | 8 +- error_codes.go | 2 +- events.go | 2 +- events/client.go | 8 +- events/raw_client.go | 8 +- gift_cards.go | 2 +- giftcards/activities.go | 6 +- giftcards/activities/client.go | 10 +- giftcards/activities/raw_client.go | 10 +- giftcards/client/client.go | 10 +- giftcards/client/raw_client.go | 8 +- giftcards/error_codes.go | 9 + go.mod | 2 +- internal/caller.go | 86 ++- internal/caller_test.go | 313 +++++++- internal/error_decoder.go | 2 +- internal/error_decoder_test.go | 2 +- internal/explicit_fields_test.go | 11 +- internal/pager.go | 2 +- internal/pager_test.go | 2 +- internal/query.go | 3 + internal/query_test.go | 21 + internal/retrier.go | 9 + internal/retrier_test.go | 54 +- inventory.go | 2 +- inventory/client.go | 8 +- inventory/raw_client.go | 8 +- invoices.go | 2 +- invoices/client.go | 8 +- invoices/raw_client.go | 8 +- labor.go | 2 +- labor/break_types.go | 10 +- labor/breaktypes/client.go | 10 +- labor/breaktypes/raw_client.go | 10 +- labor/client/client.go | 18 +- labor/client/raw_client.go | 8 +- labor/employeewages/client.go | 10 +- labor/employeewages/raw_client.go | 10 +- labor/error_codes.go | 9 + labor/shifts.go | 14 +- labor/shifts/client.go | 10 +- labor/shifts/raw_client.go | 10 +- labor/teammemberwages/client.go | 10 +- labor/teammemberwages/raw_client.go | 10 +- labor/workweek_configs.go | 6 +- labor/workweekconfigs/client.go | 10 +- labor/workweekconfigs/raw_client.go | 10 +- locations.go | 2 +- locations/client/client.go | 14 +- locations/client/raw_client.go | 8 +- locations/custom_attribute_definitions.go | 14 +- locations/custom_attributes.go | 18 +- .../customattributedefinitions/client.go | 10 +- .../customattributedefinitions/raw_client.go | 10 +- locations/customattributes/client.go | 10 +- locations/customattributes/raw_client.go | 10 +- locations/error_codes.go | 9 + locations/transactions.go | 6 +- locations/transactions/client.go | 10 +- locations/transactions/raw_client.go | 10 +- loyalty.go | 2 +- loyalty/accounts.go | 18 +- loyalty/accounts/client.go | 10 +- loyalty/accounts/raw_client.go | 10 +- loyalty/client/client.go | 14 +- loyalty/client/raw_client.go | 8 +- loyalty/error_codes.go | 9 + loyalty/programs.go | 6 +- loyalty/programs/client/client.go | 12 +- loyalty/programs/client/raw_client.go | 10 +- loyalty/programs/error_codes.go | 9 + loyalty/programs/promotions.go | 10 +- loyalty/programs/promotions/client.go | 10 +- loyalty/programs/promotions/raw_client.go | 10 +- loyalty/rewards.go | 10 +- loyalty/rewards/client.go | 10 +- loyalty/rewards/raw_client.go | 10 +- merchants.go | 2 +- merchants/client/client.go | 12 +- merchants/client/raw_client.go | 8 +- merchants/custom_attribute_definitions.go | 14 +- merchants/custom_attributes.go | 18 +- .../customattributedefinitions/client.go | 10 +- .../customattributedefinitions/raw_client.go | 10 +- merchants/customattributes/client.go | 10 +- merchants/customattributes/raw_client.go | 10 +- merchants/error_codes.go | 9 + mobile.go | 153 ---- mobile/client.go | 32 +- mobile/raw_client.go | 18 +- o_auth.go | 14 +- oauth/client.go | 8 +- oauth/raw_client.go | 8 +- option/request_option.go | 2 +- orders.go | 44 +- orders/client/client.go | 12 +- orders/client/raw_client.go | 8 +- orders/custom_attribute_definitions.go | 14 +- orders/custom_attributes.go | 18 +- orders/customattributedefinitions/client.go | 10 +- .../customattributedefinitions/raw_client.go | 10 +- orders/customattributes/client.go | 10 +- orders/customattributes/raw_client.go | 10 +- orders/error_codes.go | 9 + payments.go | 40 +- payments/client.go | 8 +- payments/raw_client.go | 8 +- payouts.go | 2 +- payouts/client.go | 8 +- payouts/raw_client.go | 8 +- reference.md | 298 +++++--- refunds.go | 2 +- refunds/client.go | 8 +- refunds/raw_client.go | 8 +- sites.go | 2 +- sites/client.go | 8 +- sites/raw_client.go | 8 +- snippets.go | 2 +- snippets/client.go | 8 +- snippets/raw_client.go | 8 +- subscriptions.go | 2 +- subscriptions/client.go | 8 +- subscriptions/raw_client.go | 8 +- team.go | 2 +- team/client.go | 8 +- team/raw_client.go | 8 +- team_members.go | 2 +- teammembers/client/client.go | 10 +- teammembers/client/raw_client.go | 8 +- teammembers/error_codes.go | 9 + teammembers/wage_setting.go | 6 +- teammembers/wagesetting/client.go | 10 +- teammembers/wagesetting/raw_client.go | 10 +- terminal.go | 2 +- terminal/actions.go | 10 +- terminal/actions/client.go | 10 +- terminal/actions/raw_client.go | 10 +- terminal/checkouts.go | 10 +- terminal/checkouts/client.go | 10 +- terminal/checkouts/raw_client.go | 10 +- terminal/client/client.go | 14 +- terminal/client/raw_client.go | 8 +- terminal/error_codes.go | 9 + terminal/refunds.go | 10 +- terminal/refunds/client.go | 10 +- terminal/refunds/raw_client.go | 10 +- transfer_orders.go | 2 +- transferorders/client.go | 8 +- transferorders/raw_client.go | 8 +- types.go | 691 +++++++++++++++--- v1transactions.go | 2 +- v1transactions/client.go | 8 +- v1transactions/raw_client.go | 8 +- vendors.go | 2 +- vendors/client.go | 8 +- vendors/raw_client.go | 8 +- webhooks/client/client.go | 8 +- webhooks/error_codes.go | 9 + webhooks/eventtypes/client.go | 10 +- webhooks/eventtypes/raw_client.go | 10 +- webhooks/subscriptions.go | 14 +- webhooks/subscriptions/client.go | 10 +- webhooks/subscriptions/raw_client.go | 10 +- 248 files changed, 2941 insertions(+), 1362 deletions(-) create mode 100644 bookings/error_codes.go create mode 100644 cashdrawers/error_codes.go create mode 100644 catalog/error_codes.go create mode 100644 checkout/error_codes.go create mode 100644 customers/error_codes.go create mode 100644 devices/error_codes.go create mode 100644 disputes/error_codes.go create mode 100644 giftcards/error_codes.go create mode 100644 labor/error_codes.go create mode 100644 locations/error_codes.go create mode 100644 loyalty/error_codes.go create mode 100644 loyalty/programs/error_codes.go create mode 100644 merchants/error_codes.go delete mode 100644 mobile.go create mode 100644 orders/error_codes.go create mode 100644 teammembers/error_codes.go create mode 100644 terminal/error_codes.go create mode 100644 webhooks/error_codes.go diff --git a/.fern/metadata.json b/.fern/metadata.json index 7475e11..3c44ff2 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,9 +1,10 @@ { - "cliVersion": "2.2.5", + "cliVersion": "3.38.0", "generatorName": "fernapi/fern-go-sdk", - "generatorVersion": "1.17.1", + "generatorVersion": "1.22.4", "generatorConfig": { "packageName": "square", "enableWireTests": false - } + }, + "sdkVersion": "v3.0.0" } \ No newline at end of file diff --git a/apple_pay.go b/apple_pay.go index 8a1d774..f4eeff9 100644 --- a/apple_pay.go +++ b/apple_pay.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" big "math/big" ) diff --git a/applepay/client.go b/applepay/client.go index 1b75389..b187657 100644 --- a/applepay/client.go +++ b/applepay/client.go @@ -4,10 +4,10 @@ package applepay import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" os "os" ) diff --git a/applepay/raw_client.go b/applepay/raw_client.go index dae17eb..ec61952 100644 --- a/applepay/raw_client.go +++ b/applepay/raw_client.go @@ -4,10 +4,10 @@ package applepay import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/bank_accounts.go b/bank_accounts.go index 8cc6d81..5bac703 100644 --- a/bank_accounts.go +++ b/bank_accounts.go @@ -5,10 +5,84 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" big "math/big" ) +var ( + createBankAccountRequestFieldIdempotencyKey = big.NewInt(1 << 0) + createBankAccountRequestFieldSourceID = big.NewInt(1 << 1) + createBankAccountRequestFieldCustomerID = big.NewInt(1 << 2) +) + +type CreateBankAccountRequest struct { + // Unique ID. For more information, see the + // [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). + IdempotencyKey string `json:"idempotency_key" url:"-"` + // The ID of the source that represents the bank account information to be stored. This field + // accepts the payment token created by WebSDK + SourceID string `json:"source_id" url:"-"` + // The ID of the customer associated with the bank account to be stored. + CustomerID *string `json:"customer_id,omitempty" url:"-"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` +} + +func (c *CreateBankAccountRequest) require(field *big.Int) { + if c.explicitFields == nil { + c.explicitFields = big.NewInt(0) + } + c.explicitFields.Or(c.explicitFields, field) +} + +// SetIdempotencyKey sets the IdempotencyKey field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CreateBankAccountRequest) SetIdempotencyKey(idempotencyKey string) { + c.IdempotencyKey = idempotencyKey + c.require(createBankAccountRequestFieldIdempotencyKey) +} + +// SetSourceID sets the SourceID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CreateBankAccountRequest) SetSourceID(sourceID string) { + c.SourceID = sourceID + c.require(createBankAccountRequestFieldSourceID) +} + +// SetCustomerID sets the CustomerID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CreateBankAccountRequest) SetCustomerID(customerID *string) { + c.CustomerID = customerID + c.require(createBankAccountRequestFieldCustomerID) +} + +var ( + disableBankAccountRequestFieldBankAccountID = big.NewInt(1 << 0) +) + +type DisableBankAccountRequest struct { + // The ID of the bank account to disable. + BankAccountID string `json:"-" url:"-"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` +} + +func (d *DisableBankAccountRequest) require(field *big.Int) { + if d.explicitFields == nil { + d.explicitFields = big.NewInt(0) + } + d.explicitFields.Or(d.explicitFields, field) +} + +// SetBankAccountID sets the BankAccountID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DisableBankAccountRequest) SetBankAccountID(bankAccountID string) { + d.BankAccountID = bankAccountID + d.require(disableBankAccountRequestFieldBankAccountID) +} + var ( getByV1IDBankAccountsRequestFieldV1BankAccountID = big.NewInt(1 << 0) ) @@ -66,6 +140,7 @@ var ( listBankAccountsRequestFieldCursor = big.NewInt(1 << 0) listBankAccountsRequestFieldLimit = big.NewInt(1 << 1) listBankAccountsRequestFieldLocationID = big.NewInt(1 << 2) + listBankAccountsRequestFieldCustomerID = big.NewInt(1 << 3) ) type ListBankAccountsRequest struct { @@ -82,6 +157,9 @@ type ListBankAccountsRequest struct { // Location ID. You can specify this optional filter // to retrieve only the linked bank accounts belonging to a specific location. LocationID *string `json:"-" url:"location_id,omitempty"` + // Customer ID. You can specify this optional filter + // to retrieve only the linked bank accounts belonging to a specific customer. + CustomerID *string `json:"-" url:"customer_id,omitempty"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -115,6 +193,13 @@ func (l *ListBankAccountsRequest) SetLocationID(locationID *string) { l.require(listBankAccountsRequestFieldLocationID) } +// SetCustomerID sets the CustomerID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *ListBankAccountsRequest) SetCustomerID(customerID *string) { + l.CustomerID = customerID + l.require(listBankAccountsRequestFieldCustomerID) +} + // Represents a bank account. For more information about // linking a bank account to a Square account, see // [Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api). @@ -136,6 +221,7 @@ var ( bankAccountFieldFingerprint = big.NewInt(1 << 14) bankAccountFieldVersion = big.NewInt(1 << 15) bankAccountFieldBankName = big.NewInt(1 << 16) + bankAccountFieldCustomerID = big.NewInt(1 << 17) ) type BankAccount struct { @@ -188,6 +274,8 @@ type BankAccount struct { // Read only. Name of actual financial institution. // For example "Bank of America". BankName *string `json:"bank_name,omitempty" url:"bank_name,omitempty"` + // The ID of the customer who owns the bank account + CustomerID *string `json:"customer_id,omitempty" url:"customer_id,omitempty"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -315,6 +403,13 @@ func (b *BankAccount) GetBankName() *string { return b.BankName } +func (b *BankAccount) GetCustomerID() *string { + if b == nil { + return nil + } + return b.CustomerID +} + func (b *BankAccount) GetExtraProperties() map[string]interface{} { return b.extraProperties } @@ -445,6 +540,13 @@ func (b *BankAccount) SetBankName(bankName *string) { b.require(bankAccountFieldBankName) } +// SetCustomerID sets the CustomerID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BankAccount) SetCustomerID(customerID *string) { + b.CustomerID = customerID + b.require(bankAccountFieldCustomerID) +} + func (b *BankAccount) UnmarshalJSON(data []byte) error { type unmarshaler BankAccount var value unmarshaler @@ -542,6 +644,200 @@ func (b BankAccountType) Ptr() *BankAccountType { return &b } +// Response object returned by CreateBankAccount. +var ( + createBankAccountResponseFieldBankAccount = big.NewInt(1 << 0) + createBankAccountResponseFieldErrors = big.NewInt(1 << 1) +) + +type CreateBankAccountResponse struct { + // The 'BankAccount' that was created. + BankAccount *BankAccount `json:"bank_account,omitempty" url:"bank_account,omitempty"` + // Information on errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (c *CreateBankAccountResponse) GetBankAccount() *BankAccount { + if c == nil { + return nil + } + return c.BankAccount +} + +func (c *CreateBankAccountResponse) GetErrors() []*Error { + if c == nil { + return nil + } + return c.Errors +} + +func (c *CreateBankAccountResponse) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CreateBankAccountResponse) require(field *big.Int) { + if c.explicitFields == nil { + c.explicitFields = big.NewInt(0) + } + c.explicitFields.Or(c.explicitFields, field) +} + +// SetBankAccount sets the BankAccount field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CreateBankAccountResponse) SetBankAccount(bankAccount *BankAccount) { + c.BankAccount = bankAccount + c.require(createBankAccountResponseFieldBankAccount) +} + +// SetErrors sets the Errors field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CreateBankAccountResponse) SetErrors(errors []*Error) { + c.Errors = errors + c.require(createBankAccountResponseFieldErrors) +} + +func (c *CreateBankAccountResponse) UnmarshalJSON(data []byte) error { + type unmarshaler CreateBankAccountResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CreateBankAccountResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + c.rawJSON = json.RawMessage(data) + return nil +} + +func (c *CreateBankAccountResponse) MarshalJSON() ([]byte, error) { + type embed CreateBankAccountResponse + var marshaler = struct { + embed + }{ + embed: embed(*c), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, c.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (c *CreateBankAccountResponse) String() string { + if len(c.rawJSON) > 0 { + if value, err := internal.StringifyJSON(c.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Response object returned by `DisableBankAccount`. +var ( + disableBankAccountResponseFieldBankAccount = big.NewInt(1 << 0) + disableBankAccountResponseFieldErrors = big.NewInt(1 << 1) +) + +type DisableBankAccountResponse struct { + // The disabled 'BankAccount' + BankAccount *BankAccount `json:"bank_account,omitempty" url:"bank_account,omitempty"` + // Information on errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (d *DisableBankAccountResponse) GetBankAccount() *BankAccount { + if d == nil { + return nil + } + return d.BankAccount +} + +func (d *DisableBankAccountResponse) GetErrors() []*Error { + if d == nil { + return nil + } + return d.Errors +} + +func (d *DisableBankAccountResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DisableBankAccountResponse) require(field *big.Int) { + if d.explicitFields == nil { + d.explicitFields = big.NewInt(0) + } + d.explicitFields.Or(d.explicitFields, field) +} + +// SetBankAccount sets the BankAccount field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DisableBankAccountResponse) SetBankAccount(bankAccount *BankAccount) { + d.BankAccount = bankAccount + d.require(disableBankAccountResponseFieldBankAccount) +} + +// SetErrors sets the Errors field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DisableBankAccountResponse) SetErrors(errors []*Error) { + d.Errors = errors + d.require(disableBankAccountResponseFieldErrors) +} + +func (d *DisableBankAccountResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DisableBankAccountResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DisableBankAccountResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) + return nil +} + +func (d *DisableBankAccountResponse) MarshalJSON() ([]byte, error) { + type embed DisableBankAccountResponse + var marshaler = struct { + embed + }{ + embed: embed(*d), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, d.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (d *DisableBankAccountResponse) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + // Response object returned by GetBankAccountByV1Id. var ( getBankAccountByV1IDResponseFieldErrors = big.NewInt(1 << 0) @@ -641,15 +937,15 @@ func (g *GetBankAccountByV1IDResponse) String() string { // Response object returned by `GetBankAccount`. var ( - getBankAccountResponseFieldErrors = big.NewInt(1 << 0) - getBankAccountResponseFieldBankAccount = big.NewInt(1 << 1) + getBankAccountResponseFieldBankAccount = big.NewInt(1 << 0) + getBankAccountResponseFieldErrors = big.NewInt(1 << 1) ) 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"` + // Information on errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -658,18 +954,18 @@ type GetBankAccountResponse struct { rawJSON json.RawMessage } -func (g *GetBankAccountResponse) GetErrors() []*Error { +func (g *GetBankAccountResponse) GetBankAccount() *BankAccount { if g == nil { return nil } - return g.Errors + return g.BankAccount } -func (g *GetBankAccountResponse) GetBankAccount() *BankAccount { +func (g *GetBankAccountResponse) GetErrors() []*Error { if g == nil { return nil } - return g.BankAccount + return g.Errors } func (g *GetBankAccountResponse) GetExtraProperties() map[string]interface{} { @@ -683,13 +979,6 @@ func (g *GetBankAccountResponse) require(field *big.Int) { g.explicitFields.Or(g.explicitFields, field) } -// SetErrors sets the Errors field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (g *GetBankAccountResponse) SetErrors(errors []*Error) { - g.Errors = errors - g.require(getBankAccountResponseFieldErrors) -} - // SetBankAccount sets the BankAccount field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. func (g *GetBankAccountResponse) SetBankAccount(bankAccount *BankAccount) { @@ -697,6 +986,13 @@ func (g *GetBankAccountResponse) SetBankAccount(bankAccount *BankAccount) { g.require(getBankAccountResponseFieldBankAccount) } +// SetErrors sets the Errors field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetBankAccountResponse) SetErrors(errors []*Error) { + g.Errors = errors + g.require(getBankAccountResponseFieldErrors) +} + func (g *GetBankAccountResponse) UnmarshalJSON(data []byte) error { type unmarshaler GetBankAccountResponse var value unmarshaler @@ -738,16 +1034,16 @@ func (g *GetBankAccountResponse) String() string { // Response object returned by ListBankAccounts. var ( - listBankAccountsResponseFieldErrors = big.NewInt(1 << 0) - listBankAccountsResponseFieldBankAccounts = big.NewInt(1 << 1) + listBankAccountsResponseFieldBankAccounts = big.NewInt(1 << 0) + listBankAccountsResponseFieldErrors = big.NewInt(1 << 1) listBankAccountsResponseFieldCursor = big.NewInt(1 << 2) ) 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"` + // Information on errors encountered during the request. + Errors []*Error `json:"errors,omitempty" url:"errors,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. @@ -762,18 +1058,18 @@ type ListBankAccountsResponse struct { rawJSON json.RawMessage } -func (l *ListBankAccountsResponse) GetErrors() []*Error { +func (l *ListBankAccountsResponse) GetBankAccounts() []*BankAccount { if l == nil { return nil } - return l.Errors + return l.BankAccounts } -func (l *ListBankAccountsResponse) GetBankAccounts() []*BankAccount { +func (l *ListBankAccountsResponse) GetErrors() []*Error { if l == nil { return nil } - return l.BankAccounts + return l.Errors } func (l *ListBankAccountsResponse) GetCursor() *string { @@ -794,13 +1090,6 @@ func (l *ListBankAccountsResponse) require(field *big.Int) { l.explicitFields.Or(l.explicitFields, field) } -// SetErrors sets the Errors field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (l *ListBankAccountsResponse) SetErrors(errors []*Error) { - l.Errors = errors - l.require(listBankAccountsResponseFieldErrors) -} - // SetBankAccounts sets the BankAccounts field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. func (l *ListBankAccountsResponse) SetBankAccounts(bankAccounts []*BankAccount) { @@ -808,6 +1097,13 @@ func (l *ListBankAccountsResponse) SetBankAccounts(bankAccounts []*BankAccount) l.require(listBankAccountsResponseFieldBankAccounts) } +// SetErrors sets the Errors field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *ListBankAccountsResponse) SetErrors(errors []*Error) { + l.Errors = errors + l.require(listBankAccountsResponseFieldErrors) +} + // SetCursor sets the Cursor field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. func (l *ListBankAccountsResponse) SetCursor(cursor *string) { diff --git a/bankaccounts/client.go b/bankaccounts/client.go index 83afa33..97da044 100644 --- a/bankaccounts/client.go +++ b/bankaccounts/client.go @@ -4,10 +4,10 @@ package bankaccounts import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) @@ -99,6 +99,23 @@ func (c *Client) List( return pager.GetPage(ctx, request.Cursor) } +// Store a bank account on file for a square account +func (c *Client) CreateBankAccount( + ctx context.Context, + request *square.CreateBankAccountRequest, + opts ...option.RequestOption, +) (*square.CreateBankAccountResponse, error) { + response, err := c.WithRawResponse.CreateBankAccount( + ctx, + request, + opts..., + ) + if err != nil { + return nil, err + } + return response.Body, nil +} + // Returns details of a [BankAccount](entity:BankAccount) identified by V1 bank account ID. func (c *Client) GetByV1ID( ctx context.Context, @@ -116,8 +133,7 @@ func (c *Client) GetByV1ID( return response.Body, nil } -// Returns details of a [BankAccount](entity:BankAccount) -// linked to a Square account. +// Retrieve details of a [BankAccount](entity:BankAccount) bank account linked to a Square account. func (c *Client) Get( ctx context.Context, request *square.GetBankAccountsRequest, @@ -133,3 +149,20 @@ func (c *Client) Get( } return response.Body, nil } + +// Disable a bank account. +func (c *Client) DisableBankAccount( + ctx context.Context, + request *square.DisableBankAccountRequest, + opts ...option.RequestOption, +) (*square.DisableBankAccountResponse, error) { + response, err := c.WithRawResponse.DisableBankAccount( + ctx, + request, + opts..., + ) + if err != nil { + return nil, err + } + return response.Body, nil +} diff --git a/bankaccounts/raw_client.go b/bankaccounts/raw_client.go index 692a836..87fd414 100644 --- a/bankaccounts/raw_client.go +++ b/bankaccounts/raw_client.go @@ -4,10 +4,10 @@ package bankaccounts import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) @@ -30,6 +30,48 @@ func NewRawClient(options *core.RequestOptions) *RawClient { } } +func (r *RawClient) CreateBankAccount( + ctx context.Context, + request *square.CreateBankAccountRequest, + opts ...option.RequestOption, +) (*core.Response[*square.CreateBankAccountResponse], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://connect.squareup.com", + ) + endpointURL := baseURL + "/v2/bank-accounts" + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + headers.Add("Content-Type", "application/json") + var response *square.CreateBankAccountResponse + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: headers, + MaxAttempts: options.MaxAttempts, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Request: request, + Response: &response, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[*square.CreateBankAccountResponse]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: response, + }, nil +} + func (r *RawClient) GetByV1ID( ctx context.Context, request *square.GetByV1IDBankAccountsRequest, @@ -115,3 +157,46 @@ func (r *RawClient) Get( Body: response, }, nil } + +func (r *RawClient) DisableBankAccount( + ctx context.Context, + request *square.DisableBankAccountRequest, + opts ...option.RequestOption, +) (*core.Response[*square.DisableBankAccountResponse], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://connect.squareup.com", + ) + endpointURL := internal.EncodeURL( + baseURL+"/v2/bank-accounts/%v/disable", + request.BankAccountID, + ) + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + var response *square.DisableBankAccountResponse + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: headers, + MaxAttempts: options.MaxAttempts, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Response: &response, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[*square.DisableBankAccountResponse]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: response, + }, nil +} diff --git a/bookings.go b/bookings.go index 58cd476..c2b2d1b 100644 --- a/bookings.go +++ b/bookings.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" big "math/big" ) diff --git a/bookings/client/client.go b/bookings/client/client.go index ad4dec3..834464b 100644 --- a/bookings/client/client.go +++ b/bookings/client/client.go @@ -4,14 +4,14 @@ package client import ( context "context" - square "github.com/square/square-go-sdk/v2" - customattributedefinitions "github.com/square/square-go-sdk/v2/bookings/customattributedefinitions" - customattributes "github.com/square/square-go-sdk/v2/bookings/customattributes" - locationprofiles "github.com/square/square-go-sdk/v2/bookings/locationprofiles" - teammemberprofiles "github.com/square/square-go-sdk/v2/bookings/teammemberprofiles" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + customattributedefinitions "github.com/square/square-go-sdk/v3/bookings/customattributedefinitions" + customattributes "github.com/square/square-go-sdk/v3/bookings/customattributes" + locationprofiles "github.com/square/square-go-sdk/v3/bookings/locationprofiles" + teammemberprofiles "github.com/square/square-go-sdk/v3/bookings/teammemberprofiles" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/bookings/client/raw_client.go b/bookings/client/raw_client.go index 2498dcc..358d357 100644 --- a/bookings/client/raw_client.go +++ b/bookings/client/raw_client.go @@ -4,10 +4,10 @@ package client import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/bookings/custom_attribute_definitions.go b/bookings/custom_attribute_definitions.go index 8f6e2ad..dbfb977 100644 --- a/bookings/custom_attribute_definitions.go +++ b/bookings/custom_attribute_definitions.go @@ -3,7 +3,7 @@ package bookings import ( - v2 "github.com/square/square-go-sdk/v2" + v3 "github.com/square/square-go-sdk/v3" big "math/big" ) @@ -28,7 +28,7 @@ type CreateBookingCustomAttributeDefinitionRequest struct { // - `schema`. With the exception of the `Selection` data type, the `schema` is specified as a // simple URL to the JSON schema definition hosted on the Square CDN. For more information, see // [Specifying the schema](https://developer.squareup.com/docs/booking-custom-attributes-api/custom-attribute-definitions#specify-schema). - CustomAttributeDefinition *v2.CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"-"` + CustomAttributeDefinition *v3.CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"-"` // A unique identifier for this request, used to ensure idempotency. For more information, // see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). IdempotencyKey *string `json:"idempotency_key,omitempty" url:"-"` @@ -46,7 +46,7 @@ func (c *CreateBookingCustomAttributeDefinitionRequest) require(field *big.Int) // SetCustomAttributeDefinition sets the CustomAttributeDefinition field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *CreateBookingCustomAttributeDefinitionRequest) SetCustomAttributeDefinition(customAttributeDefinition *v2.CustomAttributeDefinition) { +func (c *CreateBookingCustomAttributeDefinitionRequest) SetCustomAttributeDefinition(customAttributeDefinition *v3.CustomAttributeDefinition) { c.CustomAttributeDefinition = customAttributeDefinition c.require(createBookingCustomAttributeDefinitionRequestFieldCustomAttributeDefinition) } @@ -185,7 +185,7 @@ type UpdateBookingCustomAttributeDefinitionRequest struct { // // To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) // control, include the optional `version` field and specify the current version of the custom attribute definition. - CustomAttributeDefinition *v2.CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"-"` + CustomAttributeDefinition *v3.CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"-"` // A unique identifier for this request, used to ensure idempotency. For more information, // see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). IdempotencyKey *string `json:"idempotency_key,omitempty" url:"-"` @@ -210,7 +210,7 @@ func (u *UpdateBookingCustomAttributeDefinitionRequest) SetKey(key string) { // SetCustomAttributeDefinition sets the CustomAttributeDefinition field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (u *UpdateBookingCustomAttributeDefinitionRequest) SetCustomAttributeDefinition(customAttributeDefinition *v2.CustomAttributeDefinition) { +func (u *UpdateBookingCustomAttributeDefinitionRequest) SetCustomAttributeDefinition(customAttributeDefinition *v3.CustomAttributeDefinition) { u.CustomAttributeDefinition = customAttributeDefinition u.require(updateBookingCustomAttributeDefinitionRequestFieldCustomAttributeDefinition) } diff --git a/bookings/custom_attributes.go b/bookings/custom_attributes.go index c418c78..88ba7df 100644 --- a/bookings/custom_attributes.go +++ b/bookings/custom_attributes.go @@ -3,7 +3,7 @@ package bookings import ( - v2 "github.com/square/square-go-sdk/v2" + v3 "github.com/square/square-go-sdk/v3" big "math/big" ) @@ -15,7 +15,7 @@ type BulkDeleteBookingCustomAttributesRequest struct { // A map containing 1 to 25 individual Delete requests. For each request, provide an // arbitrary ID that is unique for this `BulkDeleteBookingCustomAttributes` request and the // information needed to delete a custom attribute. - Values map[string]*v2.BookingCustomAttributeDeleteRequest `json:"values,omitempty" url:"-"` + Values map[string]*v3.BookingCustomAttributeDeleteRequest `json:"values,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -30,7 +30,7 @@ func (b *BulkDeleteBookingCustomAttributesRequest) require(field *big.Int) { // SetValues sets the Values field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (b *BulkDeleteBookingCustomAttributesRequest) SetValues(values map[string]*v2.BookingCustomAttributeDeleteRequest) { +func (b *BulkDeleteBookingCustomAttributesRequest) SetValues(values map[string]*v3.BookingCustomAttributeDeleteRequest) { b.Values = values b.require(bulkDeleteBookingCustomAttributesRequestFieldValues) } @@ -43,7 +43,7 @@ type BulkUpsertBookingCustomAttributesRequest struct { // A map containing 1 to 25 individual upsert requests. For each request, provide an // arbitrary ID that is unique for this `BulkUpsertBookingCustomAttributes` request and the // information needed to create or update a custom attribute. - Values map[string]*v2.BookingCustomAttributeUpsertRequest `json:"values,omitempty" url:"-"` + Values map[string]*v3.BookingCustomAttributeUpsertRequest `json:"values,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -58,7 +58,7 @@ func (b *BulkUpsertBookingCustomAttributesRequest) require(field *big.Int) { // SetValues sets the Values field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (b *BulkUpsertBookingCustomAttributesRequest) SetValues(values map[string]*v2.BookingCustomAttributeUpsertRequest) { +func (b *BulkUpsertBookingCustomAttributesRequest) SetValues(values map[string]*v3.BookingCustomAttributeUpsertRequest) { b.Values = values b.require(bulkUpsertBookingCustomAttributesRequestFieldValues) } @@ -248,7 +248,7 @@ type UpsertBookingCustomAttributeRequest struct { // - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) // control for an update operation, include this optional field and specify the current version // of the custom attribute. - CustomAttribute *v2.CustomAttribute `json:"custom_attribute,omitempty" url:"-"` + CustomAttribute *v3.CustomAttribute `json:"custom_attribute,omitempty" url:"-"` // A unique identifier for this request, used to ensure idempotency. For more information, // see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). IdempotencyKey *string `json:"idempotency_key,omitempty" url:"-"` @@ -280,7 +280,7 @@ func (u *UpsertBookingCustomAttributeRequest) SetKey(key string) { // SetCustomAttribute sets the CustomAttribute field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (u *UpsertBookingCustomAttributeRequest) SetCustomAttribute(customAttribute *v2.CustomAttribute) { +func (u *UpsertBookingCustomAttributeRequest) SetCustomAttribute(customAttribute *v3.CustomAttribute) { u.CustomAttribute = customAttribute u.require(upsertBookingCustomAttributeRequestFieldCustomAttribute) } diff --git a/bookings/customattributedefinitions/client.go b/bookings/customattributedefinitions/client.go index 83398f2..1bda5e6 100644 --- a/bookings/customattributedefinitions/client.go +++ b/bookings/customattributedefinitions/client.go @@ -4,11 +4,11 @@ package customattributedefinitions import ( context "context" - square "github.com/square/square-go-sdk/v2" - bookings "github.com/square/square-go-sdk/v2/bookings" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + bookings "github.com/square/square-go-sdk/v3/bookings" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/bookings/customattributedefinitions/raw_client.go b/bookings/customattributedefinitions/raw_client.go index 06f68ef..7c6d689 100644 --- a/bookings/customattributedefinitions/raw_client.go +++ b/bookings/customattributedefinitions/raw_client.go @@ -4,11 +4,11 @@ package customattributedefinitions import ( context "context" - square "github.com/square/square-go-sdk/v2" - bookings "github.com/square/square-go-sdk/v2/bookings" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + bookings "github.com/square/square-go-sdk/v3/bookings" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/bookings/customattributes/client.go b/bookings/customattributes/client.go index dd14d64..6da9f63 100644 --- a/bookings/customattributes/client.go +++ b/bookings/customattributes/client.go @@ -4,11 +4,11 @@ package customattributes import ( context "context" - square "github.com/square/square-go-sdk/v2" - bookings "github.com/square/square-go-sdk/v2/bookings" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + bookings "github.com/square/square-go-sdk/v3/bookings" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/bookings/customattributes/raw_client.go b/bookings/customattributes/raw_client.go index 613bb20..99a8894 100644 --- a/bookings/customattributes/raw_client.go +++ b/bookings/customattributes/raw_client.go @@ -4,11 +4,11 @@ package customattributes import ( context "context" - square "github.com/square/square-go-sdk/v2" - bookings "github.com/square/square-go-sdk/v2/bookings" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + bookings "github.com/square/square-go-sdk/v3/bookings" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/bookings/error_codes.go b/bookings/error_codes.go new file mode 100644 index 0000000..04245e9 --- /dev/null +++ b/bookings/error_codes.go @@ -0,0 +1,9 @@ +// Code generated by Fern. DO NOT EDIT. + +package bookings + +import ( + internal "github.com/square/square-go-sdk/v3/internal" +) + +var ErrorCodes internal.ErrorCodes = internal.ErrorCodes{} diff --git a/bookings/locationprofiles/client.go b/bookings/locationprofiles/client.go index 1314cc4..7221ffc 100644 --- a/bookings/locationprofiles/client.go +++ b/bookings/locationprofiles/client.go @@ -4,11 +4,11 @@ package locationprofiles import ( context "context" - square "github.com/square/square-go-sdk/v2" - bookings "github.com/square/square-go-sdk/v2/bookings" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + bookings "github.com/square/square-go-sdk/v3/bookings" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/bookings/locationprofiles/raw_client.go b/bookings/locationprofiles/raw_client.go index 99aef9b..a671117 100644 --- a/bookings/locationprofiles/raw_client.go +++ b/bookings/locationprofiles/raw_client.go @@ -3,8 +3,8 @@ package locationprofiles import ( - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" ) type RawClient struct { diff --git a/bookings/teammemberprofiles/client.go b/bookings/teammemberprofiles/client.go index 17784e3..c6e6b8e 100644 --- a/bookings/teammemberprofiles/client.go +++ b/bookings/teammemberprofiles/client.go @@ -4,11 +4,11 @@ package teammemberprofiles import ( context "context" - square "github.com/square/square-go-sdk/v2" - bookings "github.com/square/square-go-sdk/v2/bookings" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + bookings "github.com/square/square-go-sdk/v3/bookings" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/bookings/teammemberprofiles/raw_client.go b/bookings/teammemberprofiles/raw_client.go index 497bf9a..152c073 100644 --- a/bookings/teammemberprofiles/raw_client.go +++ b/bookings/teammemberprofiles/raw_client.go @@ -4,11 +4,11 @@ package teammemberprofiles import ( context "context" - square "github.com/square/square-go-sdk/v2" - bookings "github.com/square/square-go-sdk/v2/bookings" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + bookings "github.com/square/square-go-sdk/v3/bookings" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/cards.go b/cards.go index f8fad8f..9ab8960 100644 --- a/cards.go +++ b/cards.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" big "math/big" ) diff --git a/cards/client.go b/cards/client.go index a6bc184..1178fef 100644 --- a/cards/client.go +++ b/cards/client.go @@ -4,10 +4,10 @@ package cards import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/cards/raw_client.go b/cards/raw_client.go index 1068e91..32bca07 100644 --- a/cards/raw_client.go +++ b/cards/raw_client.go @@ -4,10 +4,10 @@ package cards import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/cashdrawers/client/client.go b/cashdrawers/client/client.go index 8cf36dc..507d356 100644 --- a/cashdrawers/client/client.go +++ b/cashdrawers/client/client.go @@ -3,9 +3,9 @@ package client import ( - shifts "github.com/square/square-go-sdk/v2/cashdrawers/shifts" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" + shifts "github.com/square/square-go-sdk/v3/cashdrawers/shifts" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" os "os" ) diff --git a/cashdrawers/error_codes.go b/cashdrawers/error_codes.go new file mode 100644 index 0000000..015635c --- /dev/null +++ b/cashdrawers/error_codes.go @@ -0,0 +1,9 @@ +// Code generated by Fern. DO NOT EDIT. + +package cashdrawers + +import ( + internal "github.com/square/square-go-sdk/v3/internal" +) + +var ErrorCodes internal.ErrorCodes = internal.ErrorCodes{} diff --git a/cashdrawers/shifts.go b/cashdrawers/shifts.go index 884166b..3ad8662 100644 --- a/cashdrawers/shifts.go +++ b/cashdrawers/shifts.go @@ -3,7 +3,7 @@ package cashdrawers import ( - v2 "github.com/square/square-go-sdk/v2" + v3 "github.com/square/square-go-sdk/v3" big "math/big" ) @@ -57,7 +57,7 @@ type ListShiftsRequest struct { LocationID string `json:"-" url:"location_id"` // The order in which cash drawer shifts are listed in the response, // based on their opened_at field. Default value: ASC - SortOrder *v2.SortOrder `json:"-" url:"sort_order,omitempty"` + SortOrder *v3.SortOrder `json:"-" url:"sort_order,omitempty"` // The inclusive start time of the query on opened_at, in ISO 8601 format. BeginTime *string `json:"-" url:"begin_time,omitempty"` // The exclusive end date of the query on opened_at, in ISO 8601 format. @@ -88,7 +88,7 @@ func (l *ListShiftsRequest) SetLocationID(locationID string) { // SetSortOrder sets the SortOrder field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (l *ListShiftsRequest) SetSortOrder(sortOrder *v2.SortOrder) { +func (l *ListShiftsRequest) SetSortOrder(sortOrder *v3.SortOrder) { l.SortOrder = sortOrder l.require(listShiftsRequestFieldSortOrder) } diff --git a/cashdrawers/shifts/client.go b/cashdrawers/shifts/client.go index 9b33bea..a15b736 100644 --- a/cashdrawers/shifts/client.go +++ b/cashdrawers/shifts/client.go @@ -4,11 +4,11 @@ package shifts import ( context "context" - square "github.com/square/square-go-sdk/v2" - cashdrawers "github.com/square/square-go-sdk/v2/cashdrawers" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + cashdrawers "github.com/square/square-go-sdk/v3/cashdrawers" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/cashdrawers/shifts/raw_client.go b/cashdrawers/shifts/raw_client.go index 23b945e..f3a7bb9 100644 --- a/cashdrawers/shifts/raw_client.go +++ b/cashdrawers/shifts/raw_client.go @@ -4,11 +4,11 @@ package shifts import ( context "context" - square "github.com/square/square-go-sdk/v2" - cashdrawers "github.com/square/square-go-sdk/v2/cashdrawers" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + cashdrawers "github.com/square/square-go-sdk/v3/cashdrawers" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/catalog.go b/catalog.go index 828c25b..0a8bcf4 100644 --- a/catalog.go +++ b/catalog.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" big "math/big" ) diff --git a/catalog/client/client.go b/catalog/client/client.go index cfb01bf..7a29df9 100644 --- a/catalog/client/client.go +++ b/catalog/client/client.go @@ -4,12 +4,12 @@ package client import ( context "context" - square "github.com/square/square-go-sdk/v2" - images "github.com/square/square-go-sdk/v2/catalog/images" - object "github.com/square/square-go-sdk/v2/catalog/object" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + images "github.com/square/square-go-sdk/v3/catalog/images" + object "github.com/square/square-go-sdk/v3/catalog/object" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/catalog/client/raw_client.go b/catalog/client/raw_client.go index be50016..6257ca5 100644 --- a/catalog/client/raw_client.go +++ b/catalog/client/raw_client.go @@ -4,10 +4,10 @@ package client import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/catalog/error_codes.go b/catalog/error_codes.go new file mode 100644 index 0000000..0de507c --- /dev/null +++ b/catalog/error_codes.go @@ -0,0 +1,9 @@ +// Code generated by Fern. DO NOT EDIT. + +package catalog + +import ( + internal "github.com/square/square-go-sdk/v3/internal" +) + +var ErrorCodes internal.ErrorCodes = internal.ErrorCodes{} diff --git a/catalog/images.go b/catalog/images.go index 595bb26..9abc1b9 100644 --- a/catalog/images.go +++ b/catalog/images.go @@ -3,14 +3,14 @@ package catalog import ( - v2 "github.com/square/square-go-sdk/v2" + v3 "github.com/square/square-go-sdk/v3" io "io" big "math/big" ) type CreateImagesRequest struct { ImageFile io.Reader `json:"-" url:"-"` - Request *v2.CreateCatalogImageRequest `json:"request,omitempty" url:"-"` + Request *v3.CreateCatalogImageRequest `json:"request,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -31,7 +31,7 @@ type UpdateImagesRequest struct { // The ID of the `CatalogImage` object to update the encapsulated image file. ImageID string `json:"-" url:"-"` ImageFile io.Reader `json:"-" url:"-"` - Request *v2.UpdateCatalogImageRequest `json:"request,omitempty" url:"-"` + Request *v3.UpdateCatalogImageRequest `json:"request,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` diff --git a/catalog/images/client.go b/catalog/images/client.go index 8394741..ca6014f 100644 --- a/catalog/images/client.go +++ b/catalog/images/client.go @@ -4,11 +4,11 @@ package images import ( context "context" - square "github.com/square/square-go-sdk/v2" - catalog "github.com/square/square-go-sdk/v2/catalog" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + catalog "github.com/square/square-go-sdk/v3/catalog" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" os "os" ) diff --git a/catalog/images/raw_client.go b/catalog/images/raw_client.go index 5a10ddb..70f2d7d 100644 --- a/catalog/images/raw_client.go +++ b/catalog/images/raw_client.go @@ -4,11 +4,11 @@ package images import ( context "context" - square "github.com/square/square-go-sdk/v2" - catalog "github.com/square/square-go-sdk/v2/catalog" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + catalog "github.com/square/square-go-sdk/v3/catalog" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/catalog/object.go b/catalog/object.go index 5d53ffe..11ab30b 100644 --- a/catalog/object.go +++ b/catalog/object.go @@ -3,7 +3,7 @@ package catalog import ( - v2 "github.com/square/square-go-sdk/v2" + v3 "github.com/square/square-go-sdk/v3" big "math/big" ) @@ -131,7 +131,7 @@ type UpsertCatalogObjectRequest struct { // // - For updates, the object must be active (the `is_deleted` field is not `true`). // - For creates, the object ID must start with `#`. The provided ID is replaced with a server-generated ID. - Object *v2.CatalogObject `json:"object,omitempty" url:"-"` + Object *v3.CatalogObject `json:"object,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -153,7 +153,7 @@ func (u *UpsertCatalogObjectRequest) SetIdempotencyKey(idempotencyKey string) { // SetObject sets the Object field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (u *UpsertCatalogObjectRequest) SetObject(object *v2.CatalogObject) { +func (u *UpsertCatalogObjectRequest) SetObject(object *v3.CatalogObject) { u.Object = object u.require(upsertCatalogObjectRequestFieldObject) } diff --git a/catalog/object/client.go b/catalog/object/client.go index 8af4b98..9c96e88 100644 --- a/catalog/object/client.go +++ b/catalog/object/client.go @@ -4,11 +4,11 @@ package object import ( context "context" - square "github.com/square/square-go-sdk/v2" - catalog "github.com/square/square-go-sdk/v2/catalog" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + catalog "github.com/square/square-go-sdk/v3/catalog" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" os "os" ) diff --git a/catalog/object/raw_client.go b/catalog/object/raw_client.go index 032ea1c..8a8a351 100644 --- a/catalog/object/raw_client.go +++ b/catalog/object/raw_client.go @@ -4,11 +4,11 @@ package object import ( context "context" - square "github.com/square/square-go-sdk/v2" - catalog "github.com/square/square-go-sdk/v2/catalog" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + catalog "github.com/square/square-go-sdk/v3/catalog" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/channels.go b/channels.go index 4e95c96..ad043ba 100644 --- a/channels.go +++ b/channels.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" big "math/big" ) diff --git a/channels/client.go b/channels/client.go index d60c874..b6962ea 100644 --- a/channels/client.go +++ b/channels/client.go @@ -4,10 +4,10 @@ package channels import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/channels/raw_client.go b/channels/raw_client.go index 25d71f0..cf493ca 100644 --- a/channels/raw_client.go +++ b/channels/raw_client.go @@ -4,10 +4,10 @@ package channels import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/checkout.go b/checkout.go index ad8dd67..b086247 100644 --- a/checkout.go +++ b/checkout.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" big "math/big" ) diff --git a/checkout/client/client.go b/checkout/client/client.go index 03c9843..f2f3474 100644 --- a/checkout/client/client.go +++ b/checkout/client/client.go @@ -4,11 +4,11 @@ package client import ( context "context" - square "github.com/square/square-go-sdk/v2" - paymentlinks "github.com/square/square-go-sdk/v2/checkout/paymentlinks" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + paymentlinks "github.com/square/square-go-sdk/v3/checkout/paymentlinks" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" os "os" ) diff --git a/checkout/client/raw_client.go b/checkout/client/raw_client.go index 65a1541..641e066 100644 --- a/checkout/client/raw_client.go +++ b/checkout/client/raw_client.go @@ -4,10 +4,10 @@ package client import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/checkout/error_codes.go b/checkout/error_codes.go new file mode 100644 index 0000000..9c1e8a4 --- /dev/null +++ b/checkout/error_codes.go @@ -0,0 +1,9 @@ +// Code generated by Fern. DO NOT EDIT. + +package checkout + +import ( + internal "github.com/square/square-go-sdk/v3/internal" +) + +var ErrorCodes internal.ErrorCodes = internal.ErrorCodes{} diff --git a/checkout/payment_links.go b/checkout/payment_links.go index eedd46d..fedbf7b 100644 --- a/checkout/payment_links.go +++ b/checkout/payment_links.go @@ -3,7 +3,7 @@ package checkout import ( - v2 "github.com/square/square-go-sdk/v2" + v3 "github.com/square/square-go-sdk/v3" big "math/big" ) @@ -30,18 +30,18 @@ type CreatePaymentLinkRequest struct { // Describes an ad hoc item and price for which to generate a quick pay checkout link. // For more information, // see [Quick Pay Checkout](https://developer.squareup.com/docs/checkout-api/quick-pay-checkout). - QuickPay *v2.QuickPay `json:"quick_pay,omitempty" url:"-"` + QuickPay *v3.QuickPay `json:"quick_pay,omitempty" url:"-"` // Describes the `Order` for which to create a checkout link. // For more information, // see [Square Order Checkout](https://developer.squareup.com/docs/checkout-api/square-order-checkout). - Order *v2.Order `json:"order,omitempty" url:"-"` + Order *v3.Order `json:"order,omitempty" url:"-"` // Describes optional fields to add to the resulting checkout page. // For more information, // see [Optional Checkout Configurations](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations). - CheckoutOptions *v2.CheckoutOptions `json:"checkout_options,omitempty" url:"-"` + CheckoutOptions *v3.CheckoutOptions `json:"checkout_options,omitempty" url:"-"` // Describes fields to prepopulate in the resulting checkout page. // For more information, see [Prepopulate the shipping address](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations#prepopulate-the-shipping-address). - PrePopulatedData *v2.PrePopulatedData `json:"pre_populated_data,omitempty" url:"-"` + PrePopulatedData *v3.PrePopulatedData `json:"pre_populated_data,omitempty" url:"-"` // A note for the payment. After processing the payment, Square adds this note to the resulting `Payment`. PaymentNote *string `json:"payment_note,omitempty" url:"-"` @@ -72,28 +72,28 @@ func (c *CreatePaymentLinkRequest) SetDescription(description *string) { // SetQuickPay sets the QuickPay field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *CreatePaymentLinkRequest) SetQuickPay(quickPay *v2.QuickPay) { +func (c *CreatePaymentLinkRequest) SetQuickPay(quickPay *v3.QuickPay) { c.QuickPay = quickPay c.require(createPaymentLinkRequestFieldQuickPay) } // SetOrder sets the Order field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *CreatePaymentLinkRequest) SetOrder(order *v2.Order) { +func (c *CreatePaymentLinkRequest) SetOrder(order *v3.Order) { c.Order = order c.require(createPaymentLinkRequestFieldOrder) } // SetCheckoutOptions sets the CheckoutOptions field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *CreatePaymentLinkRequest) SetCheckoutOptions(checkoutOptions *v2.CheckoutOptions) { +func (c *CreatePaymentLinkRequest) SetCheckoutOptions(checkoutOptions *v3.CheckoutOptions) { c.CheckoutOptions = checkoutOptions c.require(createPaymentLinkRequestFieldCheckoutOptions) } // SetPrePopulatedData sets the PrePopulatedData field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *CreatePaymentLinkRequest) SetPrePopulatedData(prePopulatedData *v2.PrePopulatedData) { +func (c *CreatePaymentLinkRequest) SetPrePopulatedData(prePopulatedData *v3.PrePopulatedData) { c.PrePopulatedData = prePopulatedData c.require(createPaymentLinkRequestFieldPrePopulatedData) } @@ -210,7 +210,7 @@ type UpdatePaymentLinkRequest struct { ID string `json:"-" url:"-"` // The `payment_link` object describing the updates to apply. // For more information, see [Update a payment link](https://developer.squareup.com/docs/checkout-api/manage-checkout#update-a-payment-link). - PaymentLink *v2.PaymentLink `json:"payment_link,omitempty" url:"-"` + PaymentLink *v3.PaymentLink `json:"payment_link,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -232,7 +232,7 @@ func (u *UpdatePaymentLinkRequest) SetID(id string) { // SetPaymentLink sets the PaymentLink field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (u *UpdatePaymentLinkRequest) SetPaymentLink(paymentLink *v2.PaymentLink) { +func (u *UpdatePaymentLinkRequest) SetPaymentLink(paymentLink *v3.PaymentLink) { u.PaymentLink = paymentLink u.require(updatePaymentLinkRequestFieldPaymentLink) } diff --git a/checkout/paymentlinks/client.go b/checkout/paymentlinks/client.go index 1eb79e1..f19459e 100644 --- a/checkout/paymentlinks/client.go +++ b/checkout/paymentlinks/client.go @@ -4,11 +4,11 @@ package paymentlinks import ( context "context" - square "github.com/square/square-go-sdk/v2" - checkout "github.com/square/square-go-sdk/v2/checkout" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + checkout "github.com/square/square-go-sdk/v3/checkout" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/checkout/paymentlinks/raw_client.go b/checkout/paymentlinks/raw_client.go index b16ad1d..fba1b2d 100644 --- a/checkout/paymentlinks/raw_client.go +++ b/checkout/paymentlinks/raw_client.go @@ -4,11 +4,11 @@ package paymentlinks import ( context "context" - square "github.com/square/square-go-sdk/v2" - checkout "github.com/square/square-go-sdk/v2/checkout" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + checkout "github.com/square/square-go-sdk/v3/checkout" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/client/client.go b/client/client.go index ee0d1cd..8c568a5 100644 --- a/client/client.go +++ b/client/client.go @@ -3,50 +3,49 @@ package client import ( - applepay "github.com/square/square-go-sdk/v2/applepay" - bankaccounts "github.com/square/square-go-sdk/v2/bankaccounts" - client "github.com/square/square-go-sdk/v2/bookings/client" - cards "github.com/square/square-go-sdk/v2/cards" - cashdrawersclient "github.com/square/square-go-sdk/v2/cashdrawers/client" - catalogclient "github.com/square/square-go-sdk/v2/catalog/client" - channels "github.com/square/square-go-sdk/v2/channels" - checkoutclient "github.com/square/square-go-sdk/v2/checkout/client" - core "github.com/square/square-go-sdk/v2/core" - customersclient "github.com/square/square-go-sdk/v2/customers/client" - devicesclient "github.com/square/square-go-sdk/v2/devices/client" - disputesclient "github.com/square/square-go-sdk/v2/disputes/client" - employees "github.com/square/square-go-sdk/v2/employees" - events "github.com/square/square-go-sdk/v2/events" - giftcardsclient "github.com/square/square-go-sdk/v2/giftcards/client" - internal "github.com/square/square-go-sdk/v2/internal" - inventory "github.com/square/square-go-sdk/v2/inventory" - invoices "github.com/square/square-go-sdk/v2/invoices" - laborclient "github.com/square/square-go-sdk/v2/labor/client" - locationsclient "github.com/square/square-go-sdk/v2/locations/client" - loyaltyclient "github.com/square/square-go-sdk/v2/loyalty/client" - merchantsclient "github.com/square/square-go-sdk/v2/merchants/client" - mobile "github.com/square/square-go-sdk/v2/mobile" - oauth "github.com/square/square-go-sdk/v2/oauth" - option "github.com/square/square-go-sdk/v2/option" - ordersclient "github.com/square/square-go-sdk/v2/orders/client" - payments "github.com/square/square-go-sdk/v2/payments" - payouts "github.com/square/square-go-sdk/v2/payouts" - refunds "github.com/square/square-go-sdk/v2/refunds" - sites "github.com/square/square-go-sdk/v2/sites" - snippets "github.com/square/square-go-sdk/v2/snippets" - subscriptions "github.com/square/square-go-sdk/v2/subscriptions" - team "github.com/square/square-go-sdk/v2/team" - teammembersclient "github.com/square/square-go-sdk/v2/teammembers/client" - terminalclient "github.com/square/square-go-sdk/v2/terminal/client" - transferorders "github.com/square/square-go-sdk/v2/transferorders" - v1transactions "github.com/square/square-go-sdk/v2/v1transactions" - vendors "github.com/square/square-go-sdk/v2/vendors" - webhooksclient "github.com/square/square-go-sdk/v2/webhooks/client" + applepay "github.com/square/square-go-sdk/v3/applepay" + bankaccounts "github.com/square/square-go-sdk/v3/bankaccounts" + client "github.com/square/square-go-sdk/v3/bookings/client" + cards "github.com/square/square-go-sdk/v3/cards" + cashdrawersclient "github.com/square/square-go-sdk/v3/cashdrawers/client" + catalogclient "github.com/square/square-go-sdk/v3/catalog/client" + channels "github.com/square/square-go-sdk/v3/channels" + checkoutclient "github.com/square/square-go-sdk/v3/checkout/client" + core "github.com/square/square-go-sdk/v3/core" + customersclient "github.com/square/square-go-sdk/v3/customers/client" + devicesclient "github.com/square/square-go-sdk/v3/devices/client" + disputesclient "github.com/square/square-go-sdk/v3/disputes/client" + employees "github.com/square/square-go-sdk/v3/employees" + events "github.com/square/square-go-sdk/v3/events" + giftcardsclient "github.com/square/square-go-sdk/v3/giftcards/client" + internal "github.com/square/square-go-sdk/v3/internal" + inventory "github.com/square/square-go-sdk/v3/inventory" + invoices "github.com/square/square-go-sdk/v3/invoices" + laborclient "github.com/square/square-go-sdk/v3/labor/client" + locationsclient "github.com/square/square-go-sdk/v3/locations/client" + loyaltyclient "github.com/square/square-go-sdk/v3/loyalty/client" + merchantsclient "github.com/square/square-go-sdk/v3/merchants/client" + mobile "github.com/square/square-go-sdk/v3/mobile" + oauth "github.com/square/square-go-sdk/v3/oauth" + option "github.com/square/square-go-sdk/v3/option" + ordersclient "github.com/square/square-go-sdk/v3/orders/client" + payments "github.com/square/square-go-sdk/v3/payments" + payouts "github.com/square/square-go-sdk/v3/payouts" + refunds "github.com/square/square-go-sdk/v3/refunds" + sites "github.com/square/square-go-sdk/v3/sites" + snippets "github.com/square/square-go-sdk/v3/snippets" + subscriptions "github.com/square/square-go-sdk/v3/subscriptions" + team "github.com/square/square-go-sdk/v3/team" + teammembersclient "github.com/square/square-go-sdk/v3/teammembers/client" + terminalclient "github.com/square/square-go-sdk/v3/terminal/client" + transferorders "github.com/square/square-go-sdk/v3/transferorders" + v1transactions "github.com/square/square-go-sdk/v3/v1transactions" + vendors "github.com/square/square-go-sdk/v3/vendors" + webhooksclient "github.com/square/square-go-sdk/v3/webhooks/client" os "os" ) type Client struct { - Mobile *mobile.Client OAuth *oauth.Client V1Transactions *v1transactions.Client ApplePay *applepay.Client @@ -80,6 +79,7 @@ type Client struct { Terminal *terminalclient.Client TransferOrders *transferorders.Client Vendors *vendors.Client + Mobile *mobile.Client CashDrawers *cashdrawersclient.Client Webhooks *webhooksclient.Client @@ -97,7 +97,6 @@ func NewClient(opts ...option.RequestOption) *Client { options.Version = os.Getenv("VERSION") } return &Client{ - Mobile: mobile.NewClient(options), OAuth: oauth.NewClient(options), V1Transactions: v1transactions.NewClient(options), ApplePay: applepay.NewClient(options), @@ -131,6 +130,7 @@ func NewClient(opts ...option.RequestOption) *Client { Terminal: terminalclient.NewClient(options), TransferOrders: transferorders.NewClient(options), Vendors: vendors.NewClient(options), + Mobile: mobile.NewClient(options), CashDrawers: cashdrawersclient.NewClient(options), Webhooks: webhooksclient.NewClient(options), options: options, diff --git a/client/client_test.go b/client/client_test.go index 3289469..776437a 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -3,7 +3,7 @@ package client import ( - option "github.com/square/square-go-sdk/v2/option" + option "github.com/square/square-go-sdk/v3/option" assert "github.com/stretchr/testify/assert" http "net/http" testing "testing" diff --git a/core/request_option.go b/core/request_option.go index d923e27..8e42869 100644 --- a/core/request_option.go +++ b/core/request_option.go @@ -52,7 +52,7 @@ func (r *RequestOptions) ToHeader() http.Header { if r.Token != "" { header.Set("Authorization", "Bearer "+r.Token) } - version := fmt.Sprintf("%v", "2025-10-16") + version := fmt.Sprintf("%v", "2026-01-22") if envValue := os.Getenv("VERSION"); envValue != "" { version = envValue } @@ -66,9 +66,9 @@ 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/square/square-go-sdk/v2") - headers.Set("X-Fern-SDK-Version", "v2.2.1") - headers.Set("User-Agent", "github.com/square/square-go-sdk/2.2.1") + headers.Set("X-Fern-SDK-Name", "github.com/square/square-go-sdk/v3") + headers.Set("X-Fern-SDK-Version", "v3.0.0") + headers.Set("User-Agent", "github.com/square/square-go-sdk/v3.0.0") return headers } diff --git a/customers.go b/customers.go index 05179e6..8677c90 100644 --- a/customers.go +++ b/customers.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" big "math/big" ) diff --git a/customers/cards.go b/customers/cards.go index 42c9ec3..be78b05 100644 --- a/customers/cards.go +++ b/customers/cards.go @@ -3,7 +3,7 @@ package customers import ( - v2 "github.com/square/square-go-sdk/v2" + v3 "github.com/square/square-go-sdk/v3" big "math/big" ) @@ -32,7 +32,7 @@ type CreateCustomerCardRequest struct { // __NOTE:__ If a billing address is provided in the request, the // `CreateCustomerCardRequest.billing_address.postal_code` must match // the postal code encoded in the card nonce. - BillingAddress *v2.Address `json:"billing_address,omitempty" url:"-"` + BillingAddress *v3.Address `json:"billing_address,omitempty" url:"-"` // The full name printed on the credit card. CardholderName *string `json:"cardholder_name,omitempty" url:"-"` // An identifying token generated by [Payments.verifyBuyer()](https://developer.squareup.com/reference/sdks/web/payments/objects/Payments#Payments.verifyBuyer). @@ -67,7 +67,7 @@ func (c *CreateCustomerCardRequest) SetCardNonce(cardNonce string) { // SetBillingAddress sets the BillingAddress field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *CreateCustomerCardRequest) SetBillingAddress(billingAddress *v2.Address) { +func (c *CreateCustomerCardRequest) SetBillingAddress(billingAddress *v3.Address) { c.BillingAddress = billingAddress c.require(createCustomerCardRequestFieldBillingAddress) } diff --git a/customers/cards/client.go b/customers/cards/client.go index 83d900b..93166ac 100644 --- a/customers/cards/client.go +++ b/customers/cards/client.go @@ -4,11 +4,11 @@ package cards import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - customers "github.com/square/square-go-sdk/v2/customers" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + customers "github.com/square/square-go-sdk/v3/customers" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" os "os" ) diff --git a/customers/cards/raw_client.go b/customers/cards/raw_client.go index 5166606..84a60d9 100644 --- a/customers/cards/raw_client.go +++ b/customers/cards/raw_client.go @@ -4,11 +4,11 @@ package cards import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - customers "github.com/square/square-go-sdk/v2/customers" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + customers "github.com/square/square-go-sdk/v3/customers" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/customers/client/client.go b/customers/client/client.go index e4b9545..2ac0900 100644 --- a/customers/client/client.go +++ b/customers/client/client.go @@ -4,15 +4,15 @@ package client import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - cards "github.com/square/square-go-sdk/v2/customers/cards" - customattributedefinitions "github.com/square/square-go-sdk/v2/customers/customattributedefinitions" - customattributes "github.com/square/square-go-sdk/v2/customers/customattributes" - groups "github.com/square/square-go-sdk/v2/customers/groups" - segments "github.com/square/square-go-sdk/v2/customers/segments" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + cards "github.com/square/square-go-sdk/v3/customers/cards" + customattributedefinitions "github.com/square/square-go-sdk/v3/customers/customattributedefinitions" + customattributes "github.com/square/square-go-sdk/v3/customers/customattributes" + groups "github.com/square/square-go-sdk/v3/customers/groups" + segments "github.com/square/square-go-sdk/v3/customers/segments" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/customers/client/raw_client.go b/customers/client/raw_client.go index 8c092c8..397c1ae 100644 --- a/customers/client/raw_client.go +++ b/customers/client/raw_client.go @@ -4,10 +4,10 @@ package client import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/customers/custom_attribute_definitions.go b/customers/custom_attribute_definitions.go index 66c4110..c9c7330 100644 --- a/customers/custom_attribute_definitions.go +++ b/customers/custom_attribute_definitions.go @@ -3,7 +3,7 @@ package customers import ( - v2 "github.com/square/square-go-sdk/v2" + v3 "github.com/square/square-go-sdk/v3" big "math/big" ) @@ -15,7 +15,7 @@ type BatchUpsertCustomerCustomAttributesRequest struct { // A map containing 1 to 25 individual upsert requests. For each request, provide an // arbitrary ID that is unique for this `BulkUpsertCustomerCustomAttributes` request and the // information needed to create or update a custom attribute. - Values map[string]*v2.BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest `json:"values,omitempty" url:"-"` + Values map[string]*v3.BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest `json:"values,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -30,7 +30,7 @@ func (b *BatchUpsertCustomerCustomAttributesRequest) require(field *big.Int) { // SetValues sets the Values field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (b *BatchUpsertCustomerCustomAttributesRequest) SetValues(values map[string]*v2.BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest) { +func (b *BatchUpsertCustomerCustomAttributesRequest) SetValues(values map[string]*v3.BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest) { b.Values = values b.require(batchUpsertCustomerCustomAttributesRequestFieldValues) } @@ -47,7 +47,7 @@ type CreateCustomerCustomAttributeDefinitionRequest struct { // [Specifying the schema](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attribute-definitions#specify-schema). // - If provided, `name` must be unique (case-sensitive) across all visible customer-related custom attribute definitions for the seller. // - All custom attributes are visible in exported customer data, including those set to `VISIBILITY_HIDDEN`. - CustomAttributeDefinition *v2.CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"-"` + CustomAttributeDefinition *v3.CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"-"` // A unique identifier for this request, used to ensure idempotency. For more information, // see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). IdempotencyKey *string `json:"idempotency_key,omitempty" url:"-"` @@ -65,7 +65,7 @@ func (c *CreateCustomerCustomAttributeDefinitionRequest) require(field *big.Int) // SetCustomAttributeDefinition sets the CustomAttributeDefinition field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *CreateCustomerCustomAttributeDefinitionRequest) SetCustomAttributeDefinition(customAttributeDefinition *v2.CustomAttributeDefinition) { +func (c *CreateCustomerCustomAttributeDefinitionRequest) SetCustomAttributeDefinition(customAttributeDefinition *v3.CustomAttributeDefinition) { c.CustomAttributeDefinition = customAttributeDefinition c.require(createCustomerCustomAttributeDefinitionRequestFieldCustomAttributeDefinition) } @@ -207,7 +207,7 @@ type UpdateCustomerCustomAttributeDefinitionRequest struct { // // To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) // control, include the optional `version` field and specify the current version of the custom attribute definition. - CustomAttributeDefinition *v2.CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"-"` + CustomAttributeDefinition *v3.CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"-"` // A unique identifier for this request, used to ensure idempotency. For more information, // see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). IdempotencyKey *string `json:"idempotency_key,omitempty" url:"-"` @@ -232,7 +232,7 @@ func (u *UpdateCustomerCustomAttributeDefinitionRequest) SetKey(key string) { // SetCustomAttributeDefinition sets the CustomAttributeDefinition field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (u *UpdateCustomerCustomAttributeDefinitionRequest) SetCustomAttributeDefinition(customAttributeDefinition *v2.CustomAttributeDefinition) { +func (u *UpdateCustomerCustomAttributeDefinitionRequest) SetCustomAttributeDefinition(customAttributeDefinition *v3.CustomAttributeDefinition) { u.CustomAttributeDefinition = customAttributeDefinition u.require(updateCustomerCustomAttributeDefinitionRequestFieldCustomAttributeDefinition) } diff --git a/customers/custom_attributes.go b/customers/custom_attributes.go index 96c012a..c795888 100644 --- a/customers/custom_attributes.go +++ b/customers/custom_attributes.go @@ -3,7 +3,7 @@ package customers import ( - v2 "github.com/square/square-go-sdk/v2" + v3 "github.com/square/square-go-sdk/v3" big "math/big" ) @@ -192,7 +192,7 @@ type UpsertCustomerCustomAttributeRequest struct { // - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) // control for an update operation, include this optional field and specify the current version // of the custom attribute. - CustomAttribute *v2.CustomAttribute `json:"custom_attribute,omitempty" url:"-"` + CustomAttribute *v3.CustomAttribute `json:"custom_attribute,omitempty" url:"-"` // A unique identifier for this request, used to ensure idempotency. For more information, // see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). IdempotencyKey *string `json:"idempotency_key,omitempty" url:"-"` @@ -224,7 +224,7 @@ func (u *UpsertCustomerCustomAttributeRequest) SetKey(key string) { // SetCustomAttribute sets the CustomAttribute field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (u *UpsertCustomerCustomAttributeRequest) SetCustomAttribute(customAttribute *v2.CustomAttribute) { +func (u *UpsertCustomerCustomAttributeRequest) SetCustomAttribute(customAttribute *v3.CustomAttribute) { u.CustomAttribute = customAttribute u.require(upsertCustomerCustomAttributeRequestFieldCustomAttribute) } diff --git a/customers/customattributedefinitions/client.go b/customers/customattributedefinitions/client.go index 233e7a2..bc9a194 100644 --- a/customers/customattributedefinitions/client.go +++ b/customers/customattributedefinitions/client.go @@ -4,11 +4,11 @@ package customattributedefinitions import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - customers "github.com/square/square-go-sdk/v2/customers" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + customers "github.com/square/square-go-sdk/v3/customers" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/customers/customattributedefinitions/raw_client.go b/customers/customattributedefinitions/raw_client.go index d27a774..8eda3a1 100644 --- a/customers/customattributedefinitions/raw_client.go +++ b/customers/customattributedefinitions/raw_client.go @@ -4,11 +4,11 @@ package customattributedefinitions import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - customers "github.com/square/square-go-sdk/v2/customers" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + customers "github.com/square/square-go-sdk/v3/customers" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/customers/customattributes/client.go b/customers/customattributes/client.go index 6de0a2f..488e0ad 100644 --- a/customers/customattributes/client.go +++ b/customers/customattributes/client.go @@ -4,11 +4,11 @@ package customattributes import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - customers "github.com/square/square-go-sdk/v2/customers" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + customers "github.com/square/square-go-sdk/v3/customers" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/customers/customattributes/raw_client.go b/customers/customattributes/raw_client.go index 1b98ba6..add1839 100644 --- a/customers/customattributes/raw_client.go +++ b/customers/customattributes/raw_client.go @@ -4,11 +4,11 @@ package customattributes import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - customers "github.com/square/square-go-sdk/v2/customers" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + customers "github.com/square/square-go-sdk/v3/customers" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/customers/error_codes.go b/customers/error_codes.go new file mode 100644 index 0000000..61780c7 --- /dev/null +++ b/customers/error_codes.go @@ -0,0 +1,9 @@ +// Code generated by Fern. DO NOT EDIT. + +package customers + +import ( + internal "github.com/square/square-go-sdk/v3/internal" +) + +var ErrorCodes internal.ErrorCodes = internal.ErrorCodes{} diff --git a/customers/groups.go b/customers/groups.go index c429521..eb4e0c9 100644 --- a/customers/groups.go +++ b/customers/groups.go @@ -3,7 +3,7 @@ package customers import ( - v2 "github.com/square/square-go-sdk/v2" + v3 "github.com/square/square-go-sdk/v3" big "math/big" ) @@ -52,7 +52,7 @@ type CreateCustomerGroupRequest struct { // The idempotency key for the request. For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). IdempotencyKey *string `json:"idempotency_key,omitempty" url:"-"` // The customer group to create. - Group *v2.CustomerGroup `json:"group,omitempty" url:"-"` + Group *v3.CustomerGroup `json:"group,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -74,7 +74,7 @@ func (c *CreateCustomerGroupRequest) SetIdempotencyKey(idempotencyKey *string) { // SetGroup sets the Group field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *CreateCustomerGroupRequest) SetGroup(group *v2.CustomerGroup) { +func (c *CreateCustomerGroupRequest) SetGroup(group *v3.CustomerGroup) { c.Group = group c.require(createCustomerGroupRequestFieldGroup) } @@ -218,7 +218,7 @@ type UpdateCustomerGroupRequest struct { // The ID of the customer group to update. GroupID string `json:"-" url:"-"` // The `CustomerGroup` object including all the updates you want to make. - Group *v2.CustomerGroup `json:"group,omitempty" url:"-"` + Group *v3.CustomerGroup `json:"group,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -240,7 +240,7 @@ func (u *UpdateCustomerGroupRequest) SetGroupID(groupID string) { // SetGroup sets the Group field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (u *UpdateCustomerGroupRequest) SetGroup(group *v2.CustomerGroup) { +func (u *UpdateCustomerGroupRequest) SetGroup(group *v3.CustomerGroup) { u.Group = group u.require(updateCustomerGroupRequestFieldGroup) } diff --git a/customers/groups/client.go b/customers/groups/client.go index 1b8a18e..d9f0a3f 100644 --- a/customers/groups/client.go +++ b/customers/groups/client.go @@ -4,11 +4,11 @@ package groups import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - customers "github.com/square/square-go-sdk/v2/customers" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + customers "github.com/square/square-go-sdk/v3/customers" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/customers/groups/raw_client.go b/customers/groups/raw_client.go index 636fc54..7c0278a 100644 --- a/customers/groups/raw_client.go +++ b/customers/groups/raw_client.go @@ -4,11 +4,11 @@ package groups import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - customers "github.com/square/square-go-sdk/v2/customers" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + customers "github.com/square/square-go-sdk/v3/customers" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/customers/segments/client.go b/customers/segments/client.go index f96d2a0..a1805f8 100644 --- a/customers/segments/client.go +++ b/customers/segments/client.go @@ -4,11 +4,11 @@ package segments import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - customers "github.com/square/square-go-sdk/v2/customers" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + customers "github.com/square/square-go-sdk/v3/customers" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/customers/segments/raw_client.go b/customers/segments/raw_client.go index 56f10db..6cd9a57 100644 --- a/customers/segments/raw_client.go +++ b/customers/segments/raw_client.go @@ -4,11 +4,11 @@ package segments import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - customers "github.com/square/square-go-sdk/v2/customers" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + customers "github.com/square/square-go-sdk/v3/customers" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/devices.go b/devices.go index 30f9f6b..f535dea 100644 --- a/devices.go +++ b/devices.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" big "math/big" ) diff --git a/devices/client/client.go b/devices/client/client.go index 70f2a75..58c8e85 100644 --- a/devices/client/client.go +++ b/devices/client/client.go @@ -4,11 +4,11 @@ package client import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - codes "github.com/square/square-go-sdk/v2/devices/codes" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + codes "github.com/square/square-go-sdk/v3/devices/codes" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/devices/client/raw_client.go b/devices/client/raw_client.go index dfbd803..ec0b831 100644 --- a/devices/client/raw_client.go +++ b/devices/client/raw_client.go @@ -4,10 +4,10 @@ package client import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/devices/codes.go b/devices/codes.go index 4ca648e..3d4a87d 100644 --- a/devices/codes.go +++ b/devices/codes.go @@ -3,7 +3,7 @@ package devices import ( - v2 "github.com/square/square-go-sdk/v2" + v3 "github.com/square/square-go-sdk/v3" big "math/big" ) @@ -19,7 +19,7 @@ type CreateDeviceCodeRequest struct { // See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information. IdempotencyKey string `json:"idempotency_key" url:"-"` // The device code to create. - DeviceCode *v2.DeviceCode `json:"device_code,omitempty" url:"-"` + DeviceCode *v3.DeviceCode `json:"device_code,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -41,7 +41,7 @@ func (c *CreateDeviceCodeRequest) SetIdempotencyKey(idempotencyKey string) { // SetDeviceCode sets the DeviceCode field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *CreateDeviceCodeRequest) SetDeviceCode(deviceCode *v2.DeviceCode) { +func (c *CreateDeviceCodeRequest) SetDeviceCode(deviceCode *v3.DeviceCode) { c.DeviceCode = deviceCode c.require(createDeviceCodeRequestFieldDeviceCode) } @@ -90,10 +90,10 @@ type ListCodesRequest struct { LocationID *string `json:"-" url:"location_id,omitempty"` // If specified, only returns DeviceCodes targeting the specified product type. // Returns DeviceCodes of all product types if empty. - ProductType *v2.ProductType `json:"-" url:"product_type,omitempty"` + ProductType *v3.ProductType `json:"-" url:"product_type,omitempty"` // If specified, returns DeviceCodes with the specified statuses. // Returns DeviceCodes of status `PAIRED` and `UNPAIRED` if empty. - Status *v2.DeviceCodeStatus `json:"-" url:"status,omitempty"` + Status *v3.DeviceCodeStatus `json:"-" url:"status,omitempty"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -122,14 +122,14 @@ func (l *ListCodesRequest) SetLocationID(locationID *string) { // SetProductType sets the ProductType field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (l *ListCodesRequest) SetProductType(productType *v2.ProductType) { +func (l *ListCodesRequest) SetProductType(productType *v3.ProductType) { l.ProductType = productType l.require(listCodesRequestFieldProductType) } // SetStatus sets the Status field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (l *ListCodesRequest) SetStatus(status *v2.DeviceCodeStatus) { +func (l *ListCodesRequest) SetStatus(status *v3.DeviceCodeStatus) { l.Status = status l.require(listCodesRequestFieldStatus) } diff --git a/devices/codes/client.go b/devices/codes/client.go index 9d2c173..6b49668 100644 --- a/devices/codes/client.go +++ b/devices/codes/client.go @@ -4,11 +4,11 @@ package codes import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - devices "github.com/square/square-go-sdk/v2/devices" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + devices "github.com/square/square-go-sdk/v3/devices" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/devices/codes/raw_client.go b/devices/codes/raw_client.go index 4c4b5a4..96beeb1 100644 --- a/devices/codes/raw_client.go +++ b/devices/codes/raw_client.go @@ -4,11 +4,11 @@ package codes import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - devices "github.com/square/square-go-sdk/v2/devices" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + devices "github.com/square/square-go-sdk/v3/devices" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/devices/error_codes.go b/devices/error_codes.go new file mode 100644 index 0000000..064f93c --- /dev/null +++ b/devices/error_codes.go @@ -0,0 +1,9 @@ +// Code generated by Fern. DO NOT EDIT. + +package devices + +import ( + internal "github.com/square/square-go-sdk/v3/internal" +) + +var ErrorCodes internal.ErrorCodes = internal.ErrorCodes{} diff --git a/disputes.go b/disputes.go index 7951378..e99d990 100644 --- a/disputes.go +++ b/disputes.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" io "io" big "math/big" ) diff --git a/disputes/client/client.go b/disputes/client/client.go index 25bb7dd..a00b955 100644 --- a/disputes/client/client.go +++ b/disputes/client/client.go @@ -4,11 +4,11 @@ package client import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - evidence "github.com/square/square-go-sdk/v2/disputes/evidence" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + evidence "github.com/square/square-go-sdk/v3/disputes/evidence" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/disputes/client/raw_client.go b/disputes/client/raw_client.go index 2f6a03a..fd8a209 100644 --- a/disputes/client/raw_client.go +++ b/disputes/client/raw_client.go @@ -4,10 +4,10 @@ package client import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/disputes/error_codes.go b/disputes/error_codes.go new file mode 100644 index 0000000..bafb85c --- /dev/null +++ b/disputes/error_codes.go @@ -0,0 +1,9 @@ +// Code generated by Fern. DO NOT EDIT. + +package disputes + +import ( + internal "github.com/square/square-go-sdk/v3/internal" +) + +var ErrorCodes internal.ErrorCodes = internal.ErrorCodes{} diff --git a/disputes/evidence/client.go b/disputes/evidence/client.go index 8666ba1..24de461 100644 --- a/disputes/evidence/client.go +++ b/disputes/evidence/client.go @@ -4,11 +4,11 @@ package evidence import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - disputes "github.com/square/square-go-sdk/v2/disputes" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + disputes "github.com/square/square-go-sdk/v3/disputes" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/disputes/evidence/raw_client.go b/disputes/evidence/raw_client.go index 6236b23..8346165 100644 --- a/disputes/evidence/raw_client.go +++ b/disputes/evidence/raw_client.go @@ -4,11 +4,11 @@ package evidence import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - disputes "github.com/square/square-go-sdk/v2/disputes" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + disputes "github.com/square/square-go-sdk/v3/disputes" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/employees.go b/employees.go index 9a367ca..a33749d 100644 --- a/employees.go +++ b/employees.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" big "math/big" ) diff --git a/employees/client.go b/employees/client.go index b3afd93..2971d64 100644 --- a/employees/client.go +++ b/employees/client.go @@ -4,10 +4,10 @@ package employees import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/employees/raw_client.go b/employees/raw_client.go index 3a10940..5fb3bff 100644 --- a/employees/raw_client.go +++ b/employees/raw_client.go @@ -4,10 +4,10 @@ package employees import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/error_codes.go b/error_codes.go index 6bcc0a1..245c054 100644 --- a/error_codes.go +++ b/error_codes.go @@ -3,7 +3,7 @@ package square import ( - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" ) var ErrorCodes internal.ErrorCodes = internal.ErrorCodes{} diff --git a/events.go b/events.go index 6b9d3de..f2a8ac1 100644 --- a/events.go +++ b/events.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" big "math/big" ) diff --git a/events/client.go b/events/client.go index c7253b2..99dc2f3 100644 --- a/events/client.go +++ b/events/client.go @@ -4,10 +4,10 @@ package events import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" os "os" ) diff --git a/events/raw_client.go b/events/raw_client.go index 2e89fe9..795dd7f 100644 --- a/events/raw_client.go +++ b/events/raw_client.go @@ -4,10 +4,10 @@ package events import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/gift_cards.go b/gift_cards.go index 86fe286..74942e0 100644 --- a/gift_cards.go +++ b/gift_cards.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" big "math/big" ) diff --git a/giftcards/activities.go b/giftcards/activities.go index b1a32d2..7908e26 100644 --- a/giftcards/activities.go +++ b/giftcards/activities.go @@ -3,7 +3,7 @@ package giftcards import ( - v2 "github.com/square/square-go-sdk/v2" + v3 "github.com/square/square-go-sdk/v3" big "math/big" ) @@ -17,7 +17,7 @@ type CreateGiftCardActivityRequest struct { IdempotencyKey string `json:"idempotency_key" url:"-"` // The activity to create for the gift card. This activity must specify `gift_card_id` or `gift_card_gan` for the target // gift card, the `location_id` where the activity occurred, and the activity `type` along with the corresponding activity details. - GiftCardActivity *v2.GiftCardActivity `json:"gift_card_activity,omitempty" url:"-"` + GiftCardActivity *v3.GiftCardActivity `json:"gift_card_activity,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -39,7 +39,7 @@ func (c *CreateGiftCardActivityRequest) SetIdempotencyKey(idempotencyKey string) // SetGiftCardActivity sets the GiftCardActivity field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *CreateGiftCardActivityRequest) SetGiftCardActivity(giftCardActivity *v2.GiftCardActivity) { +func (c *CreateGiftCardActivityRequest) SetGiftCardActivity(giftCardActivity *v3.GiftCardActivity) { c.GiftCardActivity = giftCardActivity c.require(createGiftCardActivityRequestFieldGiftCardActivity) } diff --git a/giftcards/activities/client.go b/giftcards/activities/client.go index cb51222..30776df 100644 --- a/giftcards/activities/client.go +++ b/giftcards/activities/client.go @@ -4,11 +4,11 @@ package activities import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - giftcards "github.com/square/square-go-sdk/v2/giftcards" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + giftcards "github.com/square/square-go-sdk/v3/giftcards" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/giftcards/activities/raw_client.go b/giftcards/activities/raw_client.go index d506eef..22520e0 100644 --- a/giftcards/activities/raw_client.go +++ b/giftcards/activities/raw_client.go @@ -4,11 +4,11 @@ package activities import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - giftcards "github.com/square/square-go-sdk/v2/giftcards" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + giftcards "github.com/square/square-go-sdk/v3/giftcards" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/giftcards/client/client.go b/giftcards/client/client.go index 179c24e..e701769 100644 --- a/giftcards/client/client.go +++ b/giftcards/client/client.go @@ -4,11 +4,11 @@ package client import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - activities "github.com/square/square-go-sdk/v2/giftcards/activities" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + activities "github.com/square/square-go-sdk/v3/giftcards/activities" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/giftcards/client/raw_client.go b/giftcards/client/raw_client.go index fe9877e..55453de 100644 --- a/giftcards/client/raw_client.go +++ b/giftcards/client/raw_client.go @@ -4,10 +4,10 @@ package client import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/giftcards/error_codes.go b/giftcards/error_codes.go new file mode 100644 index 0000000..645ac20 --- /dev/null +++ b/giftcards/error_codes.go @@ -0,0 +1,9 @@ +// Code generated by Fern. DO NOT EDIT. + +package giftcards + +import ( + internal "github.com/square/square-go-sdk/v3/internal" +) + +var ErrorCodes internal.ErrorCodes = internal.ErrorCodes{} diff --git a/go.mod b/go.mod index 849606a..1ccbf76 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/square/square-go-sdk/v2 +module github.com/square/square-go-sdk/v3 go 1.21 diff --git a/internal/caller.go b/internal/caller.go index a8a57e9..56b7dc2 100644 --- a/internal/caller.go +++ b/internal/caller.go @@ -12,13 +12,14 @@ import ( "reflect" "strings" - "github.com/square/square-go-sdk/v2/core" + "github.com/square/square-go-sdk/v3/core" ) const ( // contentType specifies the JSON Content-Type header value. - contentType = "application/json" - contentTypeHeader = "Content-Type" + contentType = "application/json" + contentTypeHeader = "Content-Type" + contentTypeFormURLEncoded = "application/x-www-form-urlencoded" ) // Caller calls APIs and deserializes their response, if any. @@ -180,7 +181,14 @@ func newRequest( request interface{}, bodyProperties map[string]interface{}, ) (*http.Request, error) { - requestBody, err := newRequestBody(request, bodyProperties) + // Determine the content type from headers, defaulting to JSON. + reqContentType := contentType + if endpointHeaders != nil { + if ct := endpointHeaders.Get(contentTypeHeader); ct != "" { + reqContentType = ct + } + } + requestBody, err := newRequestBody(request, bodyProperties, reqContentType) if err != nil { return nil, err } @@ -189,7 +197,7 @@ func newRequest( return nil, err } req = req.WithContext(ctx) - req.Header.Set(contentTypeHeader, contentType) + req.Header.Set(contentTypeHeader, reqContentType) for name, values := range endpointHeaders { req.Header[name] = values } @@ -197,11 +205,14 @@ func newRequest( } // newRequestBody returns a new io.Reader that represents the HTTP request body. -func newRequestBody(request interface{}, bodyProperties map[string]interface{}) (io.Reader, error) { +func newRequestBody(request interface{}, bodyProperties map[string]interface{}, reqContentType string) (io.Reader, error) { if isNil(request) { if len(bodyProperties) == 0 { return nil, nil } + if reqContentType == contentTypeFormURLEncoded { + return newFormURLEncodedBody(bodyProperties), nil + } requestBytes, err := json.Marshal(bodyProperties) if err != nil { return nil, err @@ -211,6 +222,10 @@ func newRequestBody(request interface{}, bodyProperties map[string]interface{}) if body, ok := request.(io.Reader); ok { return body, nil } + // Handle form URL encoded content type. + if reqContentType == contentTypeFormURLEncoded { + return newFormURLEncodedRequestBody(request, bodyProperties) + } requestBytes, err := MarshalJSONWithExtraProperties(request, bodyProperties) if err != nil { return nil, err @@ -218,6 +233,54 @@ func newRequestBody(request interface{}, bodyProperties map[string]interface{}) return bytes.NewReader(requestBytes), nil } +// newFormURLEncodedBody returns a new io.Reader that represents a form URL encoded body +// from the given body properties map. +func newFormURLEncodedBody(bodyProperties map[string]interface{}) io.Reader { + values := url.Values{} + for key, val := range bodyProperties { + values.Set(key, fmt.Sprintf("%v", val)) + } + return strings.NewReader(values.Encode()) +} + +// newFormURLEncodedRequestBody returns a new io.Reader that represents a form URL encoded body +// from the given request struct and body properties. +func newFormURLEncodedRequestBody(request interface{}, bodyProperties map[string]interface{}) (io.Reader, error) { + values := url.Values{} + // Marshal the request to JSON first to respect any custom MarshalJSON methods, + // then unmarshal into a map to extract the field values. + jsonBytes, err := json.Marshal(request) + if err != nil { + return nil, err + } + var jsonMap map[string]interface{} + if err := json.Unmarshal(jsonBytes, &jsonMap); err != nil { + return nil, err + } + // Convert the JSON map to form URL encoded values. + for key, val := range jsonMap { + if val == nil { + continue + } + values.Set(key, fmt.Sprintf("%v", val)) + } + // Add any extra body properties. + for key, val := range bodyProperties { + values.Set(key, fmt.Sprintf("%v", val)) + } + return strings.NewReader(values.Encode()), nil +} + +// isZeroValue checks if the given reflect.Value is the zero value for its type. +func isZeroValue(v reflect.Value) bool { + switch v.Kind() { + case reflect.Ptr, reflect.Interface, reflect.Slice, reflect.Map, reflect.Chan, reflect.Func: + return v.IsNil() + default: + return v.IsZero() + } +} + // decodeError decodes the error from the given HTTP response. Note that // it's the caller's responsibility to close the response body. func decodeError(response *http.Response, errorDecoder ErrorDecoder) error { @@ -246,5 +309,14 @@ func decodeError(response *http.Response, errorDecoder ErrorDecoder) error { // isNil is used to determine if the request value is equal to nil (i.e. an interface // value that holds a nil concrete value is itself non-nil). func isNil(value interface{}) bool { - return value == nil || reflect.ValueOf(value).IsNil() + if value == nil { + return true + } + v := reflect.ValueOf(value) + switch v.Kind() { + case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Pointer, reflect.Slice: + return v.IsNil() + default: + return false + } } diff --git a/internal/caller_test.go b/internal/caller_test.go index a1737ff..4bb918f 100644 --- a/internal/caller_test.go +++ b/internal/caller_test.go @@ -11,9 +11,10 @@ import ( "net/http/httptest" "net/url" "strconv" + "strings" "testing" - "github.com/square/square-go-sdk/v2/core" + "github.com/square/square-go-sdk/v3/core" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -373,6 +374,80 @@ func newTestServer(t *testing.T, tc *InternalTestCase) *httptest.Server { ) } +func TestIsNil(t *testing.T) { + t.Run("nil interface", func(t *testing.T) { + assert.True(t, isNil(nil)) + }) + + t.Run("nil pointer", func(t *testing.T) { + var ptr *string + assert.True(t, isNil(ptr)) + }) + + t.Run("non-nil pointer", func(t *testing.T) { + s := "test" + assert.False(t, isNil(&s)) + }) + + t.Run("nil slice", func(t *testing.T) { + var slice []string + assert.True(t, isNil(slice)) + }) + + t.Run("non-nil slice", func(t *testing.T) { + slice := []string{} + assert.False(t, isNil(slice)) + }) + + t.Run("nil map", func(t *testing.T) { + var m map[string]string + assert.True(t, isNil(m)) + }) + + t.Run("non-nil map", func(t *testing.T) { + m := make(map[string]string) + assert.False(t, isNil(m)) + }) + + t.Run("string value", func(t *testing.T) { + assert.False(t, isNil("test")) + }) + + t.Run("empty string value", func(t *testing.T) { + assert.False(t, isNil("")) + }) + + t.Run("int value", func(t *testing.T) { + assert.False(t, isNil(42)) + }) + + t.Run("zero int value", func(t *testing.T) { + assert.False(t, isNil(0)) + }) + + t.Run("bool value", func(t *testing.T) { + assert.False(t, isNil(true)) + }) + + t.Run("false bool value", func(t *testing.T) { + assert.False(t, isNil(false)) + }) + + t.Run("struct value", func(t *testing.T) { + type testStruct struct { + Field string + } + assert.False(t, isNil(testStruct{Field: "test"})) + }) + + t.Run("empty struct value", func(t *testing.T) { + type testStruct struct { + Field string + } + assert.False(t, isNil(testStruct{})) + }) +} + // newTestErrorDecoder returns an error decoder suitable for tests. func newTestErrorDecoder(t *testing.T) func(int, http.Header, io.Reader) error { return func(statusCode int, header http.Header, body io.Reader) error { @@ -393,3 +468,239 @@ func newTestErrorDecoder(t *testing.T) func(int, http.Header, io.Reader) error { return apiError } } + +// FormURLEncodedTestRequest is a test struct for form URL encoding tests. +type FormURLEncodedTestRequest struct { + ClientID string `json:"client_id"` + ClientSecret string `json:"client_secret"` + GrantType string `json:"grant_type,omitempty"` + Scope *string `json:"scope,omitempty"` + NilPointer *string `json:"nil_pointer,omitempty"` +} + +func TestNewFormURLEncodedBody(t *testing.T) { + t.Run("simple key-value pairs", func(t *testing.T) { + bodyProperties := map[string]interface{}{ + "client_id": "test_client_id", + "client_secret": "test_client_secret", + "grant_type": "client_credentials", + } + reader := newFormURLEncodedBody(bodyProperties) + body, err := io.ReadAll(reader) + require.NoError(t, err) + + // Parse the body and verify values + values, err := url.ParseQuery(string(body)) + require.NoError(t, err) + + assert.Equal(t, "test_client_id", values.Get("client_id")) + assert.Equal(t, "test_client_secret", values.Get("client_secret")) + assert.Equal(t, "client_credentials", values.Get("grant_type")) + + // Verify it's not JSON + bodyStr := string(body) + assert.False(t, strings.HasPrefix(strings.TrimSpace(bodyStr), "{"), + "Body should not be JSON, got: %s", bodyStr) + }) + + t.Run("special characters requiring URL encoding", func(t *testing.T) { + bodyProperties := map[string]interface{}{ + "value_with_space": "hello world", + "value_with_ampersand": "a&b", + "value_with_equals": "a=b", + "value_with_plus": "a+b", + } + reader := newFormURLEncodedBody(bodyProperties) + body, err := io.ReadAll(reader) + require.NoError(t, err) + + // Parse the body and verify values are correctly decoded + values, err := url.ParseQuery(string(body)) + require.NoError(t, err) + + assert.Equal(t, "hello world", values.Get("value_with_space")) + assert.Equal(t, "a&b", values.Get("value_with_ampersand")) + assert.Equal(t, "a=b", values.Get("value_with_equals")) + assert.Equal(t, "a+b", values.Get("value_with_plus")) + }) + + t.Run("empty map", func(t *testing.T) { + bodyProperties := map[string]interface{}{} + reader := newFormURLEncodedBody(bodyProperties) + body, err := io.ReadAll(reader) + require.NoError(t, err) + assert.Empty(t, string(body)) + }) +} + +func TestNewFormURLEncodedRequestBody(t *testing.T) { + t.Run("struct with json tags", func(t *testing.T) { + scope := "read write" + request := &FormURLEncodedTestRequest{ + ClientID: "test_client_id", + ClientSecret: "test_client_secret", + GrantType: "client_credentials", + Scope: &scope, + NilPointer: nil, + } + reader, err := newFormURLEncodedRequestBody(request, nil) + require.NoError(t, err) + + body, err := io.ReadAll(reader) + require.NoError(t, err) + + // Parse the body and verify values + values, err := url.ParseQuery(string(body)) + require.NoError(t, err) + + assert.Equal(t, "test_client_id", values.Get("client_id")) + assert.Equal(t, "test_client_secret", values.Get("client_secret")) + assert.Equal(t, "client_credentials", values.Get("grant_type")) + assert.Equal(t, "read write", values.Get("scope")) + // nil_pointer should not be present (nil pointer with omitempty) + assert.Empty(t, values.Get("nil_pointer")) + + // Verify it's not JSON + bodyStr := string(body) + assert.False(t, strings.HasPrefix(strings.TrimSpace(bodyStr), "{"), + "Body should not be JSON, got: %s", bodyStr) + }) + + t.Run("struct with omitempty and zero values", func(t *testing.T) { + request := &FormURLEncodedTestRequest{ + ClientID: "test_client_id", + ClientSecret: "test_client_secret", + GrantType: "", // empty string with omitempty should be omitted + Scope: nil, + NilPointer: nil, + } + reader, err := newFormURLEncodedRequestBody(request, nil) + require.NoError(t, err) + + body, err := io.ReadAll(reader) + require.NoError(t, err) + + values, err := url.ParseQuery(string(body)) + require.NoError(t, err) + + assert.Equal(t, "test_client_id", values.Get("client_id")) + assert.Equal(t, "test_client_secret", values.Get("client_secret")) + // grant_type should not be present (empty string with omitempty) + assert.Empty(t, values.Get("grant_type")) + assert.Empty(t, values.Get("scope")) + }) + + t.Run("struct with extra body properties", func(t *testing.T) { + request := &FormURLEncodedTestRequest{ + ClientID: "test_client_id", + ClientSecret: "test_client_secret", + } + bodyProperties := map[string]interface{}{ + "extra_param": "extra_value", + } + reader, err := newFormURLEncodedRequestBody(request, bodyProperties) + require.NoError(t, err) + + body, err := io.ReadAll(reader) + require.NoError(t, err) + + values, err := url.ParseQuery(string(body)) + require.NoError(t, err) + + assert.Equal(t, "test_client_id", values.Get("client_id")) + assert.Equal(t, "test_client_secret", values.Get("client_secret")) + assert.Equal(t, "extra_value", values.Get("extra_param")) + }) + + t.Run("special characters in struct fields", func(t *testing.T) { + scope := "read&write=all+permissions" + request := &FormURLEncodedTestRequest{ + ClientID: "client with spaces", + ClientSecret: "secret&with=special+chars", + Scope: &scope, + } + reader, err := newFormURLEncodedRequestBody(request, nil) + require.NoError(t, err) + + body, err := io.ReadAll(reader) + require.NoError(t, err) + + values, err := url.ParseQuery(string(body)) + require.NoError(t, err) + + assert.Equal(t, "client with spaces", values.Get("client_id")) + assert.Equal(t, "secret&with=special+chars", values.Get("client_secret")) + assert.Equal(t, "read&write=all+permissions", values.Get("scope")) + }) +} + +func TestNewRequestBodyFormURLEncoded(t *testing.T) { + t.Run("selects form encoding when content-type is form-urlencoded", func(t *testing.T) { + request := &FormURLEncodedTestRequest{ + ClientID: "test_client_id", + ClientSecret: "test_client_secret", + GrantType: "client_credentials", + } + reader, err := newRequestBody(request, nil, contentTypeFormURLEncoded) + require.NoError(t, err) + + body, err := io.ReadAll(reader) + require.NoError(t, err) + + // Verify it's form-urlencoded, not JSON + bodyStr := string(body) + assert.False(t, strings.HasPrefix(strings.TrimSpace(bodyStr), "{"), + "Body should not be JSON when Content-Type is form-urlencoded, got: %s", bodyStr) + + // Parse and verify values + values, err := url.ParseQuery(bodyStr) + require.NoError(t, err) + + assert.Equal(t, "test_client_id", values.Get("client_id")) + assert.Equal(t, "test_client_secret", values.Get("client_secret")) + assert.Equal(t, "client_credentials", values.Get("grant_type")) + }) + + t.Run("selects JSON encoding when content-type is application/json", func(t *testing.T) { + request := &FormURLEncodedTestRequest{ + ClientID: "test_client_id", + ClientSecret: "test_client_secret", + } + reader, err := newRequestBody(request, nil, contentType) + require.NoError(t, err) + + body, err := io.ReadAll(reader) + require.NoError(t, err) + + // Verify it's JSON + bodyStr := string(body) + assert.True(t, strings.HasPrefix(strings.TrimSpace(bodyStr), "{"), + "Body should be JSON when Content-Type is application/json, got: %s", bodyStr) + + // Parse and verify it's valid JSON + var parsed map[string]interface{} + err = json.Unmarshal(body, &parsed) + require.NoError(t, err) + + assert.Equal(t, "test_client_id", parsed["client_id"]) + assert.Equal(t, "test_client_secret", parsed["client_secret"]) + }) + + t.Run("form encoding with body properties only (nil request)", func(t *testing.T) { + bodyProperties := map[string]interface{}{ + "client_id": "test_client_id", + "client_secret": "test_client_secret", + } + reader, err := newRequestBody(nil, bodyProperties, contentTypeFormURLEncoded) + require.NoError(t, err) + + body, err := io.ReadAll(reader) + require.NoError(t, err) + + values, err := url.ParseQuery(string(body)) + require.NoError(t, err) + + assert.Equal(t, "test_client_id", values.Get("client_id")) + assert.Equal(t, "test_client_secret", values.Get("client_secret")) + }) +} diff --git a/internal/error_decoder.go b/internal/error_decoder.go index 9cfbc03..5131c37 100644 --- a/internal/error_decoder.go +++ b/internal/error_decoder.go @@ -8,7 +8,7 @@ import ( "io" "net/http" - "github.com/square/square-go-sdk/v2/core" + "github.com/square/square-go-sdk/v3/core" ) // ErrorCodes maps HTTP status codes to error constructors. diff --git a/internal/error_decoder_test.go b/internal/error_decoder_test.go index ce46dc0..8c8c53f 100644 --- a/internal/error_decoder_test.go +++ b/internal/error_decoder_test.go @@ -6,7 +6,7 @@ import ( "net/http" "testing" - "github.com/square/square-go-sdk/v2/core" + "github.com/square/square-go-sdk/v3/core" "github.com/stretchr/testify/assert" ) diff --git a/internal/explicit_fields_test.go b/internal/explicit_fields_test.go index 9fccda7..3d05e88 100644 --- a/internal/explicit_fields_test.go +++ b/internal/explicit_fields_test.go @@ -10,11 +10,12 @@ import ( ) type testExplicitFieldsStruct struct { - Name *string `json:"name,omitempty"` - Code *string `json:"code,omitempty"` - Count *int `json:"count,omitempty"` - Enabled *bool `json:"enabled,omitempty"` - Tags []string `json:"tags,omitempty"` + Name *string `json:"name,omitempty"` + Code *string `json:"code,omitempty"` + Count *int `json:"count,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + Tags []string `json:"tags,omitempty"` + //lint:ignore unused this field is intentionally unused for testing unexported string `json:"-"` explicitFields *big.Int `json:"-"` } diff --git a/internal/pager.go b/internal/pager.go index 1153b14..afc7d8e 100644 --- a/internal/pager.go +++ b/internal/pager.go @@ -3,7 +3,7 @@ package internal import ( "context" - "github.com/square/square-go-sdk/v2/core" + "github.com/square/square-go-sdk/v3/core" ) // PagerMode represents the different types of pagination modes. diff --git a/internal/pager_test.go b/internal/pager_test.go index 12d6489..872682b 100644 --- a/internal/pager_test.go +++ b/internal/pager_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/square/square-go-sdk/v2/core" + "github.com/square/square-go-sdk/v3/core" ) type TestPageResponse struct { diff --git a/internal/query.go b/internal/query.go index 786318b..1cbaf7f 100644 --- a/internal/query.go +++ b/internal/query.go @@ -70,6 +70,9 @@ func QueryValuesWithDefaults(v interface{}, defaults map[string]interface{}) (ur if err != nil { return values, err } + if !val.IsValid() { + return values, nil + } // apply defaults to zero-value fields directly on the original struct valType := val.Type() diff --git a/internal/query_test.go b/internal/query_test.go index 1a4076d..2c28cb8 100644 --- a/internal/query_test.go +++ b/internal/query_test.go @@ -371,4 +371,25 @@ func TestQueryValuesWithDefaults(t *testing.T) { require.NoError(t, err) assert.Equal(t, "age=0&enabled=false&name=", values.Encode()) }) + + t.Run("nil input returns empty values", func(t *testing.T) { + defaults := map[string]any{ + "name": "default-name", + "age": 25, + } + + // Test with nil + values, err := QueryValuesWithDefaults(nil, defaults) + require.NoError(t, err) + assert.Empty(t, values) + + // Test with nil pointer + type example struct { + Name string `json:"name" url:"name"` + } + var nilPtr *example + values, err = QueryValuesWithDefaults(nilPtr, defaults) + require.NoError(t, err) + assert.Empty(t, values) + }) } diff --git a/internal/retrier.go b/internal/retrier.go index 4efae1b..818d54a 100644 --- a/internal/retrier.go +++ b/internal/retrier.go @@ -98,6 +98,15 @@ func (r *Retrier) run( return nil, err } + // Reset the request body for retries since the body may have already been read. + if retryAttempt > 0 && request.GetBody != nil { + requestBody, err := request.GetBody() + if err != nil { + return nil, err + } + request.Body = requestBody + } + response, err := fn(request) if err != nil { return nil, err diff --git a/internal/retrier_test.go b/internal/retrier_test.go index fb7794d..0b6793c 100644 --- a/internal/retrier_test.go +++ b/internal/retrier_test.go @@ -10,7 +10,7 @@ import ( "testing" "time" - "github.com/square/square-go-sdk/v2/core" + "github.com/square/square-go-sdk/v3/core" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -210,6 +210,58 @@ var expectedRetryDurations = []time.Duration{ 8000 * time.Millisecond, // 500ms * 2^4 = 8000ms } +func TestRetryWithRequestBody(t *testing.T) { + // This test verifies that POST requests with a body are properly retried. + // The request body should be re-sent on each retry attempt. + expectedBody := `{"id":"test-id"}` + var requestBodies []string + var requestCount int + + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + requestCount++ + bodyBytes, err := io.ReadAll(r.Body) + require.NoError(t, err) + requestBodies = append(requestBodies, string(bodyBytes)) + + if requestCount == 1 { + // First request - return retryable error + w.WriteHeader(http.StatusServiceUnavailable) + return + } + // Second request - return success + w.WriteHeader(http.StatusOK) + response := &InternalTestResponse{Id: "success"} + bytes, _ := json.Marshal(response) + w.Write(bytes) + })) + defer server.Close() + + caller := NewCaller(&CallerParams{ + Client: server.Client(), + }) + + var response *InternalTestResponse + _, err := caller.Call( + context.Background(), + &CallParams{ + URL: server.URL, + Method: http.MethodPost, + Request: &InternalTestRequest{Id: "test-id"}, + Response: &response, + MaxAttempts: 2, + ResponseIsOptional: true, + }, + ) + + require.NoError(t, err) + require.Equal(t, 2, requestCount, "Expected exactly 2 requests") + require.Len(t, requestBodies, 2, "Expected 2 request bodies to be captured") + + // Both requests should have the same non-empty body + assert.Equal(t, expectedBody, requestBodies[0], "First request body should match expected") + assert.Equal(t, expectedBody, requestBodies[1], "Second request body should match expected (retry should re-send body)") +} + func TestRetryDelayTiming(t *testing.T) { tests := []struct { name string diff --git a/inventory.go b/inventory.go index 86b6902..8e0a67b 100644 --- a/inventory.go +++ b/inventory.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" big "math/big" ) diff --git a/inventory/client.go b/inventory/client.go index 756623d..528ebe2 100644 --- a/inventory/client.go +++ b/inventory/client.go @@ -4,10 +4,10 @@ package inventory import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/inventory/raw_client.go b/inventory/raw_client.go index 52d7be6..0ca1e84 100644 --- a/inventory/raw_client.go +++ b/inventory/raw_client.go @@ -4,10 +4,10 @@ package inventory import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/invoices.go b/invoices.go index b0b0a06..829dcac 100644 --- a/invoices.go +++ b/invoices.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" io "io" big "math/big" ) diff --git a/invoices/client.go b/invoices/client.go index 73f6b4f..57aa252 100644 --- a/invoices/client.go +++ b/invoices/client.go @@ -4,10 +4,10 @@ package invoices import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/invoices/raw_client.go b/invoices/raw_client.go index 4e55804..c76fe42 100644 --- a/invoices/raw_client.go +++ b/invoices/raw_client.go @@ -4,10 +4,10 @@ package invoices import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/labor.go b/labor.go index 439e852..5fc3462 100644 --- a/labor.go +++ b/labor.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" big "math/big" ) diff --git a/labor/break_types.go b/labor/break_types.go index 6f47cb9..cf3df56 100644 --- a/labor/break_types.go +++ b/labor/break_types.go @@ -3,7 +3,7 @@ package labor import ( - v2 "github.com/square/square-go-sdk/v2" + v3 "github.com/square/square-go-sdk/v3" big "math/big" ) @@ -16,7 +16,7 @@ type CreateBreakTypeRequest struct { // A unique string value to ensure the idempotency of the operation. IdempotencyKey *string `json:"idempotency_key,omitempty" url:"-"` // The `BreakType` to be created. - BreakType *v2.BreakType `json:"break_type,omitempty" url:"-"` + BreakType *v3.BreakType `json:"break_type,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -38,7 +38,7 @@ func (c *CreateBreakTypeRequest) SetIdempotencyKey(idempotencyKey *string) { // SetBreakType sets the BreakType field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *CreateBreakTypeRequest) SetBreakType(breakType *v2.BreakType) { +func (c *CreateBreakTypeRequest) SetBreakType(breakType *v3.BreakType) { c.BreakType = breakType c.require(createBreakTypeRequestFieldBreakType) } @@ -152,7 +152,7 @@ type UpdateBreakTypeRequest struct { // The UUID for the `BreakType` being updated. ID string `json:"-" url:"-"` // The updated `BreakType`. - BreakType *v2.BreakType `json:"break_type,omitempty" url:"-"` + BreakType *v3.BreakType `json:"break_type,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -174,7 +174,7 @@ func (u *UpdateBreakTypeRequest) SetID(id string) { // SetBreakType sets the BreakType field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (u *UpdateBreakTypeRequest) SetBreakType(breakType *v2.BreakType) { +func (u *UpdateBreakTypeRequest) SetBreakType(breakType *v3.BreakType) { u.BreakType = breakType u.require(updateBreakTypeRequestFieldBreakType) } diff --git a/labor/breaktypes/client.go b/labor/breaktypes/client.go index 5605abf..26046fc 100644 --- a/labor/breaktypes/client.go +++ b/labor/breaktypes/client.go @@ -4,11 +4,11 @@ package breaktypes import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - labor "github.com/square/square-go-sdk/v2/labor" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + labor "github.com/square/square-go-sdk/v3/labor" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/labor/breaktypes/raw_client.go b/labor/breaktypes/raw_client.go index 656e77e..deaa2d5 100644 --- a/labor/breaktypes/raw_client.go +++ b/labor/breaktypes/raw_client.go @@ -4,11 +4,11 @@ package breaktypes import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - labor "github.com/square/square-go-sdk/v2/labor" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + labor "github.com/square/square-go-sdk/v3/labor" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/labor/client/client.go b/labor/client/client.go index c423411..2c0cd56 100644 --- a/labor/client/client.go +++ b/labor/client/client.go @@ -4,15 +4,15 @@ package client import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - breaktypes "github.com/square/square-go-sdk/v2/labor/breaktypes" - employeewages "github.com/square/square-go-sdk/v2/labor/employeewages" - shifts "github.com/square/square-go-sdk/v2/labor/shifts" - teammemberwages "github.com/square/square-go-sdk/v2/labor/teammemberwages" - workweekconfigs "github.com/square/square-go-sdk/v2/labor/workweekconfigs" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + breaktypes "github.com/square/square-go-sdk/v3/labor/breaktypes" + employeewages "github.com/square/square-go-sdk/v3/labor/employeewages" + shifts "github.com/square/square-go-sdk/v3/labor/shifts" + teammemberwages "github.com/square/square-go-sdk/v3/labor/teammemberwages" + workweekconfigs "github.com/square/square-go-sdk/v3/labor/workweekconfigs" + option "github.com/square/square-go-sdk/v3/option" os "os" ) diff --git a/labor/client/raw_client.go b/labor/client/raw_client.go index c7e26b6..ce17d5d 100644 --- a/labor/client/raw_client.go +++ b/labor/client/raw_client.go @@ -4,10 +4,10 @@ package client import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/labor/employeewages/client.go b/labor/employeewages/client.go index 9a00962..4a05471 100644 --- a/labor/employeewages/client.go +++ b/labor/employeewages/client.go @@ -4,11 +4,11 @@ package employeewages import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - labor "github.com/square/square-go-sdk/v2/labor" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + labor "github.com/square/square-go-sdk/v3/labor" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/labor/employeewages/raw_client.go b/labor/employeewages/raw_client.go index 85d2c5c..663069b 100644 --- a/labor/employeewages/raw_client.go +++ b/labor/employeewages/raw_client.go @@ -4,11 +4,11 @@ package employeewages import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - labor "github.com/square/square-go-sdk/v2/labor" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + labor "github.com/square/square-go-sdk/v3/labor" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/labor/error_codes.go b/labor/error_codes.go new file mode 100644 index 0000000..bb86cc7 --- /dev/null +++ b/labor/error_codes.go @@ -0,0 +1,9 @@ +// Code generated by Fern. DO NOT EDIT. + +package labor + +import ( + internal "github.com/square/square-go-sdk/v3/internal" +) + +var ErrorCodes internal.ErrorCodes = internal.ErrorCodes{} diff --git a/labor/shifts.go b/labor/shifts.go index 4e6021b..afb8c0d 100644 --- a/labor/shifts.go +++ b/labor/shifts.go @@ -3,7 +3,7 @@ package labor import ( - v2 "github.com/square/square-go-sdk/v2" + v3 "github.com/square/square-go-sdk/v3" big "math/big" ) @@ -16,7 +16,7 @@ type CreateShiftRequest struct { // A unique string value to ensure the idempotency of the operation. IdempotencyKey *string `json:"idempotency_key,omitempty" url:"-"` // The `Shift` to be created. - Shift *v2.Shift `json:"shift,omitempty" url:"-"` + Shift *v3.Shift `json:"shift,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -38,7 +38,7 @@ func (c *CreateShiftRequest) SetIdempotencyKey(idempotencyKey *string) { // SetShift sets the Shift field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *CreateShiftRequest) SetShift(shift *v2.Shift) { +func (c *CreateShiftRequest) SetShift(shift *v3.Shift) { c.Shift = shift c.require(createShiftRequestFieldShift) } @@ -103,7 +103,7 @@ var ( type SearchShiftsRequest struct { // Query filters. - Query *v2.ShiftQuery `json:"query,omitempty" url:"-"` + Query *v3.ShiftQuery `json:"query,omitempty" url:"-"` // The number of resources in a page (200 by default). Limit *int `json:"limit,omitempty" url:"-"` // An opaque cursor for fetching the next page. @@ -122,7 +122,7 @@ func (s *SearchShiftsRequest) require(field *big.Int) { // SetQuery sets the Query field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (s *SearchShiftsRequest) SetQuery(query *v2.ShiftQuery) { +func (s *SearchShiftsRequest) SetQuery(query *v3.ShiftQuery) { s.Query = query s.require(searchShiftsRequestFieldQuery) } @@ -150,7 +150,7 @@ type UpdateShiftRequest struct { // The ID of the object being updated. ID string `json:"-" url:"-"` // The updated `Shift` object. - Shift *v2.Shift `json:"shift,omitempty" url:"-"` + Shift *v3.Shift `json:"shift,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -172,7 +172,7 @@ func (u *UpdateShiftRequest) SetID(id string) { // SetShift sets the Shift field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (u *UpdateShiftRequest) SetShift(shift *v2.Shift) { +func (u *UpdateShiftRequest) SetShift(shift *v3.Shift) { u.Shift = shift u.require(updateShiftRequestFieldShift) } diff --git a/labor/shifts/client.go b/labor/shifts/client.go index ba440e1..8a998b2 100644 --- a/labor/shifts/client.go +++ b/labor/shifts/client.go @@ -4,11 +4,11 @@ package shifts import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - labor "github.com/square/square-go-sdk/v2/labor" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + labor "github.com/square/square-go-sdk/v3/labor" + option "github.com/square/square-go-sdk/v3/option" os "os" ) diff --git a/labor/shifts/raw_client.go b/labor/shifts/raw_client.go index 3908917..92d8825 100644 --- a/labor/shifts/raw_client.go +++ b/labor/shifts/raw_client.go @@ -4,11 +4,11 @@ package shifts import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - labor "github.com/square/square-go-sdk/v2/labor" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + labor "github.com/square/square-go-sdk/v3/labor" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/labor/teammemberwages/client.go b/labor/teammemberwages/client.go index 3c4afe4..a797912 100644 --- a/labor/teammemberwages/client.go +++ b/labor/teammemberwages/client.go @@ -4,11 +4,11 @@ package teammemberwages import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - labor "github.com/square/square-go-sdk/v2/labor" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + labor "github.com/square/square-go-sdk/v3/labor" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/labor/teammemberwages/raw_client.go b/labor/teammemberwages/raw_client.go index 112adcb..4f8ea12 100644 --- a/labor/teammemberwages/raw_client.go +++ b/labor/teammemberwages/raw_client.go @@ -4,11 +4,11 @@ package teammemberwages import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - labor "github.com/square/square-go-sdk/v2/labor" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + labor "github.com/square/square-go-sdk/v3/labor" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/labor/workweek_configs.go b/labor/workweek_configs.go index 4e89c6a..95c36fe 100644 --- a/labor/workweek_configs.go +++ b/labor/workweek_configs.go @@ -3,7 +3,7 @@ package labor import ( - v2 "github.com/square/square-go-sdk/v2" + v3 "github.com/square/square-go-sdk/v3" big "math/big" ) @@ -16,7 +16,7 @@ type UpdateWorkweekConfigRequest struct { // The UUID for the `WorkweekConfig` object being updated. ID string `json:"-" url:"-"` // The updated `WorkweekConfig` object. - WorkweekConfig *v2.WorkweekConfig `json:"workweek_config,omitempty" url:"-"` + WorkweekConfig *v3.WorkweekConfig `json:"workweek_config,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -38,7 +38,7 @@ func (u *UpdateWorkweekConfigRequest) SetID(id string) { // SetWorkweekConfig sets the WorkweekConfig field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (u *UpdateWorkweekConfigRequest) SetWorkweekConfig(workweekConfig *v2.WorkweekConfig) { +func (u *UpdateWorkweekConfigRequest) SetWorkweekConfig(workweekConfig *v3.WorkweekConfig) { u.WorkweekConfig = workweekConfig u.require(updateWorkweekConfigRequestFieldWorkweekConfig) } diff --git a/labor/workweekconfigs/client.go b/labor/workweekconfigs/client.go index 14ae1bc..ebe5cbb 100644 --- a/labor/workweekconfigs/client.go +++ b/labor/workweekconfigs/client.go @@ -4,11 +4,11 @@ package workweekconfigs import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - labor "github.com/square/square-go-sdk/v2/labor" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + labor "github.com/square/square-go-sdk/v3/labor" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/labor/workweekconfigs/raw_client.go b/labor/workweekconfigs/raw_client.go index 521e6ed..23dc740 100644 --- a/labor/workweekconfigs/raw_client.go +++ b/labor/workweekconfigs/raw_client.go @@ -4,11 +4,11 @@ package workweekconfigs import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - labor "github.com/square/square-go-sdk/v2/labor" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + labor "github.com/square/square-go-sdk/v3/labor" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/locations.go b/locations.go index cdc8e39..2af913b 100644 --- a/locations.go +++ b/locations.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" big "math/big" ) diff --git a/locations/client/client.go b/locations/client/client.go index 331cd06..2be32d5 100644 --- a/locations/client/client.go +++ b/locations/client/client.go @@ -4,13 +4,13 @@ package client import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - customattributedefinitions "github.com/square/square-go-sdk/v2/locations/customattributedefinitions" - customattributes "github.com/square/square-go-sdk/v2/locations/customattributes" - transactions "github.com/square/square-go-sdk/v2/locations/transactions" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + customattributedefinitions "github.com/square/square-go-sdk/v3/locations/customattributedefinitions" + customattributes "github.com/square/square-go-sdk/v3/locations/customattributes" + transactions "github.com/square/square-go-sdk/v3/locations/transactions" + option "github.com/square/square-go-sdk/v3/option" os "os" ) diff --git a/locations/client/raw_client.go b/locations/client/raw_client.go index fcc0052..b91e7c5 100644 --- a/locations/client/raw_client.go +++ b/locations/client/raw_client.go @@ -4,10 +4,10 @@ package client import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/locations/custom_attribute_definitions.go b/locations/custom_attribute_definitions.go index 45a7632..947efd4 100644 --- a/locations/custom_attribute_definitions.go +++ b/locations/custom_attribute_definitions.go @@ -3,7 +3,7 @@ package locations import ( - v2 "github.com/square/square-go-sdk/v2" + v3 "github.com/square/square-go-sdk/v3" big "math/big" ) @@ -18,7 +18,7 @@ type CreateLocationCustomAttributeDefinitionRequest struct { // definition hosted on the Square CDN. For more information, including supported values and constraints, see // [Supported data types](https://developer.squareup.com/docs/devtools/customattributes/overview#supported-data-types). // - `name` is required unless `visibility` is set to `VISIBILITY_HIDDEN`. - CustomAttributeDefinition *v2.CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"-"` + CustomAttributeDefinition *v3.CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"-"` // A unique identifier for this request, used to ensure idempotency. For more information, // see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). IdempotencyKey *string `json:"idempotency_key,omitempty" url:"-"` @@ -36,7 +36,7 @@ func (c *CreateLocationCustomAttributeDefinitionRequest) require(field *big.Int) // SetCustomAttributeDefinition sets the CustomAttributeDefinition field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *CreateLocationCustomAttributeDefinitionRequest) SetCustomAttributeDefinition(customAttributeDefinition *v2.CustomAttributeDefinition) { +func (c *CreateLocationCustomAttributeDefinitionRequest) SetCustomAttributeDefinition(customAttributeDefinition *v3.CustomAttributeDefinition) { c.CustomAttributeDefinition = customAttributeDefinition c.require(createLocationCustomAttributeDefinitionRequestFieldCustomAttributeDefinition) } @@ -122,7 +122,7 @@ var ( type ListCustomAttributeDefinitionsRequest struct { // Filters the `CustomAttributeDefinition` results by their `visibility` values. - VisibilityFilter *v2.VisibilityFilter `json:"-" url:"visibility_filter,omitempty"` + VisibilityFilter *v3.VisibilityFilter `json:"-" url:"visibility_filter,omitempty"` // 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). @@ -145,7 +145,7 @@ func (l *ListCustomAttributeDefinitionsRequest) require(field *big.Int) { // SetVisibilityFilter sets the VisibilityFilter field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (l *ListCustomAttributeDefinitionsRequest) SetVisibilityFilter(visibilityFilter *v2.VisibilityFilter) { +func (l *ListCustomAttributeDefinitionsRequest) SetVisibilityFilter(visibilityFilter *v3.VisibilityFilter) { l.VisibilityFilter = visibilityFilter l.require(listCustomAttributeDefinitionsRequestFieldVisibilityFilter) } @@ -187,7 +187,7 @@ type UpdateLocationCustomAttributeDefinitionRequest struct { // To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) // control, specify the current version of the custom attribute definition. // If this is not important for your application, `version` can be set to -1. - CustomAttributeDefinition *v2.CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"-"` + CustomAttributeDefinition *v3.CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"-"` // A unique identifier for this request, used to ensure idempotency. For more information, // see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). IdempotencyKey *string `json:"idempotency_key,omitempty" url:"-"` @@ -212,7 +212,7 @@ func (u *UpdateLocationCustomAttributeDefinitionRequest) SetKey(key string) { // SetCustomAttributeDefinition sets the CustomAttributeDefinition field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (u *UpdateLocationCustomAttributeDefinitionRequest) SetCustomAttributeDefinition(customAttributeDefinition *v2.CustomAttributeDefinition) { +func (u *UpdateLocationCustomAttributeDefinitionRequest) SetCustomAttributeDefinition(customAttributeDefinition *v3.CustomAttributeDefinition) { u.CustomAttributeDefinition = customAttributeDefinition u.require(updateLocationCustomAttributeDefinitionRequestFieldCustomAttributeDefinition) } diff --git a/locations/custom_attributes.go b/locations/custom_attributes.go index ad842ea..0cc2244 100644 --- a/locations/custom_attributes.go +++ b/locations/custom_attributes.go @@ -3,7 +3,7 @@ package locations import ( - v2 "github.com/square/square-go-sdk/v2" + v3 "github.com/square/square-go-sdk/v3" big "math/big" ) @@ -14,7 +14,7 @@ var ( type BulkDeleteLocationCustomAttributesRequest struct { // The data used to update the `CustomAttribute` objects. // The keys must be unique and are used to map to the corresponding response. - Values map[string]*v2.BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest `json:"values,omitempty" url:"-"` + Values map[string]*v3.BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest `json:"values,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -29,7 +29,7 @@ func (b *BulkDeleteLocationCustomAttributesRequest) require(field *big.Int) { // SetValues sets the Values field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (b *BulkDeleteLocationCustomAttributesRequest) SetValues(values map[string]*v2.BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest) { +func (b *BulkDeleteLocationCustomAttributesRequest) SetValues(values map[string]*v3.BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest) { b.Values = values b.require(bulkDeleteLocationCustomAttributesRequestFieldValues) } @@ -42,7 +42,7 @@ type BulkUpsertLocationCustomAttributesRequest struct { // A map containing 1 to 25 individual upsert requests. For each request, provide an // arbitrary ID that is unique for this `BulkUpsertLocationCustomAttributes` request and the // information needed to create or update a custom attribute. - Values map[string]*v2.BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest `json:"values,omitempty" url:"-"` + Values map[string]*v3.BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest `json:"values,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -57,7 +57,7 @@ func (b *BulkUpsertLocationCustomAttributesRequest) require(field *big.Int) { // SetValues sets the Values field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (b *BulkUpsertLocationCustomAttributesRequest) SetValues(values map[string]*v2.BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest) { +func (b *BulkUpsertLocationCustomAttributesRequest) SetValues(values map[string]*v3.BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest) { b.Values = values b.require(bulkUpsertLocationCustomAttributesRequestFieldValues) } @@ -175,7 +175,7 @@ type ListCustomAttributesRequest struct { // The ID of the target [location](entity:Location). LocationID string `json:"-" url:"-"` // Filters the `CustomAttributeDefinition` results by their `visibility` values. - VisibilityFilter *v2.VisibilityFilter `json:"-" url:"visibility_filter,omitempty"` + VisibilityFilter *v3.VisibilityFilter `json:"-" url:"visibility_filter,omitempty"` // 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). @@ -209,7 +209,7 @@ func (l *ListCustomAttributesRequest) SetLocationID(locationID string) { // SetVisibilityFilter sets the VisibilityFilter field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (l *ListCustomAttributesRequest) SetVisibilityFilter(visibilityFilter *v2.VisibilityFilter) { +func (l *ListCustomAttributesRequest) SetVisibilityFilter(visibilityFilter *v3.VisibilityFilter) { l.VisibilityFilter = visibilityFilter l.require(listCustomAttributesRequestFieldVisibilityFilter) } @@ -255,7 +255,7 @@ type UpsertLocationCustomAttributeRequest struct { // - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) // control for an update operation, include the current version of the custom attribute. // If this is not important for your application, version can be set to -1. - CustomAttribute *v2.CustomAttribute `json:"custom_attribute,omitempty" url:"-"` + CustomAttribute *v3.CustomAttribute `json:"custom_attribute,omitempty" url:"-"` // A unique identifier for this request, used to ensure idempotency. For more information, // see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). IdempotencyKey *string `json:"idempotency_key,omitempty" url:"-"` @@ -287,7 +287,7 @@ func (u *UpsertLocationCustomAttributeRequest) SetKey(key string) { // SetCustomAttribute sets the CustomAttribute field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (u *UpsertLocationCustomAttributeRequest) SetCustomAttribute(customAttribute *v2.CustomAttribute) { +func (u *UpsertLocationCustomAttributeRequest) SetCustomAttribute(customAttribute *v3.CustomAttribute) { u.CustomAttribute = customAttribute u.require(upsertLocationCustomAttributeRequestFieldCustomAttribute) } diff --git a/locations/customattributedefinitions/client.go b/locations/customattributedefinitions/client.go index d96f12e..9e58115 100644 --- a/locations/customattributedefinitions/client.go +++ b/locations/customattributedefinitions/client.go @@ -4,11 +4,11 @@ package customattributedefinitions import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - locations "github.com/square/square-go-sdk/v2/locations" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + locations "github.com/square/square-go-sdk/v3/locations" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/locations/customattributedefinitions/raw_client.go b/locations/customattributedefinitions/raw_client.go index 375bd16..b41197a 100644 --- a/locations/customattributedefinitions/raw_client.go +++ b/locations/customattributedefinitions/raw_client.go @@ -4,11 +4,11 @@ package customattributedefinitions import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - locations "github.com/square/square-go-sdk/v2/locations" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + locations "github.com/square/square-go-sdk/v3/locations" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/locations/customattributes/client.go b/locations/customattributes/client.go index 1624f05..c5526c1 100644 --- a/locations/customattributes/client.go +++ b/locations/customattributes/client.go @@ -4,11 +4,11 @@ package customattributes import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - locations "github.com/square/square-go-sdk/v2/locations" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + locations "github.com/square/square-go-sdk/v3/locations" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/locations/customattributes/raw_client.go b/locations/customattributes/raw_client.go index 7541af2..fe7b093 100644 --- a/locations/customattributes/raw_client.go +++ b/locations/customattributes/raw_client.go @@ -4,11 +4,11 @@ package customattributes import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - locations "github.com/square/square-go-sdk/v2/locations" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + locations "github.com/square/square-go-sdk/v3/locations" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/locations/error_codes.go b/locations/error_codes.go new file mode 100644 index 0000000..6490f3b --- /dev/null +++ b/locations/error_codes.go @@ -0,0 +1,9 @@ +// Code generated by Fern. DO NOT EDIT. + +package locations + +import ( + internal "github.com/square/square-go-sdk/v3/internal" +) + +var ErrorCodes internal.ErrorCodes = internal.ErrorCodes{} diff --git a/locations/transactions.go b/locations/transactions.go index 906d37d..931c287 100644 --- a/locations/transactions.go +++ b/locations/transactions.go @@ -3,7 +3,7 @@ package locations import ( - v2 "github.com/square/square-go-sdk/v2" + v3 "github.com/square/square-go-sdk/v3" big "math/big" ) @@ -104,7 +104,7 @@ type ListTransactionsRequest struct { // oldest first, `DESC` for newest first). // // Default value: `DESC` - SortOrder *v2.SortOrder `json:"-" url:"sort_order,omitempty"` + SortOrder *v3.SortOrder `json:"-" 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. // @@ -145,7 +145,7 @@ func (l *ListTransactionsRequest) SetEndTime(endTime *string) { // SetSortOrder sets the SortOrder field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (l *ListTransactionsRequest) SetSortOrder(sortOrder *v2.SortOrder) { +func (l *ListTransactionsRequest) SetSortOrder(sortOrder *v3.SortOrder) { l.SortOrder = sortOrder l.require(listTransactionsRequestFieldSortOrder) } diff --git a/locations/transactions/client.go b/locations/transactions/client.go index b088f0a..967d61c 100644 --- a/locations/transactions/client.go +++ b/locations/transactions/client.go @@ -4,11 +4,11 @@ package transactions import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - locations "github.com/square/square-go-sdk/v2/locations" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + locations "github.com/square/square-go-sdk/v3/locations" + option "github.com/square/square-go-sdk/v3/option" os "os" ) diff --git a/locations/transactions/raw_client.go b/locations/transactions/raw_client.go index c611f41..41eb9c9 100644 --- a/locations/transactions/raw_client.go +++ b/locations/transactions/raw_client.go @@ -4,11 +4,11 @@ package transactions import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - locations "github.com/square/square-go-sdk/v2/locations" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + locations "github.com/square/square-go-sdk/v3/locations" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/loyalty.go b/loyalty.go index d9f3176..56c2eb8 100644 --- a/loyalty.go +++ b/loyalty.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" big "math/big" ) diff --git a/loyalty/accounts.go b/loyalty/accounts.go index db95538..af2c1b3 100644 --- a/loyalty/accounts.go +++ b/loyalty/accounts.go @@ -3,7 +3,7 @@ package loyalty import ( - v2 "github.com/square/square-go-sdk/v2" + v3 "github.com/square/square-go-sdk/v3" big "math/big" ) @@ -20,7 +20,7 @@ type AccumulateLoyaltyPointsRequest struct { // The points to add to the account. // If you are using the Orders API to manage orders, specify the order ID. // Otherwise, specify the points to add. - AccumulatePoints *v2.LoyaltyEventAccumulatePoints `json:"accumulate_points,omitempty" url:"-"` + AccumulatePoints *v3.LoyaltyEventAccumulatePoints `json:"accumulate_points,omitempty" url:"-"` // A unique string that identifies the `AccumulateLoyaltyPoints` request. // Keys can be any valid string but must be unique for every request. IdempotencyKey string `json:"idempotency_key" url:"-"` @@ -47,7 +47,7 @@ func (a *AccumulateLoyaltyPointsRequest) SetAccountID(accountID string) { // SetAccumulatePoints sets the AccumulatePoints field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (a *AccumulateLoyaltyPointsRequest) SetAccumulatePoints(accumulatePoints *v2.LoyaltyEventAccumulatePoints) { +func (a *AccumulateLoyaltyPointsRequest) SetAccumulatePoints(accumulatePoints *v3.LoyaltyEventAccumulatePoints) { a.AccumulatePoints = accumulatePoints a.require(accumulateLoyaltyPointsRequestFieldAccumulatePoints) } @@ -81,7 +81,7 @@ type AdjustLoyaltyPointsRequest struct { IdempotencyKey string `json:"idempotency_key" url:"-"` // The points to add or subtract and the reason for the adjustment. To add points, specify a positive integer. // To subtract points, specify a negative integer. - AdjustPoints *v2.LoyaltyEventAdjustPoints `json:"adjust_points,omitempty" url:"-"` + AdjustPoints *v3.LoyaltyEventAdjustPoints `json:"adjust_points,omitempty" url:"-"` // Indicates whether to allow a negative adjustment to result in a negative balance. If `true`, a negative // balance is allowed when subtracting points. If `false`, Square returns a `BAD_REQUEST` error when subtracting // the specified number of points would result in a negative balance. The default value is `false`. @@ -114,7 +114,7 @@ func (a *AdjustLoyaltyPointsRequest) SetIdempotencyKey(idempotencyKey string) { // SetAdjustPoints sets the AdjustPoints field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (a *AdjustLoyaltyPointsRequest) SetAdjustPoints(adjustPoints *v2.LoyaltyEventAdjustPoints) { +func (a *AdjustLoyaltyPointsRequest) SetAdjustPoints(adjustPoints *v3.LoyaltyEventAdjustPoints) { a.AdjustPoints = adjustPoints a.require(adjustLoyaltyPointsRequestFieldAdjustPoints) } @@ -133,7 +133,7 @@ var ( type CreateLoyaltyAccountRequest struct { // The loyalty account to create. - LoyaltyAccount *v2.LoyaltyAccount `json:"loyalty_account,omitempty" url:"-"` + LoyaltyAccount *v3.LoyaltyAccount `json:"loyalty_account,omitempty" url:"-"` // A unique string that identifies this `CreateLoyaltyAccount` request. // Keys can be any valid string, but must be unique for every request. IdempotencyKey string `json:"idempotency_key" url:"-"` @@ -151,7 +151,7 @@ func (c *CreateLoyaltyAccountRequest) require(field *big.Int) { // SetLoyaltyAccount sets the LoyaltyAccount field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *CreateLoyaltyAccountRequest) SetLoyaltyAccount(loyaltyAccount *v2.LoyaltyAccount) { +func (c *CreateLoyaltyAccountRequest) SetLoyaltyAccount(loyaltyAccount *v3.LoyaltyAccount) { c.LoyaltyAccount = loyaltyAccount c.require(createLoyaltyAccountRequestFieldLoyaltyAccount) } @@ -197,7 +197,7 @@ var ( type SearchLoyaltyAccountsRequest struct { // The search criteria for the request. - Query *v2.SearchLoyaltyAccountsRequestLoyaltyAccountQuery `json:"query,omitempty" url:"-"` + Query *v3.SearchLoyaltyAccountsRequestLoyaltyAccountQuery `json:"query,omitempty" url:"-"` // The maximum number of results to include in the response. The default value is 30. Limit *int `json:"limit,omitempty" url:"-"` // A pagination cursor returned by a previous call to @@ -221,7 +221,7 @@ func (s *SearchLoyaltyAccountsRequest) require(field *big.Int) { // SetQuery sets the Query field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (s *SearchLoyaltyAccountsRequest) SetQuery(query *v2.SearchLoyaltyAccountsRequestLoyaltyAccountQuery) { +func (s *SearchLoyaltyAccountsRequest) SetQuery(query *v3.SearchLoyaltyAccountsRequestLoyaltyAccountQuery) { s.Query = query s.require(searchLoyaltyAccountsRequestFieldQuery) } diff --git a/loyalty/accounts/client.go b/loyalty/accounts/client.go index 3505f5e..a4ca482 100644 --- a/loyalty/accounts/client.go +++ b/loyalty/accounts/client.go @@ -4,11 +4,11 @@ package accounts import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - loyalty "github.com/square/square-go-sdk/v2/loyalty" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + loyalty "github.com/square/square-go-sdk/v3/loyalty" + option "github.com/square/square-go-sdk/v3/option" os "os" ) diff --git a/loyalty/accounts/raw_client.go b/loyalty/accounts/raw_client.go index 942bc8e..3c5095c 100644 --- a/loyalty/accounts/raw_client.go +++ b/loyalty/accounts/raw_client.go @@ -4,11 +4,11 @@ package accounts import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - loyalty "github.com/square/square-go-sdk/v2/loyalty" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + loyalty "github.com/square/square-go-sdk/v3/loyalty" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/loyalty/client/client.go b/loyalty/client/client.go index 8bd0060..c95791a 100644 --- a/loyalty/client/client.go +++ b/loyalty/client/client.go @@ -4,13 +4,13 @@ package client import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - accounts "github.com/square/square-go-sdk/v2/loyalty/accounts" - client "github.com/square/square-go-sdk/v2/loyalty/programs/client" - rewards "github.com/square/square-go-sdk/v2/loyalty/rewards" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + accounts "github.com/square/square-go-sdk/v3/loyalty/accounts" + client "github.com/square/square-go-sdk/v3/loyalty/programs/client" + rewards "github.com/square/square-go-sdk/v3/loyalty/rewards" + option "github.com/square/square-go-sdk/v3/option" os "os" ) diff --git a/loyalty/client/raw_client.go b/loyalty/client/raw_client.go index b52e90b..308d83e 100644 --- a/loyalty/client/raw_client.go +++ b/loyalty/client/raw_client.go @@ -4,10 +4,10 @@ package client import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/loyalty/error_codes.go b/loyalty/error_codes.go new file mode 100644 index 0000000..cd20fef --- /dev/null +++ b/loyalty/error_codes.go @@ -0,0 +1,9 @@ +// Code generated by Fern. DO NOT EDIT. + +package loyalty + +import ( + internal "github.com/square/square-go-sdk/v3/internal" +) + +var ErrorCodes internal.ErrorCodes = internal.ErrorCodes{} diff --git a/loyalty/programs.go b/loyalty/programs.go index e088476..06007d0 100644 --- a/loyalty/programs.go +++ b/loyalty/programs.go @@ -3,7 +3,7 @@ package loyalty import ( - v2 "github.com/square/square-go-sdk/v2" + v3 "github.com/square/square-go-sdk/v3" big "math/big" ) @@ -24,7 +24,7 @@ type CalculateLoyaltyPointsRequest struct { // The purchase amount for which to calculate the points. // Specify this field if your application does not use the Orders API to process orders. // Otherwise, specify the `order_id`. - TransactionAmountMoney *v2.Money `json:"transaction_amount_money,omitempty" url:"-"` + TransactionAmountMoney *v3.Money `json:"transaction_amount_money,omitempty" url:"-"` // The ID of the target [loyalty account](entity:LoyaltyAccount). Optionally specify this field // if your application uses the Orders API to process orders. // @@ -62,7 +62,7 @@ func (c *CalculateLoyaltyPointsRequest) SetOrderID(orderID *string) { // SetTransactionAmountMoney sets the TransactionAmountMoney field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *CalculateLoyaltyPointsRequest) SetTransactionAmountMoney(transactionAmountMoney *v2.Money) { +func (c *CalculateLoyaltyPointsRequest) SetTransactionAmountMoney(transactionAmountMoney *v3.Money) { c.TransactionAmountMoney = transactionAmountMoney c.require(calculateLoyaltyPointsRequestFieldTransactionAmountMoney) } diff --git a/loyalty/programs/client/client.go b/loyalty/programs/client/client.go index 494016e..618e72c 100644 --- a/loyalty/programs/client/client.go +++ b/loyalty/programs/client/client.go @@ -4,12 +4,12 @@ package client import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - loyalty "github.com/square/square-go-sdk/v2/loyalty" - promotions "github.com/square/square-go-sdk/v2/loyalty/programs/promotions" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + loyalty "github.com/square/square-go-sdk/v3/loyalty" + promotions "github.com/square/square-go-sdk/v3/loyalty/programs/promotions" + option "github.com/square/square-go-sdk/v3/option" os "os" ) diff --git a/loyalty/programs/client/raw_client.go b/loyalty/programs/client/raw_client.go index 6026592..bf37395 100644 --- a/loyalty/programs/client/raw_client.go +++ b/loyalty/programs/client/raw_client.go @@ -4,11 +4,11 @@ package client import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - loyalty "github.com/square/square-go-sdk/v2/loyalty" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + loyalty "github.com/square/square-go-sdk/v3/loyalty" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/loyalty/programs/error_codes.go b/loyalty/programs/error_codes.go new file mode 100644 index 0000000..06b3dac --- /dev/null +++ b/loyalty/programs/error_codes.go @@ -0,0 +1,9 @@ +// Code generated by Fern. DO NOT EDIT. + +package programs + +import ( + internal "github.com/square/square-go-sdk/v3/internal" +) + +var ErrorCodes internal.ErrorCodes = internal.ErrorCodes{} diff --git a/loyalty/programs/promotions.go b/loyalty/programs/promotions.go index 77f880f..9d78308 100644 --- a/loyalty/programs/promotions.go +++ b/loyalty/programs/promotions.go @@ -3,7 +3,7 @@ package programs import ( - v2 "github.com/square/square-go-sdk/v2" + v3 "github.com/square/square-go-sdk/v3" big "math/big" ) @@ -56,7 +56,7 @@ type CreateLoyaltyPromotionRequest struct { // using the `main` keyword. ProgramID string `json:"-" url:"-"` // The loyalty promotion to create. - LoyaltyPromotion *v2.LoyaltyPromotion `json:"loyalty_promotion,omitempty" url:"-"` + LoyaltyPromotion *v3.LoyaltyPromotion `json:"loyalty_promotion,omitempty" url:"-"` // A unique identifier for this request, which is used to ensure idempotency. For more information, // see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). IdempotencyKey string `json:"idempotency_key" url:"-"` @@ -81,7 +81,7 @@ func (c *CreateLoyaltyPromotionRequest) SetProgramID(programID string) { // SetLoyaltyPromotion sets the LoyaltyPromotion field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *CreateLoyaltyPromotionRequest) SetLoyaltyPromotion(loyaltyPromotion *v2.LoyaltyPromotion) { +func (c *CreateLoyaltyPromotionRequest) SetLoyaltyPromotion(loyaltyPromotion *v3.LoyaltyPromotion) { c.LoyaltyPromotion = loyaltyPromotion c.require(createLoyaltyPromotionRequestFieldLoyaltyPromotion) } @@ -144,7 +144,7 @@ type ListPromotionsRequest 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. - Status *v2.LoyaltyPromotionStatus `json:"-" url:"status,omitempty"` + Status *v3.LoyaltyPromotionStatus `json:"-" 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). @@ -174,7 +174,7 @@ func (l *ListPromotionsRequest) SetProgramID(programID string) { // SetStatus sets the Status field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (l *ListPromotionsRequest) SetStatus(status *v2.LoyaltyPromotionStatus) { +func (l *ListPromotionsRequest) SetStatus(status *v3.LoyaltyPromotionStatus) { l.Status = status l.require(listPromotionsRequestFieldStatus) } diff --git a/loyalty/programs/promotions/client.go b/loyalty/programs/promotions/client.go index 6e3b389..db7a1b6 100644 --- a/loyalty/programs/promotions/client.go +++ b/loyalty/programs/promotions/client.go @@ -4,11 +4,11 @@ package promotions import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - programs "github.com/square/square-go-sdk/v2/loyalty/programs" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + programs "github.com/square/square-go-sdk/v3/loyalty/programs" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/loyalty/programs/promotions/raw_client.go b/loyalty/programs/promotions/raw_client.go index ed6efe6..d2b8c4c 100644 --- a/loyalty/programs/promotions/raw_client.go +++ b/loyalty/programs/promotions/raw_client.go @@ -4,11 +4,11 @@ package promotions import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - programs "github.com/square/square-go-sdk/v2/loyalty/programs" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + programs "github.com/square/square-go-sdk/v3/loyalty/programs" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/loyalty/rewards.go b/loyalty/rewards.go index 6910a26..9722159 100644 --- a/loyalty/rewards.go +++ b/loyalty/rewards.go @@ -3,7 +3,7 @@ package loyalty import ( - v2 "github.com/square/square-go-sdk/v2" + v3 "github.com/square/square-go-sdk/v3" big "math/big" ) @@ -14,7 +14,7 @@ var ( type CreateLoyaltyRewardRequest struct { // The reward to create. - Reward *v2.LoyaltyReward `json:"reward,omitempty" url:"-"` + Reward *v3.LoyaltyReward `json:"reward,omitempty" url:"-"` // A unique string that identifies this `CreateLoyaltyReward` request. // Keys can be any valid string, but must be unique for every request. IdempotencyKey string `json:"idempotency_key" url:"-"` @@ -32,7 +32,7 @@ func (c *CreateLoyaltyRewardRequest) require(field *big.Int) { // SetReward sets the Reward field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *CreateLoyaltyRewardRequest) SetReward(reward *v2.LoyaltyReward) { +func (c *CreateLoyaltyRewardRequest) SetReward(reward *v3.LoyaltyReward) { c.Reward = reward c.require(createLoyaltyRewardRequestFieldReward) } @@ -152,7 +152,7 @@ var ( type SearchLoyaltyRewardsRequest struct { // The search criteria for the request. // If empty, the endpoint retrieves all loyalty rewards in the loyalty program. - Query *v2.SearchLoyaltyRewardsRequestLoyaltyRewardQuery `json:"query,omitempty" url:"-"` + Query *v3.SearchLoyaltyRewardsRequestLoyaltyRewardQuery `json:"query,omitempty" url:"-"` // The maximum number of results to return in the response. The default value is 30. Limit *int `json:"limit,omitempty" url:"-"` // A pagination cursor returned by a previous call to @@ -175,7 +175,7 @@ func (s *SearchLoyaltyRewardsRequest) require(field *big.Int) { // SetQuery sets the Query field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (s *SearchLoyaltyRewardsRequest) SetQuery(query *v2.SearchLoyaltyRewardsRequestLoyaltyRewardQuery) { +func (s *SearchLoyaltyRewardsRequest) SetQuery(query *v3.SearchLoyaltyRewardsRequestLoyaltyRewardQuery) { s.Query = query s.require(searchLoyaltyRewardsRequestFieldQuery) } diff --git a/loyalty/rewards/client.go b/loyalty/rewards/client.go index f124373..3b357e4 100644 --- a/loyalty/rewards/client.go +++ b/loyalty/rewards/client.go @@ -4,11 +4,11 @@ package rewards import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - loyalty "github.com/square/square-go-sdk/v2/loyalty" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + loyalty "github.com/square/square-go-sdk/v3/loyalty" + option "github.com/square/square-go-sdk/v3/option" os "os" ) diff --git a/loyalty/rewards/raw_client.go b/loyalty/rewards/raw_client.go index d06e6a5..20f34b5 100644 --- a/loyalty/rewards/raw_client.go +++ b/loyalty/rewards/raw_client.go @@ -4,11 +4,11 @@ package rewards import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - loyalty "github.com/square/square-go-sdk/v2/loyalty" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + loyalty "github.com/square/square-go-sdk/v3/loyalty" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/merchants.go b/merchants.go index 4f74d45..2a3aa04 100644 --- a/merchants.go +++ b/merchants.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" big "math/big" ) diff --git a/merchants/client/client.go b/merchants/client/client.go index 4d3548b..1df8f9b 100644 --- a/merchants/client/client.go +++ b/merchants/client/client.go @@ -5,12 +5,12 @@ package client import ( context "context" fmt "fmt" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - customattributedefinitions "github.com/square/square-go-sdk/v2/merchants/customattributedefinitions" - customattributes "github.com/square/square-go-sdk/v2/merchants/customattributes" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + customattributedefinitions "github.com/square/square-go-sdk/v3/merchants/customattributedefinitions" + customattributes "github.com/square/square-go-sdk/v3/merchants/customattributes" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/merchants/client/raw_client.go b/merchants/client/raw_client.go index 075aabe..d16d99b 100644 --- a/merchants/client/raw_client.go +++ b/merchants/client/raw_client.go @@ -4,10 +4,10 @@ package client import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/merchants/custom_attribute_definitions.go b/merchants/custom_attribute_definitions.go index c7c97ce..212d3f5 100644 --- a/merchants/custom_attribute_definitions.go +++ b/merchants/custom_attribute_definitions.go @@ -3,7 +3,7 @@ package merchants import ( - v2 "github.com/square/square-go-sdk/v2" + v3 "github.com/square/square-go-sdk/v3" big "math/big" ) @@ -18,7 +18,7 @@ type CreateMerchantCustomAttributeDefinitionRequest struct { // definition hosted on the Square CDN. For more information, including supported values and constraints, see // [Supported data types](https://developer.squareup.com/docs/devtools/customattributes/overview#supported-data-types). // - `name` is required unless `visibility` is set to `VISIBILITY_HIDDEN`. - CustomAttributeDefinition *v2.CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"-"` + CustomAttributeDefinition *v3.CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"-"` // A unique identifier for this request, used to ensure idempotency. For more information, // see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). IdempotencyKey *string `json:"idempotency_key,omitempty" url:"-"` @@ -36,7 +36,7 @@ func (c *CreateMerchantCustomAttributeDefinitionRequest) require(field *big.Int) // SetCustomAttributeDefinition sets the CustomAttributeDefinition field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *CreateMerchantCustomAttributeDefinitionRequest) SetCustomAttributeDefinition(customAttributeDefinition *v2.CustomAttributeDefinition) { +func (c *CreateMerchantCustomAttributeDefinitionRequest) SetCustomAttributeDefinition(customAttributeDefinition *v3.CustomAttributeDefinition) { c.CustomAttributeDefinition = customAttributeDefinition c.require(createMerchantCustomAttributeDefinitionRequestFieldCustomAttributeDefinition) } @@ -122,7 +122,7 @@ var ( type ListCustomAttributeDefinitionsRequest struct { // Filters the `CustomAttributeDefinition` results by their `visibility` values. - VisibilityFilter *v2.VisibilityFilter `json:"-" url:"visibility_filter,omitempty"` + VisibilityFilter *v3.VisibilityFilter `json:"-" url:"visibility_filter,omitempty"` // 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). @@ -145,7 +145,7 @@ func (l *ListCustomAttributeDefinitionsRequest) require(field *big.Int) { // SetVisibilityFilter sets the VisibilityFilter field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (l *ListCustomAttributeDefinitionsRequest) SetVisibilityFilter(visibilityFilter *v2.VisibilityFilter) { +func (l *ListCustomAttributeDefinitionsRequest) SetVisibilityFilter(visibilityFilter *v3.VisibilityFilter) { l.VisibilityFilter = visibilityFilter l.require(listCustomAttributeDefinitionsRequestFieldVisibilityFilter) } @@ -186,7 +186,7 @@ type UpdateMerchantCustomAttributeDefinitionRequest struct { // The version field must match the current version of the custom attribute definition to enable // [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) // If this is not important for your application, version can be set to -1. For any other values, the request fails with a BAD_REQUEST error. - CustomAttributeDefinition *v2.CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"-"` + CustomAttributeDefinition *v3.CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"-"` // A unique identifier for this request, used to ensure idempotency. For more information, // see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). IdempotencyKey *string `json:"idempotency_key,omitempty" url:"-"` @@ -211,7 +211,7 @@ func (u *UpdateMerchantCustomAttributeDefinitionRequest) SetKey(key string) { // SetCustomAttributeDefinition sets the CustomAttributeDefinition field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (u *UpdateMerchantCustomAttributeDefinitionRequest) SetCustomAttributeDefinition(customAttributeDefinition *v2.CustomAttributeDefinition) { +func (u *UpdateMerchantCustomAttributeDefinitionRequest) SetCustomAttributeDefinition(customAttributeDefinition *v3.CustomAttributeDefinition) { u.CustomAttributeDefinition = customAttributeDefinition u.require(updateMerchantCustomAttributeDefinitionRequestFieldCustomAttributeDefinition) } diff --git a/merchants/custom_attributes.go b/merchants/custom_attributes.go index f2f155e..23d4edc 100644 --- a/merchants/custom_attributes.go +++ b/merchants/custom_attributes.go @@ -3,7 +3,7 @@ package merchants import ( - v2 "github.com/square/square-go-sdk/v2" + v3 "github.com/square/square-go-sdk/v3" big "math/big" ) @@ -14,7 +14,7 @@ var ( type BulkDeleteMerchantCustomAttributesRequest struct { // The data used to update the `CustomAttribute` objects. // The keys must be unique and are used to map to the corresponding response. - Values map[string]*v2.BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest `json:"values,omitempty" url:"-"` + Values map[string]*v3.BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest `json:"values,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -29,7 +29,7 @@ func (b *BulkDeleteMerchantCustomAttributesRequest) require(field *big.Int) { // SetValues sets the Values field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (b *BulkDeleteMerchantCustomAttributesRequest) SetValues(values map[string]*v2.BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest) { +func (b *BulkDeleteMerchantCustomAttributesRequest) SetValues(values map[string]*v3.BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest) { b.Values = values b.require(bulkDeleteMerchantCustomAttributesRequestFieldValues) } @@ -42,7 +42,7 @@ type BulkUpsertMerchantCustomAttributesRequest struct { // A map containing 1 to 25 individual upsert requests. For each request, provide an // arbitrary ID that is unique for this `BulkUpsertMerchantCustomAttributes` request and the // information needed to create or update a custom attribute. - Values map[string]*v2.BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest `json:"values,omitempty" url:"-"` + Values map[string]*v3.BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest `json:"values,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -57,7 +57,7 @@ func (b *BulkUpsertMerchantCustomAttributesRequest) require(field *big.Int) { // SetValues sets the Values field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (b *BulkUpsertMerchantCustomAttributesRequest) SetValues(values map[string]*v2.BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest) { +func (b *BulkUpsertMerchantCustomAttributesRequest) SetValues(values map[string]*v3.BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest) { b.Values = values b.require(bulkUpsertMerchantCustomAttributesRequestFieldValues) } @@ -175,7 +175,7 @@ type ListCustomAttributesRequest struct { // The ID of the target [merchant](entity:Merchant). MerchantID string `json:"-" url:"-"` // Filters the `CustomAttributeDefinition` results by their `visibility` values. - VisibilityFilter *v2.VisibilityFilter `json:"-" url:"visibility_filter,omitempty"` + VisibilityFilter *v3.VisibilityFilter `json:"-" url:"visibility_filter,omitempty"` // 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). @@ -209,7 +209,7 @@ func (l *ListCustomAttributesRequest) SetMerchantID(merchantID string) { // SetVisibilityFilter sets the VisibilityFilter field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (l *ListCustomAttributesRequest) SetVisibilityFilter(visibilityFilter *v2.VisibilityFilter) { +func (l *ListCustomAttributesRequest) SetVisibilityFilter(visibilityFilter *v3.VisibilityFilter) { l.VisibilityFilter = visibilityFilter l.require(listCustomAttributesRequestFieldVisibilityFilter) } @@ -255,7 +255,7 @@ type UpsertMerchantCustomAttributeRequest struct { // - The version field must match the current version of the custom attribute definition to enable // [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) // If this is not important for your application, version can be set to -1. For any other values, the request fails with a BAD_REQUEST error. - CustomAttribute *v2.CustomAttribute `json:"custom_attribute,omitempty" url:"-"` + CustomAttribute *v3.CustomAttribute `json:"custom_attribute,omitempty" url:"-"` // A unique identifier for this request, used to ensure idempotency. For more information, // see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). IdempotencyKey *string `json:"idempotency_key,omitempty" url:"-"` @@ -287,7 +287,7 @@ func (u *UpsertMerchantCustomAttributeRequest) SetKey(key string) { // SetCustomAttribute sets the CustomAttribute field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (u *UpsertMerchantCustomAttributeRequest) SetCustomAttribute(customAttribute *v2.CustomAttribute) { +func (u *UpsertMerchantCustomAttributeRequest) SetCustomAttribute(customAttribute *v3.CustomAttribute) { u.CustomAttribute = customAttribute u.require(upsertMerchantCustomAttributeRequestFieldCustomAttribute) } diff --git a/merchants/customattributedefinitions/client.go b/merchants/customattributedefinitions/client.go index 90f50bc..6e53bb3 100644 --- a/merchants/customattributedefinitions/client.go +++ b/merchants/customattributedefinitions/client.go @@ -4,11 +4,11 @@ package customattributedefinitions import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - merchants "github.com/square/square-go-sdk/v2/merchants" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + merchants "github.com/square/square-go-sdk/v3/merchants" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/merchants/customattributedefinitions/raw_client.go b/merchants/customattributedefinitions/raw_client.go index 1dec519..9da3114 100644 --- a/merchants/customattributedefinitions/raw_client.go +++ b/merchants/customattributedefinitions/raw_client.go @@ -4,11 +4,11 @@ package customattributedefinitions import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - merchants "github.com/square/square-go-sdk/v2/merchants" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + merchants "github.com/square/square-go-sdk/v3/merchants" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/merchants/customattributes/client.go b/merchants/customattributes/client.go index 9fad6ad..ad25d76 100644 --- a/merchants/customattributes/client.go +++ b/merchants/customattributes/client.go @@ -4,11 +4,11 @@ package customattributes import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - merchants "github.com/square/square-go-sdk/v2/merchants" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + merchants "github.com/square/square-go-sdk/v3/merchants" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/merchants/customattributes/raw_client.go b/merchants/customattributes/raw_client.go index 8533af8..d53d21a 100644 --- a/merchants/customattributes/raw_client.go +++ b/merchants/customattributes/raw_client.go @@ -4,11 +4,11 @@ package customattributes import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - merchants "github.com/square/square-go-sdk/v2/merchants" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + merchants "github.com/square/square-go-sdk/v3/merchants" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/merchants/error_codes.go b/merchants/error_codes.go new file mode 100644 index 0000000..863b5c0 --- /dev/null +++ b/merchants/error_codes.go @@ -0,0 +1,9 @@ +// Code generated by Fern. DO NOT EDIT. + +package merchants + +import ( + internal "github.com/square/square-go-sdk/v3/internal" +) + +var ErrorCodes internal.ErrorCodes = internal.ErrorCodes{} diff --git a/mobile.go b/mobile.go deleted file mode 100644 index 54cf114..0000000 --- a/mobile.go +++ /dev/null @@ -1,153 +0,0 @@ -// Code generated by Fern. DO NOT EDIT. - -package square - -import ( - json "encoding/json" - fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" - big "math/big" -) - -var ( - createMobileAuthorizationCodeRequestFieldLocationID = big.NewInt(1 << 0) -) - -type CreateMobileAuthorizationCodeRequest struct { - // The Square location ID that the authorization code should be tied to. - LocationID *string `json:"location_id,omitempty" url:"-"` - - // Private bitmask of fields set to an explicit value and therefore not to be omitted - explicitFields *big.Int `json:"-" url:"-"` -} - -func (c *CreateMobileAuthorizationCodeRequest) require(field *big.Int) { - if c.explicitFields == nil { - c.explicitFields = big.NewInt(0) - } - c.explicitFields.Or(c.explicitFields, field) -} - -// SetLocationID sets the LocationID field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (c *CreateMobileAuthorizationCodeRequest) SetLocationID(locationID *string) { - c.LocationID = locationID - c.require(createMobileAuthorizationCodeRequestFieldLocationID) -} - -// Defines the fields that are included in the response body of -// a request to the `CreateMobileAuthorizationCode` endpoint. -var ( - createMobileAuthorizationCodeResponseFieldAuthorizationCode = big.NewInt(1 << 0) - createMobileAuthorizationCodeResponseFieldExpiresAt = big.NewInt(1 << 1) - createMobileAuthorizationCodeResponseFieldErrors = big.NewInt(1 << 2) -) - -type CreateMobileAuthorizationCodeResponse struct { - // The generated authorization code that connects a mobile application instance - // to a Square account. - AuthorizationCode *string `json:"authorization_code,omitempty" url:"authorization_code,omitempty"` - // 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"` - // Any errors that occurred during the request. - Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` - - // Private bitmask of fields set to an explicit value and therefore not to be omitted - explicitFields *big.Int `json:"-" url:"-"` - - extraProperties map[string]interface{} - rawJSON json.RawMessage -} - -func (c *CreateMobileAuthorizationCodeResponse) GetAuthorizationCode() *string { - if c == nil { - return nil - } - return c.AuthorizationCode -} - -func (c *CreateMobileAuthorizationCodeResponse) GetExpiresAt() *string { - if c == nil { - return nil - } - return c.ExpiresAt -} - -func (c *CreateMobileAuthorizationCodeResponse) GetErrors() []*Error { - if c == nil { - return nil - } - return c.Errors -} - -func (c *CreateMobileAuthorizationCodeResponse) GetExtraProperties() map[string]interface{} { - return c.extraProperties -} - -func (c *CreateMobileAuthorizationCodeResponse) require(field *big.Int) { - if c.explicitFields == nil { - c.explicitFields = big.NewInt(0) - } - c.explicitFields.Or(c.explicitFields, field) -} - -// SetAuthorizationCode sets the AuthorizationCode field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (c *CreateMobileAuthorizationCodeResponse) SetAuthorizationCode(authorizationCode *string) { - c.AuthorizationCode = authorizationCode - c.require(createMobileAuthorizationCodeResponseFieldAuthorizationCode) -} - -// SetExpiresAt sets the ExpiresAt field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (c *CreateMobileAuthorizationCodeResponse) SetExpiresAt(expiresAt *string) { - c.ExpiresAt = expiresAt - c.require(createMobileAuthorizationCodeResponseFieldExpiresAt) -} - -// SetErrors sets the Errors field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (c *CreateMobileAuthorizationCodeResponse) SetErrors(errors []*Error) { - c.Errors = errors - c.require(createMobileAuthorizationCodeResponseFieldErrors) -} - -func (c *CreateMobileAuthorizationCodeResponse) UnmarshalJSON(data []byte) error { - type unmarshaler CreateMobileAuthorizationCodeResponse - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *c = CreateMobileAuthorizationCodeResponse(value) - extraProperties, err := internal.ExtractExtraProperties(data, *c) - if err != nil { - return err - } - c.extraProperties = extraProperties - c.rawJSON = json.RawMessage(data) - return nil -} - -func (c *CreateMobileAuthorizationCodeResponse) MarshalJSON() ([]byte, error) { - type embed CreateMobileAuthorizationCodeResponse - var marshaler = struct { - embed - }{ - embed: embed(*c), - } - explicitMarshaler := internal.HandleExplicitFields(marshaler, c.explicitFields) - return json.Marshal(explicitMarshaler) -} - -func (c *CreateMobileAuthorizationCodeResponse) String() string { - if len(c.rawJSON) > 0 { - if value, err := internal.StringifyJSON(c.rawJSON); err == nil { - return value - } - } - if value, err := internal.StringifyJSON(c); err == nil { - return value - } - return fmt.Sprintf("%#v", c) -} diff --git a/mobile/client.go b/mobile/client.go index 600a784..fe2ceca 100644 --- a/mobile/client.go +++ b/mobile/client.go @@ -4,10 +4,9 @@ package mobile import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" os "os" ) @@ -39,33 +38,16 @@ func NewClient(options *core.RequestOptions) *Client { } } -// __Note:__ This endpoint is used by the deprecated Reader SDK. -// Developers should update their integration to use the [Mobile Payments SDK](https://developer.squareup.com/docs/mobile-payments-sdk), which includes its own authorization methods. -// -// Generates code to authorize a mobile application to connect to a Square card reader. -// -// Authorization codes are one-time-use codes and expire 60 minutes after being issued. -// -// The `Authorization` header you provide to this endpoint must have the following format: -// -// ``` -// Authorization: Bearer ACCESS_TOKEN -// ``` -// -// Replace `ACCESS_TOKEN` with a -// [valid production authorization credential](https://developer.squareup.com/docs/build-basics/access-tokens). func (c *Client) AuthorizationCode( ctx context.Context, - request *square.CreateMobileAuthorizationCodeRequest, opts ...option.RequestOption, -) (*square.CreateMobileAuthorizationCodeResponse, error) { - response, err := c.WithRawResponse.AuthorizationCode( +) error { + _, err := c.WithRawResponse.AuthorizationCode( ctx, - request, opts..., ) if err != nil { - return nil, err + return err } - return response.Body, nil + return nil } diff --git a/mobile/raw_client.go b/mobile/raw_client.go index c4eb8bf..1f0b2e4 100644 --- a/mobile/raw_client.go +++ b/mobile/raw_client.go @@ -4,10 +4,9 @@ package mobile import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) @@ -32,9 +31,8 @@ func NewRawClient(options *core.RequestOptions) *RawClient { func (r *RawClient) AuthorizationCode( ctx context.Context, - request *square.CreateMobileAuthorizationCodeRequest, opts ...option.RequestOption, -) (*core.Response[*square.CreateMobileAuthorizationCodeResponse], error) { +) (*core.Response[any], error) { options := core.NewRequestOptions(opts...) baseURL := internal.ResolveBaseURL( options.BaseURL, @@ -46,8 +44,6 @@ func (r *RawClient) AuthorizationCode( r.options.ToHeader(), options.ToHeader(), ) - headers.Add("Content-Type", "application/json") - var response *square.CreateMobileAuthorizationCodeResponse raw, err := r.caller.Call( ctx, &internal.CallParams{ @@ -58,16 +54,14 @@ func (r *RawClient) AuthorizationCode( BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, - Request: request, - Response: &response, }, ) if err != nil { return nil, err } - return &core.Response[*square.CreateMobileAuthorizationCodeResponse]{ + return &core.Response[any]{ StatusCode: raw.StatusCode, Header: raw.Header, - Body: response, + Body: nil, }, nil } diff --git a/o_auth.go b/o_auth.go index c3c4089..205c20a 100644 --- a/o_auth.go +++ b/o_auth.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" big "math/big" ) @@ -20,6 +20,7 @@ var ( obtainTokenRequestFieldScopes = big.NewInt(1 << 7) obtainTokenRequestFieldShortLived = big.NewInt(1 << 8) obtainTokenRequestFieldCodeVerifier = big.NewInt(1 << 9) + obtainTokenRequestFieldUseJwt = big.NewInt(1 << 10) ) type ObtainTokenRequest struct { @@ -81,6 +82,10 @@ type ObtainTokenRequest struct { // // Required for the PKCE flow if `grant_type` is `authorization_code`. CodeVerifier *string `json:"code_verifier,omitempty" url:"-"` + // Indicates whether to use a JWT (JSON Web Token) as the OAuth access token. + // When set to `true`, the OAuth flow returns a JWT to your application, used in the + // same way as a regular token. The default value is `false`. + UseJwt *bool `json:"use_jwt,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -163,6 +168,13 @@ func (o *ObtainTokenRequest) SetCodeVerifier(codeVerifier *string) { o.require(obtainTokenRequestFieldCodeVerifier) } +// SetUseJwt sets the UseJwt field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (o *ObtainTokenRequest) SetUseJwt(useJwt *bool) { + o.UseJwt = useJwt + o.require(obtainTokenRequestFieldUseJwt) +} + var ( revokeTokenRequestFieldClientID = big.NewInt(1 << 0) revokeTokenRequestFieldAccessToken = big.NewInt(1 << 1) diff --git a/oauth/client.go b/oauth/client.go index 014a0d6..dd2131e 100644 --- a/oauth/client.go +++ b/oauth/client.go @@ -4,10 +4,10 @@ package oauth import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" os "os" ) diff --git a/oauth/raw_client.go b/oauth/raw_client.go index 39039cc..1c7cee1 100644 --- a/oauth/raw_client.go +++ b/oauth/raw_client.go @@ -4,10 +4,10 @@ package oauth import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/option/request_option.go b/option/request_option.go index 481a342..f507fc4 100644 --- a/option/request_option.go +++ b/option/request_option.go @@ -3,7 +3,7 @@ package option import ( - core "github.com/square/square-go-sdk/v2/core" + core "github.com/square/square-go-sdk/v3/core" http "net/http" url "net/url" ) diff --git a/orders.go b/orders.go index ee5c2ab..d2b1790 100644 --- a/orders.go +++ b/orders.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" big "math/big" ) @@ -1857,7 +1857,9 @@ func (s SearchOrdersSortField) Ptr() *SearchOrdersSortField { // A filter based on order `source` information. var ( - searchOrdersSourceFilterFieldSourceNames = big.NewInt(1 << 0) + searchOrdersSourceFilterFieldSourceNames = big.NewInt(1 << 0) + searchOrdersSourceFilterFieldSourceApplicationIDs = big.NewInt(1 << 1) + searchOrdersSourceFilterFieldSourceClientOus = big.NewInt(1 << 2) ) type SearchOrdersSourceFilter struct { @@ -1866,6 +1868,16 @@ type SearchOrdersSourceFilter struct { // // Max: 10 source names. SourceNames []string `json:"source_names,omitempty" url:"source_names,omitempty"` + // Filters by the [Source](entity:OrderSource) `applicationId`. The filter returns any orders + // with a `source.applicationId` that matches any of the listed source applicationIds. + // + // Max: 100 source applicationIds. + SourceApplicationIDs []string `json:"source_application_ids,omitempty" url:"source_application_ids,omitempty"` + // Filters by the [Source](entity:OrderSource) `clientOu`. The filter returns any orders + // with a `source.clientOu` that matches any of the listed source clientOus. + // + // Max: 100 source clientOus. + SourceClientOus []string `json:"source_client_ous,omitempty" url:"source_client_ous,omitempty"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -1881,6 +1893,20 @@ func (s *SearchOrdersSourceFilter) GetSourceNames() []string { return s.SourceNames } +func (s *SearchOrdersSourceFilter) GetSourceApplicationIDs() []string { + if s == nil { + return nil + } + return s.SourceApplicationIDs +} + +func (s *SearchOrdersSourceFilter) GetSourceClientOus() []string { + if s == nil { + return nil + } + return s.SourceClientOus +} + func (s *SearchOrdersSourceFilter) GetExtraProperties() map[string]interface{} { return s.extraProperties } @@ -1899,6 +1925,20 @@ func (s *SearchOrdersSourceFilter) SetSourceNames(sourceNames []string) { s.require(searchOrdersSourceFilterFieldSourceNames) } +// SetSourceApplicationIDs sets the SourceApplicationIDs field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SearchOrdersSourceFilter) SetSourceApplicationIDs(sourceApplicationIDs []string) { + s.SourceApplicationIDs = sourceApplicationIDs + s.require(searchOrdersSourceFilterFieldSourceApplicationIDs) +} + +// SetSourceClientOus sets the SourceClientOus field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SearchOrdersSourceFilter) SetSourceClientOus(sourceClientOus []string) { + s.SourceClientOus = sourceClientOus + s.require(searchOrdersSourceFilterFieldSourceClientOus) +} + func (s *SearchOrdersSourceFilter) UnmarshalJSON(data []byte) error { type unmarshaler SearchOrdersSourceFilter var value unmarshaler diff --git a/orders/client/client.go b/orders/client/client.go index f190b53..1d21203 100644 --- a/orders/client/client.go +++ b/orders/client/client.go @@ -4,12 +4,12 @@ package client import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" - customattributedefinitions "github.com/square/square-go-sdk/v2/orders/customattributedefinitions" - customattributes "github.com/square/square-go-sdk/v2/orders/customattributes" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" + customattributedefinitions "github.com/square/square-go-sdk/v3/orders/customattributedefinitions" + customattributes "github.com/square/square-go-sdk/v3/orders/customattributes" os "os" ) diff --git a/orders/client/raw_client.go b/orders/client/raw_client.go index 611b981..f96a9c2 100644 --- a/orders/client/raw_client.go +++ b/orders/client/raw_client.go @@ -4,10 +4,10 @@ package client import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/orders/custom_attribute_definitions.go b/orders/custom_attribute_definitions.go index 210b4a6..9bce1e8 100644 --- a/orders/custom_attribute_definitions.go +++ b/orders/custom_attribute_definitions.go @@ -3,7 +3,7 @@ package orders import ( - v2 "github.com/square/square-go-sdk/v2" + v3 "github.com/square/square-go-sdk/v3" big "math/big" ) @@ -19,7 +19,7 @@ type CreateOrderCustomAttributeDefinitionRequest struct { // [Specifying the schema](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attribute-definitions#specify-schema). // - If provided, `name` must be unique (case-sensitive) across all visible customer-related custom attribute definitions for the seller. // - All custom attributes are visible in exported customer data, including those set to `VISIBILITY_HIDDEN`. - CustomAttributeDefinition *v2.CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"-"` + CustomAttributeDefinition *v3.CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"-"` // A unique identifier for this request, used to ensure idempotency. // For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). IdempotencyKey *string `json:"idempotency_key,omitempty" url:"-"` @@ -37,7 +37,7 @@ func (c *CreateOrderCustomAttributeDefinitionRequest) require(field *big.Int) { // SetCustomAttributeDefinition sets the CustomAttributeDefinition field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *CreateOrderCustomAttributeDefinitionRequest) SetCustomAttributeDefinition(customAttributeDefinition *v2.CustomAttributeDefinition) { +func (c *CreateOrderCustomAttributeDefinitionRequest) SetCustomAttributeDefinition(customAttributeDefinition *v3.CustomAttributeDefinition) { c.CustomAttributeDefinition = customAttributeDefinition c.require(createOrderCustomAttributeDefinitionRequestFieldCustomAttributeDefinition) } @@ -120,7 +120,7 @@ var ( type ListCustomAttributeDefinitionsRequest struct { // Requests that all of the custom attributes be returned, or only those that are read-only or read-write. - VisibilityFilter *v2.VisibilityFilter `json:"-" url:"visibility_filter,omitempty"` + VisibilityFilter *v3.VisibilityFilter `json:"-" url:"visibility_filter,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/working-with-apis/pagination). @@ -144,7 +144,7 @@ func (l *ListCustomAttributeDefinitionsRequest) require(field *big.Int) { // SetVisibilityFilter sets the VisibilityFilter field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (l *ListCustomAttributeDefinitionsRequest) SetVisibilityFilter(visibilityFilter *v2.VisibilityFilter) { +func (l *ListCustomAttributeDefinitionsRequest) SetVisibilityFilter(visibilityFilter *v3.VisibilityFilter) { l.VisibilityFilter = visibilityFilter l.require(listCustomAttributeDefinitionsRequestFieldVisibilityFilter) } @@ -177,7 +177,7 @@ type UpdateOrderCustomAttributeDefinitionRequest struct { // [Updatable definition fields](https://developer.squareup.com/docs/orders-custom-attributes-api/custom-attribute-definitions#updatable-definition-fields). // // To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control, include the optional `version` field and specify the current version of the custom attribute definition. - CustomAttributeDefinition *v2.CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"-"` + CustomAttributeDefinition *v3.CustomAttributeDefinition `json:"custom_attribute_definition,omitempty" url:"-"` // A unique identifier for this request, used to ensure idempotency. // For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). IdempotencyKey *string `json:"idempotency_key,omitempty" url:"-"` @@ -202,7 +202,7 @@ func (u *UpdateOrderCustomAttributeDefinitionRequest) SetKey(key string) { // SetCustomAttributeDefinition sets the CustomAttributeDefinition field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (u *UpdateOrderCustomAttributeDefinitionRequest) SetCustomAttributeDefinition(customAttributeDefinition *v2.CustomAttributeDefinition) { +func (u *UpdateOrderCustomAttributeDefinitionRequest) SetCustomAttributeDefinition(customAttributeDefinition *v3.CustomAttributeDefinition) { u.CustomAttributeDefinition = customAttributeDefinition u.require(updateOrderCustomAttributeDefinitionRequestFieldCustomAttributeDefinition) } diff --git a/orders/custom_attributes.go b/orders/custom_attributes.go index 8fd159d..be4b3d1 100644 --- a/orders/custom_attributes.go +++ b/orders/custom_attributes.go @@ -3,7 +3,7 @@ package orders import ( - v2 "github.com/square/square-go-sdk/v2" + v3 "github.com/square/square-go-sdk/v3" big "math/big" ) @@ -13,7 +13,7 @@ var ( type BulkDeleteOrderCustomAttributesRequest struct { // A map of requests that correspond to individual delete operations for custom attributes. - Values map[string]*v2.BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute `json:"values,omitempty" url:"-"` + Values map[string]*v3.BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute `json:"values,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -28,7 +28,7 @@ func (b *BulkDeleteOrderCustomAttributesRequest) require(field *big.Int) { // SetValues sets the Values field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (b *BulkDeleteOrderCustomAttributesRequest) SetValues(values map[string]*v2.BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute) { +func (b *BulkDeleteOrderCustomAttributesRequest) SetValues(values map[string]*v3.BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute) { b.Values = values b.require(bulkDeleteOrderCustomAttributesRequestFieldValues) } @@ -39,7 +39,7 @@ var ( type BulkUpsertOrderCustomAttributesRequest struct { // A map of requests that correspond to individual upsert operations for custom attributes. - Values map[string]*v2.BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute `json:"values,omitempty" url:"-"` + Values map[string]*v3.BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute `json:"values,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -54,7 +54,7 @@ func (b *BulkUpsertOrderCustomAttributesRequest) require(field *big.Int) { // SetValues sets the Values field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (b *BulkUpsertOrderCustomAttributesRequest) SetValues(values map[string]*v2.BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute) { +func (b *BulkUpsertOrderCustomAttributesRequest) SetValues(values map[string]*v3.BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute) { b.Values = values b.require(bulkUpsertOrderCustomAttributesRequestFieldValues) } @@ -168,7 +168,7 @@ type ListCustomAttributesRequest struct { // The ID of the target [order](entity:Order). OrderID string `json:"-" url:"-"` // Requests that all of the custom attributes be returned, or only those that are read-only or read-write. - VisibilityFilter *v2.VisibilityFilter `json:"-" url:"visibility_filter,omitempty"` + VisibilityFilter *v3.VisibilityFilter `json:"-" url:"visibility_filter,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/working-with-apis/pagination). @@ -203,7 +203,7 @@ func (l *ListCustomAttributesRequest) SetOrderID(orderID string) { // SetVisibilityFilter sets the VisibilityFilter field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (l *ListCustomAttributesRequest) SetVisibilityFilter(visibilityFilter *v2.VisibilityFilter) { +func (l *ListCustomAttributesRequest) SetVisibilityFilter(visibilityFilter *v3.VisibilityFilter) { l.VisibilityFilter = visibilityFilter l.require(listCustomAttributesRequestFieldVisibilityFilter) } @@ -249,7 +249,7 @@ type UpsertOrderCustomAttributeRequest struct { // // - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) // control, include this optional field and specify the current version of the custom attribute. - CustomAttribute *v2.CustomAttribute `json:"custom_attribute,omitempty" url:"-"` + CustomAttribute *v3.CustomAttribute `json:"custom_attribute,omitempty" url:"-"` // A unique identifier for this request, used to ensure idempotency. // For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). IdempotencyKey *string `json:"idempotency_key,omitempty" url:"-"` @@ -281,7 +281,7 @@ func (u *UpsertOrderCustomAttributeRequest) SetCustomAttributeKey(customAttribut // SetCustomAttribute sets the CustomAttribute field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (u *UpsertOrderCustomAttributeRequest) SetCustomAttribute(customAttribute *v2.CustomAttribute) { +func (u *UpsertOrderCustomAttributeRequest) SetCustomAttribute(customAttribute *v3.CustomAttribute) { u.CustomAttribute = customAttribute u.require(upsertOrderCustomAttributeRequestFieldCustomAttribute) } diff --git a/orders/customattributedefinitions/client.go b/orders/customattributedefinitions/client.go index 98dd8e9..1936b30 100644 --- a/orders/customattributedefinitions/client.go +++ b/orders/customattributedefinitions/client.go @@ -4,11 +4,11 @@ package customattributedefinitions import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" - orders "github.com/square/square-go-sdk/v2/orders" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" + orders "github.com/square/square-go-sdk/v3/orders" http "net/http" os "os" ) diff --git a/orders/customattributedefinitions/raw_client.go b/orders/customattributedefinitions/raw_client.go index 9940349..660fe15 100644 --- a/orders/customattributedefinitions/raw_client.go +++ b/orders/customattributedefinitions/raw_client.go @@ -4,11 +4,11 @@ package customattributedefinitions import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" - orders "github.com/square/square-go-sdk/v2/orders" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" + orders "github.com/square/square-go-sdk/v3/orders" http "net/http" ) diff --git a/orders/customattributes/client.go b/orders/customattributes/client.go index 4ea7a8e..910e1a4 100644 --- a/orders/customattributes/client.go +++ b/orders/customattributes/client.go @@ -4,11 +4,11 @@ package customattributes import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" - orders "github.com/square/square-go-sdk/v2/orders" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" + orders "github.com/square/square-go-sdk/v3/orders" http "net/http" os "os" ) diff --git a/orders/customattributes/raw_client.go b/orders/customattributes/raw_client.go index af55788..38d7265 100644 --- a/orders/customattributes/raw_client.go +++ b/orders/customattributes/raw_client.go @@ -4,11 +4,11 @@ package customattributes import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" - orders "github.com/square/square-go-sdk/v2/orders" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" + orders "github.com/square/square-go-sdk/v3/orders" http "net/http" ) diff --git a/orders/error_codes.go b/orders/error_codes.go new file mode 100644 index 0000000..99f15bc --- /dev/null +++ b/orders/error_codes.go @@ -0,0 +1,9 @@ +// Code generated by Fern. DO NOT EDIT. + +package orders + +import ( + internal "github.com/square/square-go-sdk/v3/internal" +) + +var ErrorCodes internal.ErrorCodes = internal.ErrorCodes{} diff --git a/payments.go b/payments.go index c1389f6..1224e15 100644 --- a/payments.go +++ b/payments.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" big "math/big" ) @@ -159,6 +159,8 @@ type CreatePaymentRequest struct { // (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). // + // Tips for external vendors such as a 3rd party delivery courier must be recorded using Order.service_charges. + // // The currency code must match the currency associated with the business // that is accepting the payment. TipMoney *Money `json:"tip_money,omitempty" url:"-"` @@ -1237,6 +1239,7 @@ var ( buyNowPayLaterDetailsFieldBrand = big.NewInt(1 << 0) buyNowPayLaterDetailsFieldAfterpayDetails = big.NewInt(1 << 1) buyNowPayLaterDetailsFieldClearpayDetails = big.NewInt(1 << 2) + buyNowPayLaterDetailsFieldErrors = big.NewInt(1 << 3) ) type BuyNowPayLaterDetails struct { @@ -1249,6 +1252,8 @@ type BuyNowPayLaterDetails struct { // Details about a Clearpay payment. These details are only populated if the `brand` is // `CLEARPAY`. ClearpayDetails *ClearpayDetails `json:"clearpay_details,omitempty" url:"clearpay_details,omitempty"` + // Information about errors encountered during the payment. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -1278,6 +1283,13 @@ func (b *BuyNowPayLaterDetails) GetClearpayDetails() *ClearpayDetails { return b.ClearpayDetails } +func (b *BuyNowPayLaterDetails) GetErrors() []*Error { + if b == nil { + return nil + } + return b.Errors +} + func (b *BuyNowPayLaterDetails) GetExtraProperties() map[string]interface{} { return b.extraProperties } @@ -1310,6 +1322,13 @@ func (b *BuyNowPayLaterDetails) SetClearpayDetails(clearpayDetails *ClearpayDeta b.require(buyNowPayLaterDetailsFieldClearpayDetails) } +// SetErrors sets the Errors field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BuyNowPayLaterDetails) SetErrors(errors []*Error) { + b.Errors = errors + b.require(buyNowPayLaterDetailsFieldErrors) +} + func (b *BuyNowPayLaterDetails) UnmarshalJSON(data []byte) error { type unmarshaler BuyNowPayLaterDetails var value unmarshaler @@ -2700,6 +2719,7 @@ var ( digitalWalletDetailsFieldStatus = big.NewInt(1 << 0) digitalWalletDetailsFieldBrand = big.NewInt(1 << 1) digitalWalletDetailsFieldCashAppDetails = big.NewInt(1 << 2) + digitalWalletDetailsFieldErrors = big.NewInt(1 << 3) ) type DigitalWalletDetails struct { @@ -2707,10 +2727,12 @@ type DigitalWalletDetails struct { // `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`. + // `RAKUTEN_PAY`, `AU_PAY`, `D_BARAI`, `MERPAY`, `WECHAT_PAY`, `LIGHTNING` 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"` + // Information about errors encountered during the payment. + Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -2740,6 +2762,13 @@ func (d *DigitalWalletDetails) GetCashAppDetails() *CashAppDetails { return d.CashAppDetails } +func (d *DigitalWalletDetails) GetErrors() []*Error { + if d == nil { + return nil + } + return d.Errors +} + func (d *DigitalWalletDetails) GetExtraProperties() map[string]interface{} { return d.extraProperties } @@ -2772,6 +2801,13 @@ func (d *DigitalWalletDetails) SetCashAppDetails(cashAppDetails *CashAppDetails) d.require(digitalWalletDetailsFieldCashAppDetails) } +// SetErrors sets the Errors field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DigitalWalletDetails) SetErrors(errors []*Error) { + d.Errors = errors + d.require(digitalWalletDetailsFieldErrors) +} + func (d *DigitalWalletDetails) UnmarshalJSON(data []byte) error { type unmarshaler DigitalWalletDetails var value unmarshaler diff --git a/payments/client.go b/payments/client.go index 6912cfa..8dcfc1c 100644 --- a/payments/client.go +++ b/payments/client.go @@ -4,10 +4,10 @@ package payments import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/payments/raw_client.go b/payments/raw_client.go index 65c01a7..147c3a0 100644 --- a/payments/raw_client.go +++ b/payments/raw_client.go @@ -4,10 +4,10 @@ package payments import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/payouts.go b/payouts.go index c154502..296ce81 100644 --- a/payouts.go +++ b/payouts.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" big "math/big" ) diff --git a/payouts/client.go b/payouts/client.go index ac8e62a..bf32a7c 100644 --- a/payouts/client.go +++ b/payouts/client.go @@ -4,10 +4,10 @@ package payouts import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/payouts/raw_client.go b/payouts/raw_client.go index 4835f7b..6fb434f 100644 --- a/payouts/raw_client.go +++ b/payouts/raw_client.go @@ -4,10 +4,10 @@ package payouts import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/reference.md b/reference.md index 3c1def4..008f09d 100644 --- a/reference.md +++ b/reference.md @@ -1,82 +1,4 @@ # Reference -## Mobile -
client.Mobile.AuthorizationCode(request) -> *square.CreateMobileAuthorizationCodeResponse -
-
- -#### 📝 Description - -
-
- -
-
- -__Note:__ This endpoint is used by the deprecated Reader SDK. -Developers should update their integration to use the [Mobile Payments SDK](https://developer.squareup.com/docs/mobile-payments-sdk), which includes its own authorization methods. - -Generates code to authorize a mobile application to connect to a Square card reader. - -Authorization codes are one-time-use codes and expire 60 minutes after being issued. - -The `Authorization` header you provide to this endpoint must have the following format: - -``` -Authorization: Bearer ACCESS_TOKEN -``` - -Replace `ACCESS_TOKEN` with a -[valid production authorization credential](https://developer.squareup.com/docs/build-basics/access-tokens). -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```go -request := &square.CreateMobileAuthorizationCodeRequest{ - LocationID: square.String( - "YOUR_LOCATION_ID", - ), - } -client.Mobile.AuthorizationCode( - context.TODO(), - request, - ) -} -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**locationID:** `*string` — The Square location ID that the authorization code should be tied to. - -
-
-
-
- - -
-
-
- ## OAuth
client.OAuth.RevokeToken(request) -> *square.RevokeTokenResponse
@@ -402,6 +324,18 @@ provided in your authorization URL. Required for the PKCE flow if `grant_type` is `authorization_code`. + +
+ +
+
+ +**useJwt:** `*bool` + +Indicates whether to use a JWT (JSON Web Token) as the OAuth access token. +When set to `true`, the OAuth flow returns a JWT to your application, used in the +same way as a regular token. The default value is `false`. +
@@ -888,6 +822,9 @@ request := &square.ListBankAccountsRequest{ LocationID: square.String( "location_id", ), + CustomerID: square.String( + "customer_id", + ), } client.BankAccounts.List( context.TODO(), @@ -911,7 +848,7 @@ client.BankAccounts.List( **cursor:** `*string` The pagination cursor returned by a previous call to this endpoint. -Use it in the next `ListBankAccounts` request to retrieve the next set +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. @@ -924,8 +861,8 @@ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagin **limit:** `*int` -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 +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. @@ -936,9 +873,107 @@ of up to 1000 bank accounts. This is also the default limit. **locationID:** `*string` -Location ID. You can specify this optional filter +Location ID. You can specify this optional filter to retrieve only the linked bank accounts belonging to a specific location. + + + +
+
+ +**customerID:** `*string` + +Customer ID. You can specify this optional filter +to retrieve only the linked bank accounts belonging to a specific customer. + +
+
+ + + + + + +
+ +
client.BankAccounts.CreateBankAccount(request) -> *square.CreateBankAccountResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Store a bank account on file for a square account +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +request := &square.CreateBankAccountRequest{ + IdempotencyKey: "4e43559a-f0fd-47d3-9da2-7ea1f97d94be", + SourceID: "bnon:CA4SEHsQwr0rx6DbWLD5BQaqMnoYAQ", + CustomerID: square.String( + "HM3B2D5JKGZ69359BTEHXM2V8M", + ), + } +client.BankAccounts.CreateBankAccount( + context.TODO(), + request, + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**idempotencyKey:** `string` + +Unique ID. For more information, see the +[Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). + +
+
+ +
+
+ +**sourceID:** `string` + +The ID of the source that represents the bank account information to be stored. This field +accepts the payment token created by WebSDK + +
+
+ +
+
+ +**customerID:** `*string` — The ID of the customer associated with the bank account to be stored. +
@@ -1025,8 +1060,7 @@ Connect V1 ID of the desired `BankAccount`. For more information, see
-Returns details of a [BankAccount](entity:BankAccount) -linked to a Square account. +Retrieve details of a [BankAccount](entity:BankAccount) bank account linked to a Square account.
@@ -1071,6 +1105,67 @@ client.BankAccounts.Get(
+ + +
+ +
client.BankAccounts.DisableBankAccount(BankAccountID) -> *square.DisableBankAccountResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Disable a bank account. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +request := &square.DisableBankAccountRequest{ + BankAccountID: "bank_account_id", + } +client.BankAccounts.DisableBankAccount( + context.TODO(), + request, + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**bankAccountID:** `string` — The ID of the bank account to disable. + +
+
+
+
+ +
@@ -11824,6 +11919,8 @@ The amount must be specified in the smallest denomination of the applicable curr (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). +Tips for external vendors such as a 3rd party delivery courier must be recorded using Order.service_charges. + The currency code must match the currency associated with the business that is accepting the payment. @@ -16572,7 +16669,7 @@ request := &square.ReceiveTransferOrderRequest{ Receipt: &square.TransferOrderGoodsReceipt{ LineItems: []*square.TransferOrderGoodsReceiptLineItem{ &square.TransferOrderGoodsReceiptLineItem{ - TransferOrderLineUID: "transfer_order_line_uid", + TransferOrderLineUID: "1", QuantityReceived: square.String( "3", ), @@ -16584,7 +16681,7 @@ request := &square.ReceiveTransferOrderRequest{ ), }, &square.TransferOrderGoodsReceiptLineItem{ - TransferOrderLineUID: "transfer_order_line_uid", + TransferOrderLineUID: "2", QuantityReceived: square.String( "2", ), @@ -17325,6 +17422,35 @@ client.Vendors.Update( + + + + +## Mobile +
client.Mobile.AuthorizationCode() -> error +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +client.Mobile.AuthorizationCode( + context.TODO(), + ) +} +``` +
+
+
+
+ +
diff --git a/refunds.go b/refunds.go index 8d8734d..890cfbe 100644 --- a/refunds.go +++ b/refunds.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" big "math/big" ) diff --git a/refunds/client.go b/refunds/client.go index 1f6b62d..e04daa8 100644 --- a/refunds/client.go +++ b/refunds/client.go @@ -4,10 +4,10 @@ package refunds import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/refunds/raw_client.go b/refunds/raw_client.go index 18cb10d..df98c6f 100644 --- a/refunds/raw_client.go +++ b/refunds/raw_client.go @@ -4,10 +4,10 @@ package refunds import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/sites.go b/sites.go index 0218de5..52070c0 100644 --- a/sites.go +++ b/sites.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" big "math/big" ) diff --git a/sites/client.go b/sites/client.go index b3c29a9..bde0b1f 100644 --- a/sites/client.go +++ b/sites/client.go @@ -4,10 +4,10 @@ package sites import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" os "os" ) diff --git a/sites/raw_client.go b/sites/raw_client.go index 7592548..63fde54 100644 --- a/sites/raw_client.go +++ b/sites/raw_client.go @@ -4,10 +4,10 @@ package sites import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/snippets.go b/snippets.go index 4ef7c3c..9f75b43 100644 --- a/snippets.go +++ b/snippets.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" big "math/big" ) diff --git a/snippets/client.go b/snippets/client.go index 3f50ffd..72c2561 100644 --- a/snippets/client.go +++ b/snippets/client.go @@ -4,10 +4,10 @@ package snippets import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" os "os" ) diff --git a/snippets/raw_client.go b/snippets/raw_client.go index ec3d66c..744b971 100644 --- a/snippets/raw_client.go +++ b/snippets/raw_client.go @@ -4,10 +4,10 @@ package snippets import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/subscriptions.go b/subscriptions.go index cf4d1cf..5c6d925 100644 --- a/subscriptions.go +++ b/subscriptions.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" big "math/big" ) diff --git a/subscriptions/client.go b/subscriptions/client.go index a91cf41..c33a6bb 100644 --- a/subscriptions/client.go +++ b/subscriptions/client.go @@ -4,10 +4,10 @@ package subscriptions import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" os "os" ) diff --git a/subscriptions/raw_client.go b/subscriptions/raw_client.go index b5da33b..addd002 100644 --- a/subscriptions/raw_client.go +++ b/subscriptions/raw_client.go @@ -4,10 +4,10 @@ package subscriptions import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/team.go b/team.go index 47ffb0d..a52a0d2 100644 --- a/team.go +++ b/team.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" big "math/big" ) diff --git a/team/client.go b/team/client.go index 79c8970..26c1878 100644 --- a/team/client.go +++ b/team/client.go @@ -4,10 +4,10 @@ package team import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" os "os" ) diff --git a/team/raw_client.go b/team/raw_client.go index fbe7f1e..60f7a66 100644 --- a/team/raw_client.go +++ b/team/raw_client.go @@ -4,10 +4,10 @@ package team import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/team_members.go b/team_members.go index 7cc77c7..6000af2 100644 --- a/team_members.go +++ b/team_members.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" big "math/big" ) diff --git a/teammembers/client/client.go b/teammembers/client/client.go index bba6577..41fa9b9 100644 --- a/teammembers/client/client.go +++ b/teammembers/client/client.go @@ -4,11 +4,11 @@ package client import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" - wagesetting "github.com/square/square-go-sdk/v2/teammembers/wagesetting" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" + wagesetting "github.com/square/square-go-sdk/v3/teammembers/wagesetting" os "os" ) diff --git a/teammembers/client/raw_client.go b/teammembers/client/raw_client.go index b1a5c7d..98ff6f9 100644 --- a/teammembers/client/raw_client.go +++ b/teammembers/client/raw_client.go @@ -4,10 +4,10 @@ package client import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/teammembers/error_codes.go b/teammembers/error_codes.go new file mode 100644 index 0000000..9949411 --- /dev/null +++ b/teammembers/error_codes.go @@ -0,0 +1,9 @@ +// Code generated by Fern. DO NOT EDIT. + +package teammembers + +import ( + internal "github.com/square/square-go-sdk/v3/internal" +) + +var ErrorCodes internal.ErrorCodes = internal.ErrorCodes{} diff --git a/teammembers/wage_setting.go b/teammembers/wage_setting.go index 83eed44..c39f7ca 100644 --- a/teammembers/wage_setting.go +++ b/teammembers/wage_setting.go @@ -3,7 +3,7 @@ package teammembers import ( - v2 "github.com/square/square-go-sdk/v2" + v3 "github.com/square/square-go-sdk/v3" big "math/big" ) @@ -46,7 +46,7 @@ type UpdateWageSettingRequest struct { // Requires Square API version 2024-12-18 or later. // - `job_title` - Use the exact, case-sensitive spelling of an existing title unless you want to create a new job. // This value is ignored if `job_id` is also provided. - WageSetting *v2.WageSetting `json:"wage_setting,omitempty" url:"-"` + WageSetting *v3.WageSetting `json:"wage_setting,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -68,7 +68,7 @@ func (u *UpdateWageSettingRequest) SetTeamMemberID(teamMemberID string) { // SetWageSetting sets the WageSetting field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (u *UpdateWageSettingRequest) SetWageSetting(wageSetting *v2.WageSetting) { +func (u *UpdateWageSettingRequest) SetWageSetting(wageSetting *v3.WageSetting) { u.WageSetting = wageSetting u.require(updateWageSettingRequestFieldWageSetting) } diff --git a/teammembers/wagesetting/client.go b/teammembers/wagesetting/client.go index c06b644..a2bc128 100644 --- a/teammembers/wagesetting/client.go +++ b/teammembers/wagesetting/client.go @@ -4,11 +4,11 @@ package wagesetting import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" - teammembers "github.com/square/square-go-sdk/v2/teammembers" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" + teammembers "github.com/square/square-go-sdk/v3/teammembers" os "os" ) diff --git a/teammembers/wagesetting/raw_client.go b/teammembers/wagesetting/raw_client.go index ca21555..460b5cf 100644 --- a/teammembers/wagesetting/raw_client.go +++ b/teammembers/wagesetting/raw_client.go @@ -4,11 +4,11 @@ package wagesetting import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" - teammembers "github.com/square/square-go-sdk/v2/teammembers" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" + teammembers "github.com/square/square-go-sdk/v3/teammembers" http "net/http" ) diff --git a/terminal.go b/terminal.go index 472159c..0d4c02c 100644 --- a/terminal.go +++ b/terminal.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" big "math/big" ) diff --git a/terminal/actions.go b/terminal/actions.go index bc1f10f..88eb010 100644 --- a/terminal/actions.go +++ b/terminal/actions.go @@ -3,7 +3,7 @@ package terminal import ( - v2 "github.com/square/square-go-sdk/v2" + v3 "github.com/square/square-go-sdk/v3" big "math/big" ) @@ -46,7 +46,7 @@ type CreateTerminalActionRequest struct { // information. IdempotencyKey string `json:"idempotency_key" url:"-"` // The Action to create. - Action *v2.TerminalAction `json:"action,omitempty" url:"-"` + Action *v3.TerminalAction `json:"action,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -68,7 +68,7 @@ func (c *CreateTerminalActionRequest) SetIdempotencyKey(idempotencyKey string) { // SetAction sets the Action field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *CreateTerminalActionRequest) SetAction(action *v2.TerminalAction) { +func (c *CreateTerminalActionRequest) SetAction(action *v3.TerminalAction) { c.Action = action c.require(createTerminalActionRequestFieldAction) } @@ -108,7 +108,7 @@ var ( type SearchTerminalActionsRequest struct { // Queries terminal actions based on given conditions and sort order. // Leaving this unset will return all actions with the default sort order. - Query *v2.TerminalActionQuery `json:"query,omitempty" url:"-"` + Query *v3.TerminalActionQuery `json:"query,omitempty" url:"-"` // 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 [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more @@ -130,7 +130,7 @@ func (s *SearchTerminalActionsRequest) require(field *big.Int) { // SetQuery sets the Query field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (s *SearchTerminalActionsRequest) SetQuery(query *v2.TerminalActionQuery) { +func (s *SearchTerminalActionsRequest) SetQuery(query *v3.TerminalActionQuery) { s.Query = query s.require(searchTerminalActionsRequestFieldQuery) } diff --git a/terminal/actions/client.go b/terminal/actions/client.go index c4e31d8..df59c5e 100644 --- a/terminal/actions/client.go +++ b/terminal/actions/client.go @@ -4,11 +4,11 @@ package actions import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" - terminal "github.com/square/square-go-sdk/v2/terminal" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" + terminal "github.com/square/square-go-sdk/v3/terminal" os "os" ) diff --git a/terminal/actions/raw_client.go b/terminal/actions/raw_client.go index dc622de..cc04309 100644 --- a/terminal/actions/raw_client.go +++ b/terminal/actions/raw_client.go @@ -4,11 +4,11 @@ package actions import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" - terminal "github.com/square/square-go-sdk/v2/terminal" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" + terminal "github.com/square/square-go-sdk/v3/terminal" http "net/http" ) diff --git a/terminal/checkouts.go b/terminal/checkouts.go index 7083e9b..54ac255 100644 --- a/terminal/checkouts.go +++ b/terminal/checkouts.go @@ -3,7 +3,7 @@ package terminal import ( - v2 "github.com/square/square-go-sdk/v2" + v3 "github.com/square/square-go-sdk/v3" big "math/big" ) @@ -45,7 +45,7 @@ type CreateTerminalCheckoutRequest struct { // See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information. IdempotencyKey string `json:"idempotency_key" url:"-"` // The checkout to create. - Checkout *v2.TerminalCheckout `json:"checkout,omitempty" url:"-"` + Checkout *v3.TerminalCheckout `json:"checkout,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -67,7 +67,7 @@ func (c *CreateTerminalCheckoutRequest) SetIdempotencyKey(idempotencyKey string) // SetCheckout sets the Checkout field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *CreateTerminalCheckoutRequest) SetCheckout(checkout *v2.TerminalCheckout) { +func (c *CreateTerminalCheckoutRequest) SetCheckout(checkout *v3.TerminalCheckout) { c.Checkout = checkout c.require(createTerminalCheckoutRequestFieldCheckout) } @@ -107,7 +107,7 @@ var ( type SearchTerminalCheckoutsRequest struct { // Queries Terminal checkouts based on given conditions and the sort order. // Leaving these unset returns all checkouts with the default sort order. - Query *v2.TerminalCheckoutQuery `json:"query,omitempty" url:"-"` + Query *v3.TerminalCheckoutQuery `json:"query,omitempty" url:"-"` // 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. @@ -128,7 +128,7 @@ func (s *SearchTerminalCheckoutsRequest) require(field *big.Int) { // SetQuery sets the Query field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (s *SearchTerminalCheckoutsRequest) SetQuery(query *v2.TerminalCheckoutQuery) { +func (s *SearchTerminalCheckoutsRequest) SetQuery(query *v3.TerminalCheckoutQuery) { s.Query = query s.require(searchTerminalCheckoutsRequestFieldQuery) } diff --git a/terminal/checkouts/client.go b/terminal/checkouts/client.go index deb3bda..a27c8f9 100644 --- a/terminal/checkouts/client.go +++ b/terminal/checkouts/client.go @@ -4,11 +4,11 @@ package checkouts import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" - terminal "github.com/square/square-go-sdk/v2/terminal" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" + terminal "github.com/square/square-go-sdk/v3/terminal" os "os" ) diff --git a/terminal/checkouts/raw_client.go b/terminal/checkouts/raw_client.go index 71719a7..7f8a44c 100644 --- a/terminal/checkouts/raw_client.go +++ b/terminal/checkouts/raw_client.go @@ -4,11 +4,11 @@ package checkouts import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" - terminal "github.com/square/square-go-sdk/v2/terminal" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" + terminal "github.com/square/square-go-sdk/v3/terminal" http "net/http" ) diff --git a/terminal/client/client.go b/terminal/client/client.go index 6848f94..4dd9975 100644 --- a/terminal/client/client.go +++ b/terminal/client/client.go @@ -4,13 +4,13 @@ package client import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" - actions "github.com/square/square-go-sdk/v2/terminal/actions" - checkouts "github.com/square/square-go-sdk/v2/terminal/checkouts" - refunds "github.com/square/square-go-sdk/v2/terminal/refunds" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" + actions "github.com/square/square-go-sdk/v3/terminal/actions" + checkouts "github.com/square/square-go-sdk/v3/terminal/checkouts" + refunds "github.com/square/square-go-sdk/v3/terminal/refunds" os "os" ) diff --git a/terminal/client/raw_client.go b/terminal/client/raw_client.go index 30950b7..d0c4a7e 100644 --- a/terminal/client/raw_client.go +++ b/terminal/client/raw_client.go @@ -4,10 +4,10 @@ package client import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/terminal/error_codes.go b/terminal/error_codes.go new file mode 100644 index 0000000..ba788b1 --- /dev/null +++ b/terminal/error_codes.go @@ -0,0 +1,9 @@ +// Code generated by Fern. DO NOT EDIT. + +package terminal + +import ( + internal "github.com/square/square-go-sdk/v3/internal" +) + +var ErrorCodes internal.ErrorCodes = internal.ErrorCodes{} diff --git a/terminal/refunds.go b/terminal/refunds.go index 0211a26..46de5b9 100644 --- a/terminal/refunds.go +++ b/terminal/refunds.go @@ -3,7 +3,7 @@ package terminal import ( - v2 "github.com/square/square-go-sdk/v2" + v3 "github.com/square/square-go-sdk/v3" big "math/big" ) @@ -45,7 +45,7 @@ type CreateTerminalRefundRequest struct { // See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information. IdempotencyKey string `json:"idempotency_key" url:"-"` // The refund to create. - Refund *v2.TerminalRefund `json:"refund,omitempty" url:"-"` + Refund *v3.TerminalRefund `json:"refund,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -67,7 +67,7 @@ func (c *CreateTerminalRefundRequest) SetIdempotencyKey(idempotencyKey string) { // SetRefund sets the Refund field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *CreateTerminalRefundRequest) SetRefund(refund *v2.TerminalRefund) { +func (c *CreateTerminalRefundRequest) SetRefund(refund *v3.TerminalRefund) { c.Refund = refund c.require(createTerminalRefundRequestFieldRefund) } @@ -108,7 +108,7 @@ type SearchTerminalRefundsRequest struct { // Queries the Terminal refunds based on given conditions and the sort order. Calling // `SearchTerminalRefunds` without an explicit query parameter returns all available // refunds with the default sort order. - Query *v2.TerminalRefundQuery `json:"query,omitempty" url:"-"` + Query *v3.TerminalRefundQuery `json:"query,omitempty" url:"-"` // 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. Cursor *string `json:"cursor,omitempty" url:"-"` @@ -128,7 +128,7 @@ func (s *SearchTerminalRefundsRequest) require(field *big.Int) { // SetQuery sets the Query field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (s *SearchTerminalRefundsRequest) SetQuery(query *v2.TerminalRefundQuery) { +func (s *SearchTerminalRefundsRequest) SetQuery(query *v3.TerminalRefundQuery) { s.Query = query s.require(searchTerminalRefundsRequestFieldQuery) } diff --git a/terminal/refunds/client.go b/terminal/refunds/client.go index 86dc66b..7f02267 100644 --- a/terminal/refunds/client.go +++ b/terminal/refunds/client.go @@ -4,11 +4,11 @@ package refunds import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" - terminal "github.com/square/square-go-sdk/v2/terminal" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" + terminal "github.com/square/square-go-sdk/v3/terminal" os "os" ) diff --git a/terminal/refunds/raw_client.go b/terminal/refunds/raw_client.go index 30f94b9..33c3757 100644 --- a/terminal/refunds/raw_client.go +++ b/terminal/refunds/raw_client.go @@ -4,11 +4,11 @@ package refunds import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" - terminal "github.com/square/square-go-sdk/v2/terminal" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" + terminal "github.com/square/square-go-sdk/v3/terminal" http "net/http" ) diff --git a/transfer_orders.go b/transfer_orders.go index 063e132..8df1696 100644 --- a/transfer_orders.go +++ b/transfer_orders.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" big "math/big" ) diff --git a/transferorders/client.go b/transferorders/client.go index 04b41ea..c6b3c78 100644 --- a/transferorders/client.go +++ b/transferorders/client.go @@ -4,10 +4,10 @@ package transferorders import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" os "os" ) diff --git a/transferorders/raw_client.go b/transferorders/raw_client.go index 09792c6..fb58f03 100644 --- a/transferorders/raw_client.go +++ b/transferorders/raw_client.go @@ -4,10 +4,10 @@ package transferorders import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/types.go b/types.go index 86fa040..9257ca2 100644 --- a/types.go +++ b/types.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" big "math/big" ) @@ -7775,11 +7775,13 @@ var ( cardFieldCardType = big.NewInt(1 << 12) cardFieldPrepaidType = big.NewInt(1 << 13) cardFieldBin = big.NewInt(1 << 14) - cardFieldVersion = big.NewInt(1 << 15) - cardFieldCardCoBrand = big.NewInt(1 << 16) - cardFieldIssuerAlert = big.NewInt(1 << 17) - cardFieldIssuerAlertAt = big.NewInt(1 << 18) - cardFieldHsaFsa = big.NewInt(1 << 19) + cardFieldCreatedAt = big.NewInt(1 << 15) + cardFieldDisabledAt = big.NewInt(1 << 16) + cardFieldVersion = big.NewInt(1 << 17) + cardFieldCardCoBrand = big.NewInt(1 << 18) + cardFieldIssuerAlert = big.NewInt(1 << 19) + cardFieldIssuerAlertAt = big.NewInt(1 << 20) + cardFieldHsaFsa = big.NewInt(1 << 21) ) type Card struct { @@ -7824,6 +7826,10 @@ type Card struct { // The first six digits of the card number, known as the Bank Identification Number (BIN). Only the Payments API // returns this field. Bin *string `json:"bin,omitempty" url:"bin,omitempty"` + // Timestamp for when the card object was created on Square’s servers. In RFC 3339 format, e.g., "2016-09-04T23:59:33.123Z". + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + // Timestamp for when the card object was disabled on Square’s servers. In RFC 3339 format, e.g., "2016-09-04T23:59:33.123Z". + DisabledAt *string `json:"disabled_at,omitempty" url:"disabled_at,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. @@ -7960,6 +7966,20 @@ func (c *Card) GetBin() *string { return c.Bin } +func (c *Card) GetCreatedAt() *string { + if c == nil { + return nil + } + return c.CreatedAt +} + +func (c *Card) GetDisabledAt() *string { + if c == nil { + return nil + } + return c.DisabledAt +} + func (c *Card) GetVersion() *int64 { if c == nil { return nil @@ -8104,6 +8124,20 @@ func (c *Card) SetBin(bin *string) { c.require(cardFieldBin) } +// SetCreatedAt sets the CreatedAt field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *Card) SetCreatedAt(createdAt *string) { + c.CreatedAt = createdAt + c.require(cardFieldCreatedAt) +} + +// SetDisabledAt sets the DisabledAt field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *Card) SetDisabledAt(disabledAt *string) { + c.DisabledAt = disabledAt + c.require(cardFieldDisabledAt) +} + // SetVersion sets the Version field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. func (c *Card) SetVersion(version *int64) { @@ -13229,25 +13263,27 @@ var ( catalogItemFieldLabelColor = big.NewInt(1 << 3) catalogItemFieldIsTaxable = big.NewInt(1 << 4) catalogItemFieldCategoryID = big.NewInt(1 << 5) - catalogItemFieldTaxIDs = big.NewInt(1 << 6) - catalogItemFieldModifierListInfo = big.NewInt(1 << 7) - catalogItemFieldVariations = big.NewInt(1 << 8) - catalogItemFieldProductType = big.NewInt(1 << 9) - catalogItemFieldSkipModifierScreen = big.NewInt(1 << 10) - catalogItemFieldItemOptions = big.NewInt(1 << 11) - catalogItemFieldEcomURI = big.NewInt(1 << 12) - catalogItemFieldEcomImageURIs = big.NewInt(1 << 13) - catalogItemFieldImageIDs = big.NewInt(1 << 14) - catalogItemFieldSortName = big.NewInt(1 << 15) - catalogItemFieldCategories = big.NewInt(1 << 16) - catalogItemFieldDescriptionHTML = big.NewInt(1 << 17) - catalogItemFieldDescriptionPlaintext = big.NewInt(1 << 18) - catalogItemFieldChannels = big.NewInt(1 << 19) - catalogItemFieldIsArchived = big.NewInt(1 << 20) - catalogItemFieldEcomSeoData = big.NewInt(1 << 21) - catalogItemFieldFoodAndBeverageDetails = big.NewInt(1 << 22) - catalogItemFieldReportingCategory = big.NewInt(1 << 23) - catalogItemFieldIsAlcoholic = big.NewInt(1 << 24) + catalogItemFieldBuyerFacingName = big.NewInt(1 << 6) + catalogItemFieldTaxIDs = big.NewInt(1 << 7) + catalogItemFieldModifierListInfo = big.NewInt(1 << 8) + catalogItemFieldVariations = big.NewInt(1 << 9) + catalogItemFieldProductType = big.NewInt(1 << 10) + catalogItemFieldSkipModifierScreen = big.NewInt(1 << 11) + catalogItemFieldItemOptions = big.NewInt(1 << 12) + catalogItemFieldEcomURI = big.NewInt(1 << 13) + catalogItemFieldEcomImageURIs = big.NewInt(1 << 14) + catalogItemFieldImageIDs = big.NewInt(1 << 15) + catalogItemFieldSortName = big.NewInt(1 << 16) + catalogItemFieldCategories = big.NewInt(1 << 17) + catalogItemFieldDescriptionHTML = big.NewInt(1 << 18) + catalogItemFieldDescriptionPlaintext = big.NewInt(1 << 19) + catalogItemFieldKitchenName = big.NewInt(1 << 20) + catalogItemFieldChannels = big.NewInt(1 << 21) + catalogItemFieldIsArchived = big.NewInt(1 << 22) + catalogItemFieldEcomSeoData = big.NewInt(1 << 23) + catalogItemFieldFoodAndBeverageDetails = big.NewInt(1 << 24) + catalogItemFieldReportingCategory = big.NewInt(1 << 25) + catalogItemFieldIsAlcoholic = big.NewInt(1 << 26) ) type CatalogItem struct { @@ -13270,6 +13306,8 @@ type CatalogItem struct { IsTaxable *bool `json:"is_taxable,omitempty" url:"is_taxable,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"` + // The override to a product name to display to users + BuyerFacingName *string `json:"buyer_facing_name,omitempty" url:"buyer_facing_name,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`. @@ -13343,6 +13381,11 @@ type CatalogItem struct { 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"` + // (Optional) Name that the restaurant wants to display to their kitchen workers + // instead of the customer-facing name. + // e.g., customer name might be "Big John's Mega Burger" and the + // kitchen name is "12oz beef burger" + KitchenName *string `json:"kitchen_name,omitempty" url:"kitchen_name,omitempty"` // A list of IDs representing channels, such as a Square Online site, where the item can be made visible or available. // This field is read only and cannot be edited. Channels []string `json:"channels,omitempty" url:"channels,omitempty"` @@ -13406,6 +13449,13 @@ func (c *CatalogItem) GetCategoryID() *string { return c.CategoryID } +func (c *CatalogItem) GetBuyerFacingName() *string { + if c == nil { + return nil + } + return c.BuyerFacingName +} + func (c *CatalogItem) GetTaxIDs() []string { if c == nil { return nil @@ -13497,6 +13547,13 @@ func (c *CatalogItem) GetDescriptionPlaintext() *string { return c.DescriptionPlaintext } +func (c *CatalogItem) GetKitchenName() *string { + if c == nil { + return nil + } + return c.KitchenName +} + func (c *CatalogItem) GetChannels() []string { if c == nil { return nil @@ -13592,6 +13649,13 @@ func (c *CatalogItem) SetCategoryID(categoryID *string) { c.require(catalogItemFieldCategoryID) } +// SetBuyerFacingName sets the BuyerFacingName field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CatalogItem) SetBuyerFacingName(buyerFacingName *string) { + c.BuyerFacingName = buyerFacingName + c.require(catalogItemFieldBuyerFacingName) +} + // SetTaxIDs sets the TaxIDs field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. func (c *CatalogItem) SetTaxIDs(taxIDs []string) { @@ -13683,6 +13747,13 @@ func (c *CatalogItem) SetDescriptionPlaintext(descriptionPlaintext *string) { c.require(catalogItemFieldDescriptionPlaintext) } +// SetKitchenName sets the KitchenName field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CatalogItem) SetKitchenName(kitchenName *string) { + c.KitchenName = kitchenName + c.require(catalogItemFieldKitchenName) +} + // SetChannels sets the Channels field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. func (c *CatalogItem) SetChannels(channels []string) { @@ -14271,10 +14342,28 @@ type CatalogItemModifierListInfo struct { 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"` - AllowQuantities interface{} `json:"allow_quantities,omitempty" url:"allow_quantities,omitempty"` - IsConversational interface{} `json:"is_conversational,omitempty" url:"is_conversational,omitempty"` - HiddenFromCustomerOverride interface{} `json:"hidden_from_customer_override,omitempty" url:"hidden_from_customer_override,omitempty"` + Ordinal *int `json:"ordinal,omitempty" url:"ordinal,omitempty"` + // Controls whether multiple quantities of the same modifier can be selected for this item. + // - `YES` means that every modifier in the `CatalogModifierList` can have multiple quantities + // selected for this item. + // - `NO` means that each modifier in the `CatalogModifierList` can be selected only once for this item. + // - `NOT_SET` means that the `allow_quantities` setting on the `CatalogModifierList` is obeyed. + // See [CatalogModifierToggleOverrideType](#type-catalogmodifiertoggleoverridetype) for possible values + AllowQuantities *CatalogModifierToggleOverrideType `json:"allow_quantities,omitempty" url:"allow_quantities,omitempty"` + // Controls whether conversational mode is enabled for modifiers on this item. + // + // - `YES` means conversational mode is enabled for every modifier in the `CatalogModifierList`. + // - `NO` means that conversational mode is not enabled for any modifier in the `CatalogModifierList`. + // - `NOT_SET` means that conversational mode is not enabled for any modifier in the `CatalogModifierList`. + // See [CatalogModifierToggleOverrideType](#type-catalogmodifiertoggleoverridetype) for possible values + IsConversational *CatalogModifierToggleOverrideType `json:"is_conversational,omitempty" url:"is_conversational,omitempty"` + // Controls whether all modifiers for this item are hidden from customer receipts. + // - `YES` means that all modifiers in the `CatalogModifierList` are hidden from customer + // receipts for this item. + // - `NO` means that all modifiers in the `CatalogModifierList` are visible on customer receipts for this item. + // - `NOT_SET` means that the `hidden_from_customer` setting on the `CatalogModifierList` is obeyed. + // See [CatalogModifierToggleOverrideType](#type-catalogmodifiertoggleoverridetype) for possible values + HiddenFromCustomerOverride *CatalogModifierToggleOverrideType `json:"hidden_from_customer_override,omitempty" url:"hidden_from_customer_override,omitempty"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -14325,21 +14414,21 @@ func (c *CatalogItemModifierListInfo) GetOrdinal() *int { return c.Ordinal } -func (c *CatalogItemModifierListInfo) GetAllowQuantities() interface{} { +func (c *CatalogItemModifierListInfo) GetAllowQuantities() *CatalogModifierToggleOverrideType { if c == nil { return nil } return c.AllowQuantities } -func (c *CatalogItemModifierListInfo) GetIsConversational() interface{} { +func (c *CatalogItemModifierListInfo) GetIsConversational() *CatalogModifierToggleOverrideType { if c == nil { return nil } return c.IsConversational } -func (c *CatalogItemModifierListInfo) GetHiddenFromCustomerOverride() interface{} { +func (c *CatalogItemModifierListInfo) GetHiddenFromCustomerOverride() *CatalogModifierToggleOverrideType { if c == nil { return nil } @@ -14401,21 +14490,21 @@ func (c *CatalogItemModifierListInfo) SetOrdinal(ordinal *int) { // SetAllowQuantities sets the AllowQuantities field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *CatalogItemModifierListInfo) SetAllowQuantities(allowQuantities interface{}) { +func (c *CatalogItemModifierListInfo) SetAllowQuantities(allowQuantities *CatalogModifierToggleOverrideType) { c.AllowQuantities = allowQuantities c.require(catalogItemModifierListInfoFieldAllowQuantities) } // SetIsConversational sets the IsConversational field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *CatalogItemModifierListInfo) SetIsConversational(isConversational interface{}) { +func (c *CatalogItemModifierListInfo) SetIsConversational(isConversational *CatalogModifierToggleOverrideType) { c.IsConversational = isConversational c.require(catalogItemModifierListInfoFieldIsConversational) } // SetHiddenFromCustomerOverride sets the HiddenFromCustomerOverride field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *CatalogItemModifierListInfo) SetHiddenFromCustomerOverride(hiddenFromCustomerOverride interface{}) { +func (c *CatalogItemModifierListInfo) SetHiddenFromCustomerOverride(hiddenFromCustomerOverride *CatalogModifierToggleOverrideType) { c.HiddenFromCustomerOverride = hiddenFromCustomerOverride c.require(catalogItemModifierListInfoFieldHiddenFromCustomerOverride) } @@ -15022,6 +15111,7 @@ var ( catalogItemVariationFieldImageIDs = big.NewInt(1 << 18) catalogItemVariationFieldTeamMemberIDs = big.NewInt(1 << 19) catalogItemVariationFieldStockableConversion = big.NewInt(1 << 20) + catalogItemVariationFieldKitchenName = big.NewInt(1 << 21) ) type CatalogItemVariation struct { @@ -15102,6 +15192,11 @@ type CatalogItemVariation struct { // 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"` + // (Optional) Name that the restaurant wants to display to their kitchen workers + // instead of the customer-facing name. + // e.g., customer name might be "Mega-Jumbo Triplesized" and the + // kitchen name is "Large container" + KitchenName *string `json:"kitchen_name,omitempty" url:"kitchen_name,omitempty"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -15257,6 +15352,13 @@ func (c *CatalogItemVariation) GetStockableConversion() *CatalogStockConversion return c.StockableConversion } +func (c *CatalogItemVariation) GetKitchenName() *string { + if c == nil { + return nil + } + return c.KitchenName +} + func (c *CatalogItemVariation) GetExtraProperties() map[string]interface{} { return c.extraProperties } @@ -15415,6 +15517,13 @@ func (c *CatalogItemVariation) SetStockableConversion(stockableConversion *Catal c.require(catalogItemVariationFieldStockableConversion) } +// SetKitchenName sets the KitchenName field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CatalogItemVariation) SetKitchenName(kitchenName *string) { + c.KitchenName = kitchenName + c.require(catalogItemVariationFieldKitchenName) +} + func (c *CatalogItemVariation) UnmarshalJSON(data []byte) error { type unmarshaler CatalogItemVariation var value unmarshaler @@ -15568,8 +15677,9 @@ var ( catalogModifierFieldOrdinal = big.NewInt(1 << 3) catalogModifierFieldModifierListID = big.NewInt(1 << 4) catalogModifierFieldLocationOverrides = big.NewInt(1 << 5) - catalogModifierFieldImageID = big.NewInt(1 << 6) - catalogModifierFieldHiddenOnline = big.NewInt(1 << 7) + catalogModifierFieldKitchenName = big.NewInt(1 << 6) + catalogModifierFieldImageID = big.NewInt(1 << 7) + catalogModifierFieldHiddenOnline = big.NewInt(1 << 8) ) type CatalogModifier struct { @@ -15586,6 +15696,11 @@ type CatalogModifier struct { 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"` + // (Optional) Name that the restaurant wants to display to their kitchen workers + // instead of the customer-facing name. + // e.g., customer name might be "Double Baconize" and the + // kitchen name is "Add 2x bacon" + KitchenName *string `json:"kitchen_name,omitempty" url:"kitchen_name,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"` @@ -15641,6 +15756,13 @@ func (c *CatalogModifier) GetLocationOverrides() []*ModifierLocationOverrides { return c.LocationOverrides } +func (c *CatalogModifier) GetKitchenName() *string { + if c == nil { + return nil + } + return c.KitchenName +} + func (c *CatalogModifier) GetImageID() *string { if c == nil { return nil @@ -15708,6 +15830,13 @@ func (c *CatalogModifier) SetLocationOverrides(locationOverrides []*ModifierLoca c.require(catalogModifierFieldLocationOverrides) } +// SetKitchenName sets the KitchenName field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CatalogModifier) SetKitchenName(kitchenName *string) { + c.KitchenName = kitchenName + c.require(catalogModifierFieldKitchenName) +} + // SetImageID sets the ImageID field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. func (c *CatalogModifier) SetImageID(imageID *string) { @@ -16165,9 +16294,20 @@ type CatalogModifierOverride struct { // The ID of the `CatalogModifier` whose default behavior is being overridden. ModifierID string `json:"modifier_id" url:"modifier_id"` // __Deprecated__: Use `on_by_default_override` instead. - OnByDefault *bool `json:"on_by_default,omitempty" url:"on_by_default,omitempty"` - HiddenOnlineOverride interface{} `json:"hidden_online_override,omitempty" url:"hidden_online_override,omitempty"` - OnByDefaultOverride interface{} `json:"on_by_default_override,omitempty" url:"on_by_default_override,omitempty"` + OnByDefault *bool `json:"on_by_default,omitempty" url:"on_by_default,omitempty"` + // If `YES`, this setting overrides the `hidden_online` setting on the `CatalogModifier` object, + // and the modifier is always hidden from online sales channels. + // If `NO`, the modifier is not hidden. It is always visible in online sales channels for this catalog item. + // `NOT_SET` means the `hidden_online` setting on the `CatalogModifier` object is obeyed. + // See [CatalogModifierToggleOverrideType](#type-catalogmodifiertoggleoverridetype) for possible values + HiddenOnlineOverride *CatalogModifierToggleOverrideType `json:"hidden_online_override,omitempty" url:"hidden_online_override,omitempty"` + // If `YES`, this setting overrides the `on_by_default` setting on the `CatalogModifier` object, + // and the modifier is always selected by default for the catalog item. + // + // If `NO`, the modifier is not selected by default for this catalog item. + // `NOT_SET` means the `on_by_default` setting on the `CatalogModifier` object is obeyed. + // See [CatalogModifierToggleOverrideType](#type-catalogmodifiertoggleoverridetype) for possible values + OnByDefaultOverride *CatalogModifierToggleOverrideType `json:"on_by_default_override,omitempty" url:"on_by_default_override,omitempty"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -16190,14 +16330,14 @@ func (c *CatalogModifierOverride) GetOnByDefault() *bool { return c.OnByDefault } -func (c *CatalogModifierOverride) GetHiddenOnlineOverride() interface{} { +func (c *CatalogModifierOverride) GetHiddenOnlineOverride() *CatalogModifierToggleOverrideType { if c == nil { return nil } return c.HiddenOnlineOverride } -func (c *CatalogModifierOverride) GetOnByDefaultOverride() interface{} { +func (c *CatalogModifierOverride) GetOnByDefaultOverride() *CatalogModifierToggleOverrideType { if c == nil { return nil } @@ -16231,14 +16371,14 @@ func (c *CatalogModifierOverride) SetOnByDefault(onByDefault *bool) { // SetHiddenOnlineOverride sets the HiddenOnlineOverride field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *CatalogModifierOverride) SetHiddenOnlineOverride(hiddenOnlineOverride interface{}) { +func (c *CatalogModifierOverride) SetHiddenOnlineOverride(hiddenOnlineOverride *CatalogModifierToggleOverrideType) { c.HiddenOnlineOverride = hiddenOnlineOverride c.require(catalogModifierOverrideFieldHiddenOnlineOverride) } // SetOnByDefaultOverride sets the OnByDefaultOverride field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *CatalogModifierOverride) SetOnByDefaultOverride(onByDefaultOverride interface{}) { +func (c *CatalogModifierOverride) SetOnByDefaultOverride(onByDefaultOverride *CatalogModifierToggleOverrideType) { c.OnByDefaultOverride = onByDefaultOverride c.require(catalogModifierOverrideFieldOnByDefaultOverride) } @@ -16282,6 +16422,32 @@ func (c *CatalogModifierOverride) String() string { return fmt.Sprintf("%#v", c) } +// Item level overrides for bool attributes +type CatalogModifierToggleOverrideType string + +const ( + CatalogModifierToggleOverrideTypeNo CatalogModifierToggleOverrideType = "NO" + CatalogModifierToggleOverrideTypeYes CatalogModifierToggleOverrideType = "YES" + CatalogModifierToggleOverrideTypeNotSet CatalogModifierToggleOverrideType = "NOT_SET" +) + +func NewCatalogModifierToggleOverrideTypeFromString(s string) (CatalogModifierToggleOverrideType, error) { + switch s { + case "NO": + return CatalogModifierToggleOverrideTypeNo, nil + case "YES": + return CatalogModifierToggleOverrideTypeYes, nil + case "NOT_SET": + return CatalogModifierToggleOverrideTypeNotSet, nil + } + var t CatalogModifierToggleOverrideType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c CatalogModifierToggleOverrideType) Ptr() *CatalogModifierToggleOverrideType { + return &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. @@ -22943,14 +23109,14 @@ type CatalogProductSet struct { // // Only one of `product_ids_all`, `product_ids_any`, or `all_products` can be set. // - // Max: 500 catalog object IDs. + // Max: 5000 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. + // Max: 5000 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. @@ -36483,11 +36649,12 @@ func (d *DeleteWebhookSubscriptionResponse) String() string { } var ( - deviceCheckoutOptionsFieldDeviceID = big.NewInt(1 << 0) - deviceCheckoutOptionsFieldSkipReceiptScreen = big.NewInt(1 << 1) - deviceCheckoutOptionsFieldCollectSignature = big.NewInt(1 << 2) - deviceCheckoutOptionsFieldTipSettings = big.NewInt(1 << 3) - deviceCheckoutOptionsFieldShowItemizedCart = big.NewInt(1 << 4) + deviceCheckoutOptionsFieldDeviceID = big.NewInt(1 << 0) + deviceCheckoutOptionsFieldSkipReceiptScreen = big.NewInt(1 << 1) + deviceCheckoutOptionsFieldCollectSignature = big.NewInt(1 << 2) + deviceCheckoutOptionsFieldTipSettings = big.NewInt(1 << 3) + deviceCheckoutOptionsFieldShowItemizedCart = big.NewInt(1 << 4) + deviceCheckoutOptionsFieldAllowAutoCardSurcharge = big.NewInt(1 << 5) ) type DeviceCheckoutOptions struct { @@ -36504,6 +36671,11 @@ type DeviceCheckoutOptions struct { // 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"` + // Controls whether the mobile client applies Auto Card Surcharge (ACS) during checkout. + // If true, ACS is applied based on Dashboard configuration. + // If false, ACS is not applied regardless of that configuration. + // For more information, see [Add a Card Surcharge](https://developer.squareupstaging.com/docs/terminal-api/additional-payment-checkout-features#add-a-card-surcharge). + AllowAutoCardSurcharge *bool `json:"allow_auto_card_surcharge,omitempty" url:"allow_auto_card_surcharge,omitempty"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -36547,6 +36719,13 @@ func (d *DeviceCheckoutOptions) GetShowItemizedCart() *bool { return d.ShowItemizedCart } +func (d *DeviceCheckoutOptions) GetAllowAutoCardSurcharge() *bool { + if d == nil { + return nil + } + return d.AllowAutoCardSurcharge +} + func (d *DeviceCheckoutOptions) GetExtraProperties() map[string]interface{} { return d.extraProperties } @@ -36593,6 +36772,13 @@ func (d *DeviceCheckoutOptions) SetShowItemizedCart(showItemizedCart *bool) { d.require(deviceCheckoutOptionsFieldShowItemizedCart) } +// SetAllowAutoCardSurcharge sets the AllowAutoCardSurcharge field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DeviceCheckoutOptions) SetAllowAutoCardSurcharge(allowAutoCardSurcharge *bool) { + d.AllowAutoCardSurcharge = allowAutoCardSurcharge + d.require(deviceCheckoutOptionsFieldAllowAutoCardSurcharge) +} + func (d *DeviceCheckoutOptions) UnmarshalJSON(data []byte) error { type unmarshaler DeviceCheckoutOptions var value unmarshaler @@ -41181,6 +41367,7 @@ const ( ErrorCodeUnsupportedLoyaltyRewardTier ErrorCode = "UNSUPPORTED_LOYALTY_REWARD_TIER" ErrorCodeLocationMismatch ErrorCode = "LOCATION_MISMATCH" ErrorCodeOrderUnpaidNotReturnable ErrorCode = "ORDER_UNPAID_NOT_RETURNABLE" + ErrorCodePartialPaymentDelayCaptureNotSupported ErrorCode = "PARTIAL_PAYMENT_DELAY_CAPTURE_NOT_SUPPORTED" ErrorCodeIdempotencyKeyReused ErrorCode = "IDEMPOTENCY_KEY_REUSED" ErrorCodeUnexpectedValue ErrorCode = "UNEXPECTED_VALUE" ErrorCodeSandboxNotSupported ErrorCode = "SANDBOX_NOT_SUPPORTED" @@ -41196,6 +41383,7 @@ const ( ErrorCodePlaidError ErrorCode = "PLAID_ERROR" ErrorCodePlaidErrorItemLoginRequired ErrorCode = "PLAID_ERROR_ITEM_LOGIN_REQUIRED" ErrorCodePlaidErrorRateLimit ErrorCode = "PLAID_ERROR_RATE_LIMIT" + ErrorCodePaymentSourceNotEnabledForTarget ErrorCode = "PAYMENT_SOURCE_NOT_ENABLED_FOR_TARGET" ErrorCodeCardDeclined ErrorCode = "CARD_DECLINED" ErrorCodeVerifyCvvFailure ErrorCode = "VERIFY_CVV_FAILURE" ErrorCodeVerifyAvsFailure ErrorCode = "VERIFY_AVS_FAILURE" @@ -41450,6 +41638,8 @@ func NewErrorCodeFromString(s string) (ErrorCode, error) { return ErrorCodeLocationMismatch, nil case "ORDER_UNPAID_NOT_RETURNABLE": return ErrorCodeOrderUnpaidNotReturnable, nil + case "PARTIAL_PAYMENT_DELAY_CAPTURE_NOT_SUPPORTED": + return ErrorCodePartialPaymentDelayCaptureNotSupported, nil case "IDEMPOTENCY_KEY_REUSED": return ErrorCodeIdempotencyKeyReused, nil case "UNEXPECTED_VALUE": @@ -41480,6 +41670,8 @@ func NewErrorCodeFromString(s string) (ErrorCode, error) { return ErrorCodePlaidErrorItemLoginRequired, nil case "PLAID_ERROR_RATE_LIMIT": return ErrorCodePlaidErrorRateLimit, nil + case "PAYMENT_SOURCE_NOT_ENABLED_FOR_TARGET": + return ErrorCodePaymentSourceNotEnabledForTarget, nil case "CARD_DECLINED": return ErrorCodeCardDeclined, nil case "VERIFY_CVV_FAILURE": @@ -42088,7 +42280,7 @@ 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`. + // `deliver_at` 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) @@ -42099,24 +42291,29 @@ type FulfillmentDeliveryDetails struct { 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 + // 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"). + // + // For fulfillments with the schedule type `ASAP`, this is automatically set + // to the current time plus `prep_time_duration`, if available. 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"). + // The [duration](https://developer.squareup.com/docs/build-basics/working-with-dates) + // needed to prepare and deliver this fulfillment. + // The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse + // "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes. PrepTimeDuration *string `json:"prep_time_duration,omitempty" url:"prep_time_duration,omitempty"` - // The time period after `deliver_at` in which to deliver the order. + // The [duration](https://developer.squareup.com/docs/build-basics/working-with-dates) + // 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"). + // The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse + // "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes. 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. @@ -42158,8 +42355,10 @@ type FulfillmentDeliveryDetails struct { // 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"). + // The [duration](https://developer.squareup.com/docs/build-basics/working-with-dates) + // after `courier_pickup_at` in which the courier should pick up the order. + // The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse + // "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes. 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"` @@ -42789,8 +42988,9 @@ type FulfillmentPickupDetails struct { // 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"). + // The [duration](https://developer.squareup.com/docs/build-basics/working-with-dates) + // after which an in-progress pickup fulfillment is automatically moved + // to the `COMPLETED` state. The duration must be in RFC 3339 format (for example, "PT4H" for 4 hours). // // 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"` @@ -42802,14 +43002,19 @@ type FulfillmentPickupDetails struct { // "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. + // to the current time plus `prep_time_duration`, if available. 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. + // The [duration](https://developer.squareup.com/docs/build-basics/working-with-dates) + // in which the order should be picked up after the `pickup_at` timestamp. + // The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse + // "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes. + // + // 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"). + // The [duration](https://developer.squareup.com/docs/build-basics/working-with-dates) + // needed to prepare this fulfillment. + // The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse + // "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes. 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. @@ -74416,6 +74621,30 @@ func (o *Order) String() string { return fmt.Sprintf("%#v", o) } +// Indicates whether the card surcharge will be treated as a value-holding line item or +// apportioned across all line items. +type OrderCardSurchargeTreatmentType string + +const ( + OrderCardSurchargeTreatmentTypeLineItemTreatment OrderCardSurchargeTreatmentType = "LINE_ITEM_TREATMENT" + OrderCardSurchargeTreatmentTypeApportionedTreatment OrderCardSurchargeTreatmentType = "APPORTIONED_TREATMENT" +) + +func NewOrderCardSurchargeTreatmentTypeFromString(s string) (OrderCardSurchargeTreatmentType, error) { + switch s { + case "LINE_ITEM_TREATMENT": + return OrderCardSurchargeTreatmentTypeLineItemTreatment, nil + case "APPORTIONED_TREATMENT": + return OrderCardSurchargeTreatmentTypeApportionedTreatment, nil + } + var t OrderCardSurchargeTreatmentType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (o OrderCardSurchargeTreatmentType) Ptr() *OrderCardSurchargeTreatmentType { + return &o +} + var ( orderCreatedFieldOrderID = big.NewInt(1 << 0) orderCreatedFieldVersion = big.NewInt(1 << 1) @@ -77275,11 +77504,13 @@ type OrderLineItem struct { // // 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. + // The base price for a single unit of the line item. Note - If inclusive tax is set on + // this item it will be included in this value. 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. + // It does not include modifiers. Note - If inclusive tax is set on + // this item it will be included in this value. 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. @@ -77914,6 +78145,7 @@ var ( orderLineItemAppliedTaxFieldUID = big.NewInt(1 << 0) orderLineItemAppliedTaxFieldTaxUID = big.NewInt(1 << 1) orderLineItemAppliedTaxFieldAppliedMoney = big.NewInt(1 << 2) + orderLineItemAppliedTaxFieldAutoApplied = big.NewInt(1 << 3) ) type OrderLineItemAppliedTax struct { @@ -77927,6 +78159,10 @@ type OrderLineItemAppliedTax struct { 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"` + // Indicates 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"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -77956,6 +78192,13 @@ func (o *OrderLineItemAppliedTax) GetAppliedMoney() *Money { return o.AppliedMoney } +func (o *OrderLineItemAppliedTax) GetAutoApplied() *bool { + if o == nil { + return nil + } + return o.AutoApplied +} + func (o *OrderLineItemAppliedTax) GetExtraProperties() map[string]interface{} { return o.extraProperties } @@ -77988,6 +78231,13 @@ func (o *OrderLineItemAppliedTax) SetAppliedMoney(appliedMoney *Money) { o.require(orderLineItemAppliedTaxFieldAppliedMoney) } +// SetAutoApplied sets the AutoApplied field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (o *OrderLineItemAppliedTax) SetAutoApplied(autoApplied *bool) { + o.AutoApplied = autoApplied + o.require(orderLineItemAppliedTaxFieldAutoApplied) +} + func (o *OrderLineItemAppliedTax) UnmarshalJSON(data []byte) error { type unmarshaler OrderLineItemAppliedTax var value unmarshaler @@ -78659,8 +78909,9 @@ func (o *OrderLineItemModifier) String() string { // application to a line item. For more information, see // [Apply Taxes and Discounts](https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts). var ( - orderLineItemPricingBlocklistsFieldBlockedDiscounts = big.NewInt(1 << 0) - orderLineItemPricingBlocklistsFieldBlockedTaxes = big.NewInt(1 << 1) + orderLineItemPricingBlocklistsFieldBlockedDiscounts = big.NewInt(1 << 0) + orderLineItemPricingBlocklistsFieldBlockedTaxes = big.NewInt(1 << 1) + orderLineItemPricingBlocklistsFieldBlockedServiceCharges = big.NewInt(1 << 2) ) type OrderLineItemPricingBlocklists struct { @@ -78672,6 +78923,11 @@ type OrderLineItemPricingBlocklists struct { // 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"` + // A list of service charges blocked from applying to the line item. + // Service charges can be blocked by the `service_charge_uid` (for ad hoc + // service charges) or the `service_charge_catalog_object_id` (for catalog + // service charges). + BlockedServiceCharges []*OrderLineItemPricingBlocklistsBlockedServiceCharge `json:"blocked_service_charges,omitempty" url:"blocked_service_charges,omitempty"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -78694,6 +78950,13 @@ func (o *OrderLineItemPricingBlocklists) GetBlockedTaxes() []*OrderLineItemPrici return o.BlockedTaxes } +func (o *OrderLineItemPricingBlocklists) GetBlockedServiceCharges() []*OrderLineItemPricingBlocklistsBlockedServiceCharge { + if o == nil { + return nil + } + return o.BlockedServiceCharges +} + func (o *OrderLineItemPricingBlocklists) GetExtraProperties() map[string]interface{} { return o.extraProperties } @@ -78719,6 +78982,13 @@ func (o *OrderLineItemPricingBlocklists) SetBlockedTaxes(blockedTaxes []*OrderLi o.require(orderLineItemPricingBlocklistsFieldBlockedTaxes) } +// SetBlockedServiceCharges sets the BlockedServiceCharges field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (o *OrderLineItemPricingBlocklists) SetBlockedServiceCharges(blockedServiceCharges []*OrderLineItemPricingBlocklistsBlockedServiceCharge) { + o.BlockedServiceCharges = blockedServiceCharges + o.require(orderLineItemPricingBlocklistsFieldBlockedServiceCharges) +} + func (o *OrderLineItemPricingBlocklists) UnmarshalJSON(data []byte) error { type unmarshaler OrderLineItemPricingBlocklists var value unmarshaler @@ -78876,6 +79146,126 @@ func (o *OrderLineItemPricingBlocklistsBlockedDiscount) String() string { return fmt.Sprintf("%#v", o) } +// A service charge to block from applying to a line item. The service charge +// must be identified by either `service_charge_uid` or +// `service_charge_catalog_object_id`, but not both. +var ( + orderLineItemPricingBlocklistsBlockedServiceChargeFieldUID = big.NewInt(1 << 0) + orderLineItemPricingBlocklistsBlockedServiceChargeFieldServiceChargeUID = big.NewInt(1 << 1) + orderLineItemPricingBlocklistsBlockedServiceChargeFieldServiceChargeCatalogObjectID = big.NewInt(1 << 2) +) + +type OrderLineItemPricingBlocklistsBlockedServiceCharge struct { + // A unique ID of the `BlockedServiceCharge` within the order. + UID *string `json:"uid,omitempty" url:"uid,omitempty"` + // The `uid` of the service charge that should be blocked. Use this field to + // block ad hoc service charges. For catalog service charges, use the + // `service_charge_catalog_object_id` field. + ServiceChargeUID *string `json:"service_charge_uid,omitempty" url:"service_charge_uid,omitempty"` + // The `catalog_object_id` of the service charge that should be blocked. + // Use this field to block catalog service charges. For ad hoc service charges, + // use the `service_charge_uid` field. + ServiceChargeCatalogObjectID *string `json:"service_charge_catalog_object_id,omitempty" url:"service_charge_catalog_object_id,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (o *OrderLineItemPricingBlocklistsBlockedServiceCharge) GetUID() *string { + if o == nil { + return nil + } + return o.UID +} + +func (o *OrderLineItemPricingBlocklistsBlockedServiceCharge) GetServiceChargeUID() *string { + if o == nil { + return nil + } + return o.ServiceChargeUID +} + +func (o *OrderLineItemPricingBlocklistsBlockedServiceCharge) GetServiceChargeCatalogObjectID() *string { + if o == nil { + return nil + } + return o.ServiceChargeCatalogObjectID +} + +func (o *OrderLineItemPricingBlocklistsBlockedServiceCharge) GetExtraProperties() map[string]interface{} { + return o.extraProperties +} + +func (o *OrderLineItemPricingBlocklistsBlockedServiceCharge) require(field *big.Int) { + if o.explicitFields == nil { + o.explicitFields = big.NewInt(0) + } + o.explicitFields.Or(o.explicitFields, field) +} + +// SetUID sets the UID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (o *OrderLineItemPricingBlocklistsBlockedServiceCharge) SetUID(uid *string) { + o.UID = uid + o.require(orderLineItemPricingBlocklistsBlockedServiceChargeFieldUID) +} + +// SetServiceChargeUID sets the ServiceChargeUID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (o *OrderLineItemPricingBlocklistsBlockedServiceCharge) SetServiceChargeUID(serviceChargeUID *string) { + o.ServiceChargeUID = serviceChargeUID + o.require(orderLineItemPricingBlocklistsBlockedServiceChargeFieldServiceChargeUID) +} + +// SetServiceChargeCatalogObjectID sets the ServiceChargeCatalogObjectID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (o *OrderLineItemPricingBlocklistsBlockedServiceCharge) SetServiceChargeCatalogObjectID(serviceChargeCatalogObjectID *string) { + o.ServiceChargeCatalogObjectID = serviceChargeCatalogObjectID + o.require(orderLineItemPricingBlocklistsBlockedServiceChargeFieldServiceChargeCatalogObjectID) +} + +func (o *OrderLineItemPricingBlocklistsBlockedServiceCharge) UnmarshalJSON(data []byte) error { + type unmarshaler OrderLineItemPricingBlocklistsBlockedServiceCharge + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *o = OrderLineItemPricingBlocklistsBlockedServiceCharge(value) + extraProperties, err := internal.ExtractExtraProperties(data, *o) + if err != nil { + return err + } + o.extraProperties = extraProperties + o.rawJSON = json.RawMessage(data) + return nil +} + +func (o *OrderLineItemPricingBlocklistsBlockedServiceCharge) MarshalJSON() ([]byte, error) { + type embed OrderLineItemPricingBlocklistsBlockedServiceCharge + var marshaler = struct { + embed + }{ + embed: embed(*o), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, o.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (o *OrderLineItemPricingBlocklistsBlockedServiceCharge) String() string { + if len(o.rawJSON) > 0 { + if value, err := internal.StringifyJSON(o.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(o); err == nil { + return value + } + return fmt.Sprintf("%#v", o) +} + // 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. var ( @@ -80847,6 +81237,7 @@ var ( orderReturnServiceChargeFieldAppliedTaxes = big.NewInt(1 << 12) orderReturnServiceChargeFieldTreatmentType = big.NewInt(1 << 13) orderReturnServiceChargeFieldScope = big.NewInt(1 << 14) + orderReturnServiceChargeFieldType = big.NewInt(1 << 15) ) type OrderReturnServiceCharge struct { @@ -80898,7 +81289,7 @@ type OrderReturnServiceCharge struct { // 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. + // Indicates whether the service charge will be treated as a value-holding line item or apportioned toward a line item. // 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` @@ -80911,6 +81302,9 @@ type OrderReturnServiceCharge struct { // 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"` + // The type of the service charge. + // See [OrderServiceChargeType](#type-orderservicechargetype) for possible values + Type *OrderServiceChargeType `json:"type,omitempty" url:"type,omitempty"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -81024,6 +81418,13 @@ func (o *OrderReturnServiceCharge) GetScope() *OrderServiceChargeScope { return o.Scope } +func (o *OrderReturnServiceCharge) GetType() *OrderServiceChargeType { + if o == nil { + return nil + } + return o.Type +} + func (o *OrderReturnServiceCharge) GetExtraProperties() map[string]interface{} { return o.extraProperties } @@ -81140,6 +81541,13 @@ func (o *OrderReturnServiceCharge) SetScope(scope *OrderServiceChargeScope) { o.require(orderReturnServiceChargeFieldScope) } +// SetType sets the Type field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (o *OrderReturnServiceCharge) SetType(type_ *OrderServiceChargeType) { + o.Type = type_ + o.require(orderReturnServiceChargeFieldType) +} + func (o *OrderReturnServiceCharge) UnmarshalJSON(data []byte) error { type unmarshaler OrderReturnServiceCharge var value unmarshaler @@ -81773,7 +82181,7 @@ var ( 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. + // The name of the service charge. This is unused and null for AUTO_GRATUITY to match the behavior on Bills. 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"` @@ -81846,7 +82254,7 @@ type OrderServiceCharge struct { // 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. + // Indicates whether the service charge will be treated as a value-holding line item or apportioned toward a line item. // 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` @@ -91152,29 +91560,34 @@ func (s SubscriptionPricingType) Ptr() *SubscriptionPricingType { return &s } -// Represents the details of a webhook subscription, including notification URL, -// event types, and signature key. +// Represents the result of testing a webhook subscription. Note: The actual API returns these fields at the root level of TestWebhookSubscriptionResponse, not nested under this object. var ( - subscriptionTestResultFieldID = big.NewInt(1 << 0) - subscriptionTestResultFieldStatusCode = big.NewInt(1 << 1) - subscriptionTestResultFieldPayload = big.NewInt(1 << 2) - subscriptionTestResultFieldCreatedAt = big.NewInt(1 << 3) - subscriptionTestResultFieldUpdatedAt = big.NewInt(1 << 4) + subscriptionTestResultFieldID = big.NewInt(1 << 0) + subscriptionTestResultFieldStatusCode = big.NewInt(1 << 1) + subscriptionTestResultFieldPayload = big.NewInt(1 << 2) + subscriptionTestResultFieldCreatedAt = big.NewInt(1 << 3) + subscriptionTestResultFieldUpdatedAt = big.NewInt(1 << 4) + subscriptionTestResultFieldNotificationURL = big.NewInt(1 << 5) + subscriptionTestResultFieldPassesFilter = big.NewInt(1 << 6) ) 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. + // The HTTP status code returned by the 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 payload that was sent in the test notification. + Payload map[string]interface{} `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"` + // The URL that was used for the webhook notification test. + NotificationURL *string `json:"notification_url,omitempty" url:"notification_url,omitempty"` + // Whether the notification passed any configured filters. + PassesFilter *bool `json:"passes_filter,omitempty" url:"passes_filter,omitempty"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -91197,7 +91610,7 @@ func (s *SubscriptionTestResult) GetStatusCode() *int { return s.StatusCode } -func (s *SubscriptionTestResult) GetPayload() *string { +func (s *SubscriptionTestResult) GetPayload() map[string]interface{} { if s == nil { return nil } @@ -91218,6 +91631,20 @@ func (s *SubscriptionTestResult) GetUpdatedAt() *string { return s.UpdatedAt } +func (s *SubscriptionTestResult) GetNotificationURL() *string { + if s == nil { + return nil + } + return s.NotificationURL +} + +func (s *SubscriptionTestResult) GetPassesFilter() *bool { + if s == nil { + return nil + } + return s.PassesFilter +} + func (s *SubscriptionTestResult) GetExtraProperties() map[string]interface{} { return s.extraProperties } @@ -91245,7 +91672,7 @@ func (s *SubscriptionTestResult) SetStatusCode(statusCode *int) { // SetPayload sets the Payload field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (s *SubscriptionTestResult) SetPayload(payload *string) { +func (s *SubscriptionTestResult) SetPayload(payload map[string]interface{}) { s.Payload = payload s.require(subscriptionTestResultFieldPayload) } @@ -91264,6 +91691,20 @@ func (s *SubscriptionTestResult) SetUpdatedAt(updatedAt *string) { s.require(subscriptionTestResultFieldUpdatedAt) } +// SetNotificationURL sets the NotificationURL field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SubscriptionTestResult) SetNotificationURL(notificationURL *string) { + s.NotificationURL = notificationURL + s.require(subscriptionTestResultFieldNotificationURL) +} + +// SetPassesFilter sets the PassesFilter field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SubscriptionTestResult) SetPassesFilter(passesFilter *bool) { + s.PassesFilter = passesFilter + s.require(subscriptionTestResultFieldPassesFilter) +} + func (s *SubscriptionTestResult) UnmarshalJSON(data []byte) error { type unmarshaler SubscriptionTestResult var value unmarshaler @@ -98286,14 +98727,14 @@ func (t *TerminalRefundUpdatedEventObject) String() string { return fmt.Sprintf("%#v", t) } -// 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. +// Defines the fields that are included in the response body of a request to the TestWebhookSubscription endpoint. var ( testWebhookSubscriptionResponseFieldErrors = big.NewInt(1 << 0) testWebhookSubscriptionResponseFieldSubscriptionTestResult = big.NewInt(1 << 1) + testWebhookSubscriptionResponseFieldNotificationURL = big.NewInt(1 << 2) + testWebhookSubscriptionResponseFieldStatusCode = big.NewInt(1 << 3) + testWebhookSubscriptionResponseFieldPassesFilter = big.NewInt(1 << 4) + testWebhookSubscriptionResponseFieldPayload = big.NewInt(1 << 5) ) type TestWebhookSubscriptionResponse struct { @@ -98301,6 +98742,14 @@ type TestWebhookSubscriptionResponse struct { 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 URL that was used for the webhook notification test. + NotificationURL *string `json:"notification_url,omitempty" url:"notification_url,omitempty"` + // The HTTP status code returned by the notification URL. + StatusCode *int `json:"status_code,omitempty" url:"status_code,omitempty"` + // Whether the notification passed any configured filters. + PassesFilter *bool `json:"passes_filter,omitempty" url:"passes_filter,omitempty"` + // The payload that was sent in the test notification. + Payload map[string]interface{} `json:"payload,omitempty" url:"payload,omitempty"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -98323,6 +98772,34 @@ func (t *TestWebhookSubscriptionResponse) GetSubscriptionTestResult() *Subscript return t.SubscriptionTestResult } +func (t *TestWebhookSubscriptionResponse) GetNotificationURL() *string { + if t == nil { + return nil + } + return t.NotificationURL +} + +func (t *TestWebhookSubscriptionResponse) GetStatusCode() *int { + if t == nil { + return nil + } + return t.StatusCode +} + +func (t *TestWebhookSubscriptionResponse) GetPassesFilter() *bool { + if t == nil { + return nil + } + return t.PassesFilter +} + +func (t *TestWebhookSubscriptionResponse) GetPayload() map[string]interface{} { + if t == nil { + return nil + } + return t.Payload +} + func (t *TestWebhookSubscriptionResponse) GetExtraProperties() map[string]interface{} { return t.extraProperties } @@ -98348,6 +98825,34 @@ func (t *TestWebhookSubscriptionResponse) SetSubscriptionTestResult(subscription t.require(testWebhookSubscriptionResponseFieldSubscriptionTestResult) } +// SetNotificationURL sets the NotificationURL field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestWebhookSubscriptionResponse) SetNotificationURL(notificationURL *string) { + t.NotificationURL = notificationURL + t.require(testWebhookSubscriptionResponseFieldNotificationURL) +} + +// SetStatusCode sets the StatusCode field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestWebhookSubscriptionResponse) SetStatusCode(statusCode *int) { + t.StatusCode = statusCode + t.require(testWebhookSubscriptionResponseFieldStatusCode) +} + +// SetPassesFilter sets the PassesFilter field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestWebhookSubscriptionResponse) SetPassesFilter(passesFilter *bool) { + t.PassesFilter = passesFilter + t.require(testWebhookSubscriptionResponseFieldPassesFilter) +} + +// SetPayload sets the Payload field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestWebhookSubscriptionResponse) SetPayload(payload map[string]interface{}) { + t.Payload = payload + t.require(testWebhookSubscriptionResponseFieldPayload) +} + func (t *TestWebhookSubscriptionResponse) UnmarshalJSON(data []byte) error { type unmarshaler TestWebhookSubscriptionResponse var value unmarshaler diff --git a/v1transactions.go b/v1transactions.go index 4302f16..6a51d04 100644 --- a/v1transactions.go +++ b/v1transactions.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" big "math/big" ) diff --git a/v1transactions/client.go b/v1transactions/client.go index f0b3b2a..e616612 100644 --- a/v1transactions/client.go +++ b/v1transactions/client.go @@ -4,10 +4,10 @@ package v1transactions import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" os "os" ) diff --git a/v1transactions/raw_client.go b/v1transactions/raw_client.go index f6c8096..10eeb25 100644 --- a/v1transactions/raw_client.go +++ b/v1transactions/raw_client.go @@ -4,10 +4,10 @@ package v1transactions import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/vendors.go b/vendors.go index a238f97..580b536 100644 --- a/vendors.go +++ b/vendors.go @@ -5,7 +5,7 @@ package square import ( json "encoding/json" fmt "fmt" - internal "github.com/square/square-go-sdk/v2/internal" + internal "github.com/square/square-go-sdk/v3/internal" big "math/big" ) diff --git a/vendors/client.go b/vendors/client.go index 5d59674..31fd65f 100644 --- a/vendors/client.go +++ b/vendors/client.go @@ -4,10 +4,10 @@ package vendors import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" os "os" ) diff --git a/vendors/raw_client.go b/vendors/raw_client.go index dd0fa97..a7494d8 100644 --- a/vendors/raw_client.go +++ b/vendors/raw_client.go @@ -4,10 +4,10 @@ package vendors import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" http "net/http" ) diff --git a/webhooks/client/client.go b/webhooks/client/client.go index aa6cd83..2a9211e 100644 --- a/webhooks/client/client.go +++ b/webhooks/client/client.go @@ -3,10 +3,10 @@ package client import ( - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - eventtypes "github.com/square/square-go-sdk/v2/webhooks/eventtypes" - subscriptions "github.com/square/square-go-sdk/v2/webhooks/subscriptions" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + eventtypes "github.com/square/square-go-sdk/v3/webhooks/eventtypes" + subscriptions "github.com/square/square-go-sdk/v3/webhooks/subscriptions" os "os" ) diff --git a/webhooks/error_codes.go b/webhooks/error_codes.go new file mode 100644 index 0000000..4ca21be --- /dev/null +++ b/webhooks/error_codes.go @@ -0,0 +1,9 @@ +// Code generated by Fern. DO NOT EDIT. + +package webhooks + +import ( + internal "github.com/square/square-go-sdk/v3/internal" +) + +var ErrorCodes internal.ErrorCodes = internal.ErrorCodes{} diff --git a/webhooks/eventtypes/client.go b/webhooks/eventtypes/client.go index 68e25ce..5589d4d 100644 --- a/webhooks/eventtypes/client.go +++ b/webhooks/eventtypes/client.go @@ -4,11 +4,11 @@ package eventtypes import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" - webhooks "github.com/square/square-go-sdk/v2/webhooks" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" + webhooks "github.com/square/square-go-sdk/v3/webhooks" os "os" ) diff --git a/webhooks/eventtypes/raw_client.go b/webhooks/eventtypes/raw_client.go index 2523d9f..9e902ce 100644 --- a/webhooks/eventtypes/raw_client.go +++ b/webhooks/eventtypes/raw_client.go @@ -4,11 +4,11 @@ package eventtypes import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" - webhooks "github.com/square/square-go-sdk/v2/webhooks" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" + webhooks "github.com/square/square-go-sdk/v3/webhooks" http "net/http" ) diff --git a/webhooks/subscriptions.go b/webhooks/subscriptions.go index 7744bc6..047b31b 100644 --- a/webhooks/subscriptions.go +++ b/webhooks/subscriptions.go @@ -3,7 +3,7 @@ package webhooks import ( - v2 "github.com/square/square-go-sdk/v2" + v3 "github.com/square/square-go-sdk/v3" big "math/big" ) @@ -16,7 +16,7 @@ type CreateWebhookSubscriptionRequest struct { // A unique string that identifies the [CreateWebhookSubscription](api-endpoint:WebhookSubscriptions-CreateWebhookSubscription) request. IdempotencyKey *string `json:"idempotency_key,omitempty" url:"-"` // The [Subscription](entity:WebhookSubscription) to create. - Subscription *v2.WebhookSubscription `json:"subscription,omitempty" url:"-"` + Subscription *v3.WebhookSubscription `json:"subscription,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -38,7 +38,7 @@ func (c *CreateWebhookSubscriptionRequest) SetIdempotencyKey(idempotencyKey *str // SetSubscription sets the Subscription field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *CreateWebhookSubscriptionRequest) SetSubscription(subscription *v2.WebhookSubscription) { +func (c *CreateWebhookSubscriptionRequest) SetSubscription(subscription *v3.WebhookSubscription) { c.Subscription = subscription c.require(createWebhookSubscriptionRequestFieldSubscription) } @@ -113,7 +113,7 @@ type ListSubscriptionsRequest struct { IncludeDisabled *bool `json:"-" 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. - SortOrder *v2.SortOrder `json:"-" url:"sort_order,omitempty"` + SortOrder *v3.SortOrder `json:"-" 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. @@ -148,7 +148,7 @@ func (l *ListSubscriptionsRequest) SetIncludeDisabled(includeDisabled *bool) { // SetSortOrder sets the SortOrder field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (l *ListSubscriptionsRequest) SetSortOrder(sortOrder *v2.SortOrder) { +func (l *ListSubscriptionsRequest) SetSortOrder(sortOrder *v3.SortOrder) { l.SortOrder = sortOrder l.require(listSubscriptionsRequestFieldSortOrder) } @@ -206,7 +206,7 @@ type UpdateWebhookSubscriptionRequest struct { // [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to update. SubscriptionID string `json:"-" url:"-"` // The [Subscription](entity:WebhookSubscription) to update. - Subscription *v2.WebhookSubscription `json:"subscription,omitempty" url:"-"` + Subscription *v3.WebhookSubscription `json:"subscription,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -228,7 +228,7 @@ func (u *UpdateWebhookSubscriptionRequest) SetSubscriptionID(subscriptionID stri // SetSubscription sets the Subscription field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (u *UpdateWebhookSubscriptionRequest) SetSubscription(subscription *v2.WebhookSubscription) { +func (u *UpdateWebhookSubscriptionRequest) SetSubscription(subscription *v3.WebhookSubscription) { u.Subscription = subscription u.require(updateWebhookSubscriptionRequestFieldSubscription) } diff --git a/webhooks/subscriptions/client.go b/webhooks/subscriptions/client.go index de3a12f..02032d3 100644 --- a/webhooks/subscriptions/client.go +++ b/webhooks/subscriptions/client.go @@ -4,11 +4,11 @@ package subscriptions import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" - webhooks "github.com/square/square-go-sdk/v2/webhooks" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" + webhooks "github.com/square/square-go-sdk/v3/webhooks" http "net/http" os "os" ) diff --git a/webhooks/subscriptions/raw_client.go b/webhooks/subscriptions/raw_client.go index ec79fe9..7f0d3f2 100644 --- a/webhooks/subscriptions/raw_client.go +++ b/webhooks/subscriptions/raw_client.go @@ -4,11 +4,11 @@ package subscriptions import ( context "context" - square "github.com/square/square-go-sdk/v2" - core "github.com/square/square-go-sdk/v2/core" - internal "github.com/square/square-go-sdk/v2/internal" - option "github.com/square/square-go-sdk/v2/option" - webhooks "github.com/square/square-go-sdk/v2/webhooks" + square "github.com/square/square-go-sdk/v3" + core "github.com/square/square-go-sdk/v3/core" + internal "github.com/square/square-go-sdk/v3/internal" + option "github.com/square/square-go-sdk/v3/option" + webhooks "github.com/square/square-go-sdk/v3/webhooks" http "net/http" ) From 338e0411fdba03e48d3144f823a6d78e3926f7a4 Mon Sep 17 00:00:00 2001 From: Mike Konopelski Date: Thu, 22 Jan 2026 13:43:46 -0500 Subject: [PATCH 2/2] Update imports from v2 to v3 to match module path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- integration_tests/catalog_test.go | 6 +++--- integration_tests/client_utils_test.go | 6 +++--- integration_tests/orders_test.go | 4 ++-- integration_tests/orders_utils_test.go | 2 +- integration_tests/payments_test.go | 2 +- integration_tests/payments_utils_test.go | 2 +- integration_tests/teams_test.go | 2 +- webhooks/client/verify_signature.go | 2 +- webhooks/client/verify_signature_test.go | 2 +- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/integration_tests/catalog_test.go b/integration_tests/catalog_test.go index 717ecac..1a5d3b0 100644 --- a/integration_tests/catalog_test.go +++ b/integration_tests/catalog_test.go @@ -11,9 +11,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - square "github.com/square/square-go-sdk/v2" - "github.com/square/square-go-sdk/v2/catalog" - "github.com/square/square-go-sdk/v2/core" + square "github.com/square/square-go-sdk/v3" + "github.com/square/square-go-sdk/v3/catalog" + "github.com/square/square-go-sdk/v3/core" ) // Catalog API integration tests. diff --git a/integration_tests/client_utils_test.go b/integration_tests/client_utils_test.go index 57b539a..2698381 100644 --- a/integration_tests/client_utils_test.go +++ b/integration_tests/client_utils_test.go @@ -11,9 +11,9 @@ import ( "github.com/google/uuid" "github.com/stretchr/testify/require" - square "github.com/square/square-go-sdk/v2" - client "github.com/square/square-go-sdk/v2/client" - option "github.com/square/square-go-sdk/v2/option" + square "github.com/square/square-go-sdk/v3" + client "github.com/square/square-go-sdk/v3/client" + option "github.com/square/square-go-sdk/v3/option" ) // SourceID represents the payment source ID for the sandbox environment. diff --git a/integration_tests/orders_test.go b/integration_tests/orders_test.go index d4177e9..0fc7d5d 100644 --- a/integration_tests/orders_test.go +++ b/integration_tests/orders_test.go @@ -7,12 +7,12 @@ import ( "fmt" "testing" - "github.com/square/square-go-sdk/v2/orders" + "github.com/square/square-go-sdk/v3/orders" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - square "github.com/square/square-go-sdk/v2" + square "github.com/square/square-go-sdk/v3" ) // Orders API integration tests. diff --git a/integration_tests/orders_utils_test.go b/integration_tests/orders_utils_test.go index 1b11f1d..1e1b89f 100644 --- a/integration_tests/orders_utils_test.go +++ b/integration_tests/orders_utils_test.go @@ -3,7 +3,7 @@ package integration import ( - square "github.com/square/square-go-sdk/v2" + square "github.com/square/square-go-sdk/v3" ) // Simplified data structure for [square.OrderLineItem]. diff --git a/integration_tests/payments_test.go b/integration_tests/payments_test.go index cda01dd..ebbe936 100644 --- a/integration_tests/payments_test.go +++ b/integration_tests/payments_test.go @@ -6,7 +6,7 @@ import ( "context" "testing" - square "github.com/square/square-go-sdk/v2" + square "github.com/square/square-go-sdk/v3" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/integration_tests/payments_utils_test.go b/integration_tests/payments_utils_test.go index 9e7335b..e7bfc1f 100644 --- a/integration_tests/payments_utils_test.go +++ b/integration_tests/payments_utils_test.go @@ -3,7 +3,7 @@ package integration import ( - square "github.com/square/square-go-sdk/v2" + square "github.com/square/square-go-sdk/v3" ) type TestPaymentRequest struct { diff --git a/integration_tests/teams_test.go b/integration_tests/teams_test.go index 736d373..388dddb 100644 --- a/integration_tests/teams_test.go +++ b/integration_tests/teams_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - square "github.com/square/square-go-sdk/v2" + square "github.com/square/square-go-sdk/v3" ) // Teams API integration tests. diff --git a/webhooks/client/verify_signature.go b/webhooks/client/verify_signature.go index 8c0ffbc..e23f673 100644 --- a/webhooks/client/verify_signature.go +++ b/webhooks/client/verify_signature.go @@ -8,7 +8,7 @@ import ( "errors" "hash" - v2 "github.com/square/square-go-sdk/v2" + v2 "github.com/square/square-go-sdk/v3" ) // VerifySignature verifies and validates an event notification. diff --git a/webhooks/client/verify_signature_test.go b/webhooks/client/verify_signature_test.go index bbb6848..bad5075 100644 --- a/webhooks/client/verify_signature_test.go +++ b/webhooks/client/verify_signature_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - square "github.com/square/square-go-sdk/v2" + square "github.com/square/square-go-sdk/v3" "github.com/stretchr/testify/assert" )