Skip to content

Commit

Permalink
SDK regeneration
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Nov 21, 2024
1 parent 94068a9 commit 1191284
Show file tree
Hide file tree
Showing 142 changed files with 7,665 additions and 8,628 deletions.
10 changes: 4 additions & 6 deletions apple_pay.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type RegisterDomainResponse struct {
Status *RegisterDomainResponseStatus `json:"status,omitempty" url:"status,omitempty"`

extraProperties map[string]interface{}
_rawJSON json.RawMessage
rawJSON json.RawMessage
}

func (r *RegisterDomainResponse) GetErrors() []*Error {
Expand Down Expand Up @@ -55,20 +55,18 @@ func (r *RegisterDomainResponse) UnmarshalJSON(data []byte) error {
return err
}
*r = RegisterDomainResponse(value)

extraProperties, err := internal.ExtractExtraProperties(data, *r)
if err != nil {
return err
}
r.extraProperties = extraProperties

r._rawJSON = json.RawMessage(data)
r.rawJSON = json.RawMessage(data)
return nil
}

func (r *RegisterDomainResponse) String() string {
if len(r._rawJSON) > 0 {
if value, err := internal.StringifyJSON(r._rawJSON); err == nil {
if len(r.rawJSON) > 0 {
if value, err := internal.StringifyJSON(r.rawJSON); err == nil {
return value
}
}
Expand Down
21 changes: 10 additions & 11 deletions applepay/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,16 @@ func (c *Client) RegisterDomain(
opts ...option.RequestOption,
) (*squaregosdk.RegisterDomainResponse, error) {
options := core.NewRequestOptions(opts...)

baseURL := "https://connect.squareupsandbox.com"
if c.baseURL != "" {
baseURL = c.baseURL
}
if options.BaseURL != "" {
baseURL = options.BaseURL
}
baseURL := internal.ResolveBaseURL(
options.BaseURL,
c.baseURL,
"https://connect.squareupsandbox.com",
)
endpointURL := baseURL + "/v2/apple-pay/domains"

headers := internal.MergeHeaders(c.header.Clone(), options.ToHeader())
headers := internal.MergeHeaders(
c.header.Clone(),
options.ToHeader(),
)
headers.Set("Content-Type", "application/json")

var response *squaregosdk.RegisterDomainResponse
Expand All @@ -77,8 +76,8 @@ func (c *Client) RegisterDomain(
&internal.CallParams{
URL: endpointURL,
Method: http.MethodPost,
MaxAttempts: options.MaxAttempts,
Headers: headers,
MaxAttempts: options.MaxAttempts,
BodyProperties: options.BodyProperties,
QueryParameters: options.QueryParameters,
Client: options.HTTPClient,
Expand Down
51 changes: 27 additions & 24 deletions bank_accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ import (
internal "github.com/square/square-go-sdk/internal"
)

type BankAccountsGetByV1IDRequest struct {
// Connect V1 ID of the desired `BankAccount`. For more information, see
// [Retrieve a bank account by using an ID issued by V1 Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api#retrieve-a-bank-account-by-using-an-id-issued-by-v1-bank-accounts-api).
V1BankAccountID string `json:"-" url:"-"`
}

type BankAccountsGetRequest struct {
// Square-issued ID of the desired `BankAccount`.
BankAccountID string `json:"-" url:"-"`
}

type BankAccountsListRequest struct {
// The pagination cursor returned by a previous call to this endpoint.
// Use it in the next `ListBankAccounts` request to retrieve the next set
Expand Down Expand Up @@ -79,7 +90,7 @@ type BankAccount struct {
BankName *string `json:"bank_name,omitempty" url:"bank_name,omitempty"`

extraProperties map[string]interface{}
_rawJSON json.RawMessage
rawJSON json.RawMessage
}

func (b *BankAccount) GetID() string {
Expand Down Expand Up @@ -212,20 +223,18 @@ func (b *BankAccount) UnmarshalJSON(data []byte) error {
return err
}
*b = BankAccount(value)

extraProperties, err := internal.ExtractExtraProperties(data, *b)
if err != nil {
return err
}
b.extraProperties = extraProperties

b._rawJSON = json.RawMessage(data)
b.rawJSON = json.RawMessage(data)
return nil
}

func (b *BankAccount) String() string {
if len(b._rawJSON) > 0 {
if value, err := internal.StringifyJSON(b._rawJSON); err == nil {
if len(b.rawJSON) > 0 {
if value, err := internal.StringifyJSON(b.rawJSON); err == nil {
return value
}
}
Expand Down Expand Up @@ -304,7 +313,7 @@ type GetBankAccountByV1IDResponse struct {
BankAccount *BankAccount `json:"bank_account,omitempty" url:"bank_account,omitempty"`

extraProperties map[string]interface{}
_rawJSON json.RawMessage
rawJSON json.RawMessage
}

func (g *GetBankAccountByV1IDResponse) GetErrors() []*Error {
Expand Down Expand Up @@ -332,20 +341,18 @@ func (g *GetBankAccountByV1IDResponse) UnmarshalJSON(data []byte) error {
return err
}
*g = GetBankAccountByV1IDResponse(value)

extraProperties, err := internal.ExtractExtraProperties(data, *g)
if err != nil {
return err
}
g.extraProperties = extraProperties

g._rawJSON = json.RawMessage(data)
g.rawJSON = json.RawMessage(data)
return nil
}

func (g *GetBankAccountByV1IDResponse) String() string {
if len(g._rawJSON) > 0 {
if value, err := internal.StringifyJSON(g._rawJSON); err == nil {
if len(g.rawJSON) > 0 {
if value, err := internal.StringifyJSON(g.rawJSON); err == nil {
return value
}
}
Expand All @@ -363,7 +370,7 @@ type GetBankAccountResponse struct {
BankAccount *BankAccount `json:"bank_account,omitempty" url:"bank_account,omitempty"`

extraProperties map[string]interface{}
_rawJSON json.RawMessage
rawJSON json.RawMessage
}

func (g *GetBankAccountResponse) GetErrors() []*Error {
Expand Down Expand Up @@ -391,20 +398,18 @@ func (g *GetBankAccountResponse) UnmarshalJSON(data []byte) error {
return err
}
*g = GetBankAccountResponse(value)

extraProperties, err := internal.ExtractExtraProperties(data, *g)
if err != nil {
return err
}
g.extraProperties = extraProperties

g._rawJSON = json.RawMessage(data)
g.rawJSON = json.RawMessage(data)
return nil
}

func (g *GetBankAccountResponse) String() string {
if len(g._rawJSON) > 0 {
if value, err := internal.StringifyJSON(g._rawJSON); err == nil {
if len(g.rawJSON) > 0 {
if value, err := internal.StringifyJSON(g.rawJSON); err == nil {
return value
}
}
Expand All @@ -428,7 +433,7 @@ type ListBankAccountsResponse struct {
Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"`

extraProperties map[string]interface{}
_rawJSON json.RawMessage
rawJSON json.RawMessage
}

func (l *ListBankAccountsResponse) GetErrors() []*Error {
Expand Down Expand Up @@ -463,20 +468,18 @@ func (l *ListBankAccountsResponse) UnmarshalJSON(data []byte) error {
return err
}
*l = ListBankAccountsResponse(value)

extraProperties, err := internal.ExtractExtraProperties(data, *l)
if err != nil {
return err
}
l.extraProperties = extraProperties

l._rawJSON = json.RawMessage(data)
l.rawJSON = json.RawMessage(data)
return nil
}

func (l *ListBankAccountsResponse) String() string {
if len(l._rawJSON) > 0 {
if value, err := internal.StringifyJSON(l._rawJSON); err == nil {
if len(l.rawJSON) > 0 {
if value, err := internal.StringifyJSON(l.rawJSON); err == nil {
return value
}
}
Expand Down
81 changes: 40 additions & 41 deletions bankaccounts/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,20 @@ func (c *Client) List(
opts ...option.RequestOption,
) (*core.Page[*squaregosdk.BankAccount], error) {
options := core.NewRequestOptions(opts...)

baseURL := "https://connect.squareupsandbox.com"
if c.baseURL != "" {
baseURL = c.baseURL
}
if options.BaseURL != "" {
baseURL = options.BaseURL
}
baseURL := internal.ResolveBaseURL(
options.BaseURL,
c.baseURL,
"https://connect.squareupsandbox.com",
)
endpointURL := baseURL + "/v2/bank-accounts"

queryParams, err := internal.QueryValues(request)
if err != nil {
return nil, err
}

headers := internal.MergeHeaders(c.header.Clone(), options.ToHeader())
headers := internal.MergeHeaders(
c.header.Clone(),
options.ToHeader(),
)

prepareCall := func(pageRequest *internal.PageRequest[*string]) *internal.CallParams {
if pageRequest.Cursor != nil {
Expand All @@ -74,8 +72,8 @@ func (c *Client) List(
return &internal.CallParams{
URL: nextURL,
Method: http.MethodGet,
MaxAttempts: options.MaxAttempts,
Headers: headers,
MaxAttempts: options.MaxAttempts,
BodyProperties: options.BodyProperties,
QueryParameters: options.QueryParameters,
Client: options.HTTPClient,
Expand All @@ -101,32 +99,32 @@ func (c *Client) List(
// Returns details of a [BankAccount](entity:BankAccount) identified by V1 bank account ID.
func (c *Client) GetByV1ID(
ctx context.Context,
// Connect V1 ID of the desired `BankAccount`. For more information, see
// [Retrieve a bank account by using an ID issued by V1 Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api#retrieve-a-bank-account-by-using-an-id-issued-by-v1-bank-accounts-api).
v1BankAccountID string,
request *squaregosdk.BankAccountsGetByV1IDRequest,
opts ...option.RequestOption,
) (*squaregosdk.GetBankAccountByV1IDResponse, error) {
options := core.NewRequestOptions(opts...)

baseURL := "https://connect.squareupsandbox.com"
if c.baseURL != "" {
baseURL = c.baseURL
}
if options.BaseURL != "" {
baseURL = options.BaseURL
}
endpointURL := internal.EncodeURL(baseURL+"/v2/bank-accounts/by-v1-id/%v", v1BankAccountID)

headers := internal.MergeHeaders(c.header.Clone(), options.ToHeader())
baseURL := internal.ResolveBaseURL(
options.BaseURL,
c.baseURL,
"https://connect.squareupsandbox.com",
)
endpointURL := internal.EncodeURL(
baseURL+"/v2/bank-accounts/by-v1-id/%v",
request.V1BankAccountID,
)
headers := internal.MergeHeaders(
c.header.Clone(),
options.ToHeader(),
)

var response *squaregosdk.GetBankAccountByV1IDResponse
if err := c.caller.Call(
ctx,
&internal.CallParams{
URL: endpointURL,
Method: http.MethodGet,
MaxAttempts: options.MaxAttempts,
Headers: headers,
MaxAttempts: options.MaxAttempts,
BodyProperties: options.BodyProperties,
QueryParameters: options.QueryParameters,
Client: options.HTTPClient,
Expand All @@ -142,31 +140,32 @@ func (c *Client) GetByV1ID(
// linked to a Square account.
func (c *Client) Get(
ctx context.Context,
// Square-issued ID of the desired `BankAccount`.
bankAccountID string,
request *squaregosdk.BankAccountsGetRequest,
opts ...option.RequestOption,
) (*squaregosdk.GetBankAccountResponse, error) {
options := core.NewRequestOptions(opts...)

baseURL := "https://connect.squareupsandbox.com"
if c.baseURL != "" {
baseURL = c.baseURL
}
if options.BaseURL != "" {
baseURL = options.BaseURL
}
endpointURL := internal.EncodeURL(baseURL+"/v2/bank-accounts/%v", bankAccountID)

headers := internal.MergeHeaders(c.header.Clone(), options.ToHeader())
baseURL := internal.ResolveBaseURL(
options.BaseURL,
c.baseURL,
"https://connect.squareupsandbox.com",
)
endpointURL := internal.EncodeURL(
baseURL+"/v2/bank-accounts/%v",
request.BankAccountID,
)
headers := internal.MergeHeaders(
c.header.Clone(),
options.ToHeader(),
)

var response *squaregosdk.GetBankAccountResponse
if err := c.caller.Call(
ctx,
&internal.CallParams{
URL: endpointURL,
Method: http.MethodGet,
MaxAttempts: options.MaxAttempts,
Headers: headers,
MaxAttempts: options.MaxAttempts,
BodyProperties: options.BodyProperties,
QueryParameters: options.QueryParameters,
Client: options.HTTPClient,
Expand Down
Loading

0 comments on commit 1191284

Please sign in to comment.