From b28c5e1f98614e3c0bc60f0defb139510076416b Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Tue, 17 Oct 2023 13:50:18 +0000 Subject: [PATCH] ci: regenerated with OpenAPI Doc 3.0.0, Speakeay CLI 1.100.2 --- previous-versions/commerce/.gitignore | 1 + previous-versions/commerce/README.md | 63 +- previous-versions/commerce/RELEASES.md | 12 +- previous-versions/commerce/USAGE.md | 39 +- previous-versions/commerce/codatcommerce.go | 29 +- previous-versions/commerce/companyinfo.go | 30 +- previous-versions/commerce/customers.go | 58 +- previous-versions/commerce/disputes.go | 58 +- .../operations/getcompanyinforequest.md | 4 +- .../operations/getcompanyinforesponse.md | 6 +- .../models/operations/getcustomerrequest.md | 4 +- .../models/operations/getcustomerresponse.md | 6 +- .../models/operations/getdisputerequest.md | 4 +- .../models/operations/getdisputeresponse.md | 6 +- .../models/operations/getlocationrequest.md | 4 +- .../models/operations/getlocationresponse.md | 6 +- .../docs/models/operations/getorderrequest.md | 4 +- .../models/operations/getorderresponse.md | 6 +- .../operations/getpaymentmethodrequest.md | 4 +- .../operations/getpaymentmethodresponse.md | 6 +- .../models/operations/getpaymentrequest.md | 4 +- .../models/operations/getpaymentresponse.md | 6 +- .../operations/getproductcategoryrequest.md | 4 +- .../operations/getproductcategoryresponse.md | 6 +- .../models/operations/getproductrequest.md | 4 +- .../models/operations/getproductresponse.md | 6 +- .../operations/gettaxcomponentrequest.md | 4 +- .../operations/gettaxcomponentresponse.md | 6 +- .../operations/gettransactionrequest.md | 4 +- .../operations/gettransactionresponse.md | 6 +- .../models/operations/listcustomersrequest.md | 4 +- .../operations/listcustomersresponse.md | 6 +- .../models/operations/listdisputesrequest.md | 4 +- .../models/operations/listdisputesresponse.md | 6 +- .../models/operations/listlocationsrequest.md | 4 +- .../operations/listlocationsresponse.md | 6 +- .../models/operations/listordersrequest.md | 4 +- .../models/operations/listordersresponse.md | 6 +- .../operations/listpaymentmethodsrequest.md | 4 +- .../operations/listpaymentmethodsresponse.md | 6 +- .../models/operations/listpaymentsrequest.md | 4 +- .../models/operations/listpaymentsresponse.md | 6 +- .../listproductcategoriesrequest.md | 4 +- .../listproductcategoriesresponse.md | 6 +- .../models/operations/listproductsrequest.md | 4 +- .../models/operations/listproductsresponse.md | 6 +- .../operations/listtaxcomponentsrequest.md | 4 +- .../operations/listtaxcomponentsresponse.md | 6 +- .../operations/listtransactionsrequest.md | 4 +- .../operations/listtransactionsresponse.md | 6 +- .../docs/models/shared/accountbalance.md | 12 +- .../docs/models/shared/companyinfo.md | 4 +- .../commerce/docs/models/shared/customers.md | 6 +- .../commerce/docs/models/shared/dispute.md | 2 +- .../commerce/docs/models/shared/disputes.md | 6 +- .../docs/models/shared/errormessage.md | 16 +- .../commerce/docs/models/shared/halref.md | 6 +- .../commerce/docs/models/shared/locations.md | 6 +- .../commerce/docs/models/shared/order.md | 12 +- .../models/shared/orderdiscountallocation.md | 8 +- .../docs/models/shared/orderlineitem.md | 10 +- .../commerce/docs/models/shared/orders.md | 14 +- .../commerce/docs/models/shared/payment.md | 7 +- .../docs/models/shared/paymentmethod.md | 2 +- .../docs/models/shared/paymentmethodref.md | 11 + .../docs/models/shared/paymentmethods.md | 6 +- .../docs/models/shared/paymentmethodstatus.md | 6 +- .../commerce/docs/models/shared/paymentref.md | 2 +- .../commerce/docs/models/shared/payments.md | 6 +- .../commerce/docs/models/shared/product.md | 17 +- .../docs/models/shared/productcategories.md | 6 +- .../docs/models/shared/productinventory.md | 2 +- .../models/shared/productinventorylocation.md | 8 +- .../docs/models/shared/productprice.md | 2 +- .../commerce/docs/models/shared/productref.md | 8 +- .../commerce/docs/models/shared/products.md | 6 +- .../docs/models/shared/productvariant.md | 4 +- .../docs/models/shared/productvariantref.md | 8 +- .../models/shared/productvariantstatus.md | 2 + .../docs/models/shared/servicecharge.md | 6 +- ...upplementaldata.md => supplementaldata.md} | 2 +- .../docs/models/shared/taxcomponent.md | 2 +- .../models/shared/taxcomponentallocation.md | 2 +- .../docs/models/shared/taxcomponents.md | 6 +- .../docs/models/shared/transaction.md | 3 +- .../docs/models/shared/transactions.md | 6 +- .../models/shared/transactionsourceref.md | 2 +- .../models/shared/transactionsourcetype.md | 2 + .../docs/sdks/codatcommerce/README.md | 1 + .../commerce/docs/sdks/companyinfo/README.md | 5 +- .../commerce/docs/sdks/customers/README.md | 18 +- .../commerce/docs/sdks/disputes/README.md | 18 +- .../commerce/docs/sdks/locations/README.md | 11 +- .../commerce/docs/sdks/orders/README.md | 18 +- .../commerce/docs/sdks/payments/README.md | 35 +- .../commerce/docs/sdks/products/README.md | 35 +- .../docs/sdks/taxcomponents/README.md | 18 +- .../commerce/docs/sdks/transactions/README.md | 18 +- previous-versions/commerce/files.gen | 33 +- previous-versions/commerce/gen.yaml | 14 +- previous-versions/commerce/go.mod | 3 +- previous-versions/commerce/go.sum | 2 + previous-versions/commerce/locations.go | 58 +- previous-versions/commerce/orders.go | 58 +- previous-versions/commerce/payments.go | 114 ++-- .../pkg/models/operations/getcompanyinfo.go | 11 +- .../pkg/models/operations/getcustomer.go | 11 +- .../pkg/models/operations/getdispute.go | 11 +- .../pkg/models/operations/getlocation.go | 11 +- .../pkg/models/operations/getorder.go | 11 +- .../pkg/models/operations/getpayment.go | 11 +- .../pkg/models/operations/getpaymentmethod.go | 11 +- .../pkg/models/operations/getproduct.go | 11 +- .../models/operations/getproductcategory.go | 11 +- .../pkg/models/operations/gettaxcomponent.go | 11 +- .../pkg/models/operations/gettransaction.go | 11 +- .../pkg/models/operations/listcustomers.go | 27 +- .../pkg/models/operations/listdisputes.go | 27 +- .../pkg/models/operations/listlocations.go | 11 +- .../pkg/models/operations/listorders.go | 27 +- .../models/operations/listpaymentmethods.go | 27 +- .../pkg/models/operations/listpayments.go | 27 +- .../operations/listproductcategories.go | 27 +- .../pkg/models/operations/listproducts.go | 27 +- .../models/operations/listtaxcomponents.go | 27 +- .../pkg/models/operations/listtransactions.go | 27 +- .../pkg/models/shared/accountbalance.go | 22 +- .../commerce/pkg/models/shared/customers.go | 13 +- .../commerce/pkg/models/shared/disputes.go | 13 +- .../pkg/models/shared/errormessage.go | 18 +- .../commerce/pkg/models/shared/halref.go | 1 + .../commerce/pkg/models/shared/locations.go | 13 +- .../commerce/pkg/models/shared/order.go | 60 +- .../models/shared/orderdiscountallocation.go | 20 +- .../pkg/models/shared/orderlineitem.go | 44 +- .../commerce/pkg/models/shared/orders.go | 13 +- .../commerce/pkg/models/shared/payment.go | 38 +- .../pkg/models/shared/paymentmethod.go | 38 +- .../pkg/models/shared/paymentmethodref.go | 25 + .../pkg/models/shared/paymentmethods.go | 13 +- .../pkg/models/shared/paymentmethodstatus.go | 39 -- .../commerce/pkg/models/shared/paymentref.go | 18 +- .../commerce/pkg/models/shared/payments.go | 13 +- .../commerce/pkg/models/shared/product.go | 19 +- .../pkg/models/shared/productcategories.go | 13 +- .../pkg/models/shared/productinventory.go | 21 +- .../models/shared/productinventorylocation.go | 21 +- .../pkg/models/shared/productprice.go | 21 +- .../commerce/pkg/models/shared/productref.go | 2 +- .../commerce/pkg/models/shared/products.go | 13 +- .../pkg/models/shared/productvariant.go | 25 +- .../pkg/models/shared/productvariantref.go | 2 +- .../pkg/models/shared/productvariantstatus.go | 1 + .../pkg/models/shared/servicecharge.go | 28 +- .../pkg/models/shared/supplementaldata.go | 17 + .../pkg/models/shared/taxcomponent.go | 20 +- .../models/shared/taxcomponentallocation.go | 18 +- .../pkg/models/shared/taxcomponents.go | 13 +- .../commerce/pkg/models/shared/transaction.go | 29 +- .../pkg/models/shared/transactions.go | 13 +- .../pkg/models/shared/transactionsourceref.go | 3 +- .../models/shared/transactionsourcetype.go | 1 + .../commerce/pkg/types/bigint.go | 77 +-- previous-versions/commerce/pkg/types/date.go | 4 + .../commerce/pkg/types/decimal.go | 64 +- .../commerce/pkg/types/pointers.go | 10 + previous-versions/commerce/pkg/utils/form.go | 4 - previous-versions/commerce/pkg/utils/json.go | 579 ++++++++++++++++++ .../commerce/pkg/utils/pathparams.go | 4 - .../commerce/pkg/utils/requestbody.go | 45 +- .../commerce/pkg/utils/security.go | 108 ++-- previous-versions/commerce/pkg/utils/utils.go | 19 +- previous-versions/commerce/products.go | 114 ++-- previous-versions/commerce/taxcomponents.go | 58 +- previous-versions/commerce/transactions.go | 58 +- 175 files changed, 2224 insertions(+), 1171 deletions(-) create mode 100755 previous-versions/commerce/docs/models/shared/paymentmethodref.md rename previous-versions/commerce/docs/models/shared/{ordersupplementaldata.md => supplementaldata.md} (96%) create mode 100755 previous-versions/commerce/pkg/models/shared/paymentmethodref.go delete mode 100755 previous-versions/commerce/pkg/models/shared/paymentmethodstatus.go create mode 100755 previous-versions/commerce/pkg/models/shared/supplementaldata.go create mode 100755 previous-versions/commerce/pkg/types/pointers.go create mode 100755 previous-versions/commerce/pkg/utils/json.go diff --git a/previous-versions/commerce/.gitignore b/previous-versions/commerce/.gitignore index e43b0f988..310cfb336 100755 --- a/previous-versions/commerce/.gitignore +++ b/previous-versions/commerce/.gitignore @@ -1 +1,2 @@ +# .gitignore .DS_Store diff --git a/previous-versions/commerce/README.md b/previous-versions/commerce/README.md index 93d80f194..4438be84b 100644 --- a/previous-versions/commerce/README.md +++ b/previous-versions/commerce/README.md @@ -16,39 +16,38 @@ go get github.com/codatio/client-sdk-go/previous-versions/commerce ## Example Usage - - ```go package main -import( +import ( "context" - "log" "github.com/codatio/client-sdk-go/previous-versions/commerce" - "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/models/shared" "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/models/operations" + "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/models/shared" + "log" ) func main() { - s := codatcommerce.New( - codatcommerce.WithSecurity(shared.Security{ - AuthHeader: "Basic BASE_64_ENCODED(API_KEY)", - }), - ) - - ctx := context.Background() - res, err := s.CompanyInfo.Get(ctx, operations.GetCompanyInfoRequest{ - CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", - ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - if err != nil { - log.Fatal(err) - } - - if res.CompanyInfo != nil { - // handle response - } + s := commerce.New( + commerce.WithSecurity(shared.Security{ + AuthHeader: "Basic BASE_64_ENCODED(API_KEY)", + }), + ) + + ctx := context.Background() + res, err := s.CompanyInfo.Get(ctx, operations.GetCompanyInfoRequest{ + CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", + ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + if err != nil { + log.Fatal(err) + } + + if res.CompanyInfo != nil { + // handle response + } } + ``` @@ -104,4 +103,22 @@ func main() { * [Get](docs/sdks/transactions/README.md#get) - Get transaction * [List](docs/sdks/transactions/README.md#list) - List transactions + + + + + + + + + + + + + + + + + + ### Library generated by [Speakeasy](https://docs.speakeasyapi.dev/docs/using-speakeasy/client-sdks) \ No newline at end of file diff --git a/previous-versions/commerce/RELEASES.md b/previous-versions/commerce/RELEASES.md index 56e3f799f..4d08fa1cc 100644 --- a/previous-versions/commerce/RELEASES.md +++ b/previous-versions/commerce/RELEASES.md @@ -330,4 +330,14 @@ Based on: ### Generated - [go v0.24.0] previous-versions/commerce ### Releases -- [Go v0.24.0] https://github.com/codatio/client-sdk-go/releases/tag/previous-versions/commerce/v0.24.0 - previous-versions/commerce \ No newline at end of file +- [Go v0.24.0] https://github.com/codatio/client-sdk-go/releases/tag/previous-versions/commerce/v0.24.0 - previous-versions/commerce + +## 2023-10-17 13:49:49 +### Changes +Based on: +- OpenAPI Doc 3.0.0 https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Commerce.yaml +- Speakeasy CLI 1.100.2 (2.159.2) https://github.com/speakeasy-api/speakeasy +### Generated +- [go v0.25.0] previous-versions/commerce +### Releases +- [Go v0.25.0] https://github.com/codatio/client-sdk-go/releases/tag/previous-versions/commerce/v0.25.0 - previous-versions/commerce \ No newline at end of file diff --git a/previous-versions/commerce/USAGE.md b/previous-versions/commerce/USAGE.md index b1858880a..4b9dcceab 100755 --- a/previous-versions/commerce/USAGE.md +++ b/previous-versions/commerce/USAGE.md @@ -4,33 +4,34 @@ ```go package main -import( +import ( "context" - "log" "github.com/codatio/client-sdk-go/previous-versions/commerce" - "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/models/shared" "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/models/operations" + "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/models/shared" + "log" ) func main() { - s := codatcommerce.New( - codatcommerce.WithSecurity(shared.Security{ - AuthHeader: "Basic BASE_64_ENCODED(API_KEY)", - }), - ) + s := commerce.New( + commerce.WithSecurity(shared.Security{ + AuthHeader: "Basic BASE_64_ENCODED(API_KEY)", + }), + ) - ctx := context.Background() - res, err := s.CompanyInfo.Get(ctx, operations.GetCompanyInfoRequest{ - CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", - ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - if err != nil { - log.Fatal(err) - } + ctx := context.Background() + res, err := s.CompanyInfo.Get(ctx, operations.GetCompanyInfoRequest{ + CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", + ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + if err != nil { + log.Fatal(err) + } - if res.CompanyInfo != nil { - // handle response - } + if res.CompanyInfo != nil { + // handle response + } } + ``` \ No newline at end of file diff --git a/previous-versions/commerce/codatcommerce.go b/previous-versions/commerce/codatcommerce.go index b77789ff2..873016dc1 100755 --- a/previous-versions/commerce/codatcommerce.go +++ b/previous-versions/commerce/codatcommerce.go @@ -1,8 +1,9 @@ // Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. -package codatcommerce +package commerce import ( + "context" "fmt" "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/models/shared" "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/utils" @@ -42,13 +43,14 @@ func Float64(f float64) *float64 { return &f } type sdkConfiguration struct { DefaultClient HTTPClient SecurityClient HTTPClient - Security *shared.Security + Security func(context.Context) (interface{}, error) ServerURL string ServerIndex int Language string OpenAPIDocVersion string SDKVersion string GenVersion string + UserAgent string RetryConfig *utils.RetryConfig } @@ -129,10 +131,26 @@ func WithClient(client HTTPClient) SDKOption { } } +func withSecurity(security interface{}) func(context.Context) (interface{}, error) { + return func(context.Context) (interface{}, error) { + return &security, nil + } +} + // WithSecurity configures the SDK to use the provided security details + func WithSecurity(security shared.Security) SDKOption { return func(sdk *CodatCommerce) { - sdk.sdkConfiguration.Security = &security + sdk.sdkConfiguration.Security = withSecurity(security) + } +} + +// WithSecuritySource configures the SDK to invoke the Security Source function on each method call to determine authentication +func WithSecuritySource(security func(context.Context) (shared.Security, error)) SDKOption { + return func(sdk *CodatCommerce) { + sdk.sdkConfiguration.Security = func(ctx context.Context) (interface{}, error) { + return security(ctx) + } } } @@ -148,8 +166,9 @@ func New(opts ...SDKOption) *CodatCommerce { sdkConfiguration: sdkConfiguration{ Language: "go", OpenAPIDocVersion: "3.0.0", - SDKVersion: "0.24.0", - GenVersion: "2.109.1", + SDKVersion: "0.25.0", + GenVersion: "2.159.2", + UserAgent: "speakeasy-sdk/go 0.25.0 2.159.2 3.0.0 github.com/codatio/client-sdk-go/previous-versions/commerce", }, } for _, opt := range opts { diff --git a/previous-versions/commerce/companyinfo.go b/previous-versions/commerce/companyinfo.go index fb8b68c80..bc2bc6a4c 100755 --- a/previous-versions/commerce/companyinfo.go +++ b/previous-versions/commerce/companyinfo.go @@ -1,6 +1,6 @@ // Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. -package codatcommerce +package commerce import ( "bytes" @@ -51,7 +51,7 @@ func (s *companyInfo) Get(ctx context.Context, request operations.GetCompanyInfo return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) client := s.sdkConfiguration.SecurityClient @@ -91,13 +91,6 @@ func (s *companyInfo) Get(ctx context.Context, request operations.GetCompanyInfo return nil, fmt.Errorf("error sending request: no response") } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") res := &operations.GetCompanyInfoResponse{ @@ -105,16 +98,23 @@ func (s *companyInfo) Get(ctx context.Context, request operations.GetCompanyInfo ContentType: contentType, RawResponse: httpRes, } + + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.CompanyInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.CompanyInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.CompanyInfo = out + res.CompanyInfo = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -127,12 +127,12 @@ func (s *companyInfo) Get(ctx context.Context, request operations.GetCompanyInfo case httpRes.StatusCode == 429: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ErrorMessage - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ErrorMessage + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ErrorMessage = out + res.ErrorMessage = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } diff --git a/previous-versions/commerce/customers.go b/previous-versions/commerce/customers.go index 4bd4d7015..9e62d8cb3 100755 --- a/previous-versions/commerce/customers.go +++ b/previous-versions/commerce/customers.go @@ -1,6 +1,6 @@ // Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. -package codatcommerce +package commerce import ( "bytes" @@ -55,7 +55,7 @@ func (s *customers) Get(ctx context.Context, request operations.GetCustomerReque return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) client := s.sdkConfiguration.SecurityClient @@ -95,13 +95,6 @@ func (s *customers) Get(ctx context.Context, request operations.GetCustomerReque return nil, fmt.Errorf("error sending request: no response") } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") res := &operations.GetCustomerResponse{ @@ -109,16 +102,23 @@ func (s *customers) Get(ctx context.Context, request operations.GetCustomerReque ContentType: contentType, RawResponse: httpRes, } + + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.Customer - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.Customer + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.Customer = out + res.Customer = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -131,12 +131,12 @@ func (s *customers) Get(ctx context.Context, request operations.GetCustomerReque case httpRes.StatusCode == 429: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ErrorMessage - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ErrorMessage + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ErrorMessage = out + res.ErrorMessage = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -173,7 +173,7 @@ func (s *customers) List(ctx context.Context, request operations.ListCustomersRe return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) @@ -217,13 +217,6 @@ func (s *customers) List(ctx context.Context, request operations.ListCustomersRe return nil, fmt.Errorf("error sending request: no response") } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") res := &operations.ListCustomersResponse{ @@ -231,16 +224,23 @@ func (s *customers) List(ctx context.Context, request operations.ListCustomersRe ContentType: contentType, RawResponse: httpRes, } + + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.Customers - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.Customers + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.Customers = out + res.Customers = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -255,12 +255,12 @@ func (s *customers) List(ctx context.Context, request operations.ListCustomersRe case httpRes.StatusCode == 429: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ErrorMessage - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ErrorMessage + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ErrorMessage = out + res.ErrorMessage = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } diff --git a/previous-versions/commerce/disputes.go b/previous-versions/commerce/disputes.go index 0bfc19492..9e30b9ec3 100755 --- a/previous-versions/commerce/disputes.go +++ b/previous-versions/commerce/disputes.go @@ -1,6 +1,6 @@ // Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. -package codatcommerce +package commerce import ( "bytes" @@ -55,7 +55,7 @@ func (s *disputes) Get(ctx context.Context, request operations.GetDisputeRequest return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) client := s.sdkConfiguration.SecurityClient @@ -95,13 +95,6 @@ func (s *disputes) Get(ctx context.Context, request operations.GetDisputeRequest return nil, fmt.Errorf("error sending request: no response") } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") res := &operations.GetDisputeResponse{ @@ -109,16 +102,23 @@ func (s *disputes) Get(ctx context.Context, request operations.GetDisputeRequest ContentType: contentType, RawResponse: httpRes, } + + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.Dispute - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.Dispute + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.Dispute = out + res.Dispute = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -131,12 +131,12 @@ func (s *disputes) Get(ctx context.Context, request operations.GetDisputeRequest case httpRes.StatusCode == 429: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ErrorMessage - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ErrorMessage + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ErrorMessage = out + res.ErrorMessage = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -173,7 +173,7 @@ func (s *disputes) List(ctx context.Context, request operations.ListDisputesRequ return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) @@ -217,13 +217,6 @@ func (s *disputes) List(ctx context.Context, request operations.ListDisputesRequ return nil, fmt.Errorf("error sending request: no response") } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") res := &operations.ListDisputesResponse{ @@ -231,16 +224,23 @@ func (s *disputes) List(ctx context.Context, request operations.ListDisputesRequ ContentType: contentType, RawResponse: httpRes, } + + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.Disputes - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.Disputes + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.Disputes = out + res.Disputes = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -255,12 +255,12 @@ func (s *disputes) List(ctx context.Context, request operations.ListDisputesRequ case httpRes.StatusCode == 429: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ErrorMessage - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ErrorMessage + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ErrorMessage = out + res.ErrorMessage = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } diff --git a/previous-versions/commerce/docs/models/operations/getcompanyinforequest.md b/previous-versions/commerce/docs/models/operations/getcompanyinforequest.md index 2a31ace99..992d72041 100755 --- a/previous-versions/commerce/docs/models/operations/getcompanyinforequest.md +++ b/previous-versions/commerce/docs/models/operations/getcompanyinforequest.md @@ -5,5 +5,5 @@ | Field | Type | Required | Description | Example | | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `CompanyID` | *string* | :heavy_check_mark: | N/A | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `ConnectionID` | *string* | :heavy_check_mark: | N/A | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | \ No newline at end of file +| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `ConnectionID` | *string* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/operations/getcompanyinforesponse.md b/previous-versions/commerce/docs/models/operations/getcompanyinforesponse.md index 49577e3d7..20743421f 100755 --- a/previous-versions/commerce/docs/models/operations/getcompanyinforesponse.md +++ b/previous-versions/commerce/docs/models/operations/getcompanyinforesponse.md @@ -6,7 +6,7 @@ | Field | Type | Required | Description | | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | | `CompanyInfo` | [*shared.CompanyInfo](../../models/shared/companyinfo.md) | :heavy_minus_sign: | OK | -| `ContentType` | *string* | :heavy_check_mark: | N/A | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | `ErrorMessage` | [*shared.ErrorMessage](../../models/shared/errormessage.md) | :heavy_minus_sign: | Your API request was not properly authorized. | -| `StatusCode` | *int* | :heavy_check_mark: | N/A | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | N/A | \ No newline at end of file +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/operations/getcustomerrequest.md b/previous-versions/commerce/docs/models/operations/getcustomerrequest.md index 7679c44f3..d79ea6c87 100755 --- a/previous-versions/commerce/docs/models/operations/getcustomerrequest.md +++ b/previous-versions/commerce/docs/models/operations/getcustomerrequest.md @@ -5,6 +5,6 @@ | Field | Type | Required | Description | Example | | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `CompanyID` | *string* | :heavy_check_mark: | N/A | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `ConnectionID` | *string* | :heavy_check_mark: | N/A | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `ConnectionID` | *string* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | | `CustomerID` | *string* | :heavy_check_mark: | Unique identifier for a customer. | | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/operations/getcustomerresponse.md b/previous-versions/commerce/docs/models/operations/getcustomerresponse.md index a06d4dd34..d5077ce05 100755 --- a/previous-versions/commerce/docs/models/operations/getcustomerresponse.md +++ b/previous-versions/commerce/docs/models/operations/getcustomerresponse.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | N/A | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | `Customer` | [*shared.Customer](../../models/shared/customer.md) | :heavy_minus_sign: | OK | | `ErrorMessage` | [*shared.ErrorMessage](../../models/shared/errormessage.md) | :heavy_minus_sign: | Your API request was not properly authorized. | -| `StatusCode` | *int* | :heavy_check_mark: | N/A | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | N/A | \ No newline at end of file +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/operations/getdisputerequest.md b/previous-versions/commerce/docs/models/operations/getdisputerequest.md index 6d1dbce32..0a12200a1 100755 --- a/previous-versions/commerce/docs/models/operations/getdisputerequest.md +++ b/previous-versions/commerce/docs/models/operations/getdisputerequest.md @@ -5,6 +5,6 @@ | Field | Type | Required | Description | Example | | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `CompanyID` | *string* | :heavy_check_mark: | N/A | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `ConnectionID` | *string* | :heavy_check_mark: | N/A | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `ConnectionID` | *string* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | | `DisputeID` | *string* | :heavy_check_mark: | Unique identifier for a dispute. | | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/operations/getdisputeresponse.md b/previous-versions/commerce/docs/models/operations/getdisputeresponse.md index 84c0aa487..2c815a251 100755 --- a/previous-versions/commerce/docs/models/operations/getdisputeresponse.md +++ b/previous-versions/commerce/docs/models/operations/getdisputeresponse.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | N/A | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | `Dispute` | [*shared.Dispute](../../models/shared/dispute.md) | :heavy_minus_sign: | OK | | `ErrorMessage` | [*shared.ErrorMessage](../../models/shared/errormessage.md) | :heavy_minus_sign: | Your API request was not properly authorized. | -| `StatusCode` | *int* | :heavy_check_mark: | N/A | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | N/A | \ No newline at end of file +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/operations/getlocationrequest.md b/previous-versions/commerce/docs/models/operations/getlocationrequest.md index de43b276a..38be8d5ac 100755 --- a/previous-versions/commerce/docs/models/operations/getlocationrequest.md +++ b/previous-versions/commerce/docs/models/operations/getlocationrequest.md @@ -5,6 +5,6 @@ | Field | Type | Required | Description | Example | | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `CompanyID` | *string* | :heavy_check_mark: | N/A | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `ConnectionID` | *string* | :heavy_check_mark: | N/A | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `ConnectionID` | *string* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | | `LocationID` | *string* | :heavy_check_mark: | Unique identifier for a location. | | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/operations/getlocationresponse.md b/previous-versions/commerce/docs/models/operations/getlocationresponse.md index f9168bf4b..ae50e02df 100755 --- a/previous-versions/commerce/docs/models/operations/getlocationresponse.md +++ b/previous-versions/commerce/docs/models/operations/getlocationresponse.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | N/A | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | `ErrorMessage` | [*shared.ErrorMessage](../../models/shared/errormessage.md) | :heavy_minus_sign: | Your API request was not properly authorized. | | `Location` | [*shared.Location](../../models/shared/location.md) | :heavy_minus_sign: | OK | -| `StatusCode` | *int* | :heavy_check_mark: | N/A | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | N/A | \ No newline at end of file +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/operations/getorderrequest.md b/previous-versions/commerce/docs/models/operations/getorderrequest.md index a0c1dcca4..78f97f588 100755 --- a/previous-versions/commerce/docs/models/operations/getorderrequest.md +++ b/previous-versions/commerce/docs/models/operations/getorderrequest.md @@ -5,6 +5,6 @@ | Field | Type | Required | Description | Example | | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `CompanyID` | *string* | :heavy_check_mark: | N/A | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `ConnectionID` | *string* | :heavy_check_mark: | N/A | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `ConnectionID` | *string* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | | `OrderID` | *string* | :heavy_check_mark: | Unique identifier for an order. | | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/operations/getorderresponse.md b/previous-versions/commerce/docs/models/operations/getorderresponse.md index 2c8fe9f4b..9c93e8e37 100755 --- a/previous-versions/commerce/docs/models/operations/getorderresponse.md +++ b/previous-versions/commerce/docs/models/operations/getorderresponse.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | N/A | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | `ErrorMessage` | [*shared.ErrorMessage](../../models/shared/errormessage.md) | :heavy_minus_sign: | Your API request was not properly authorized. | | `Order` | [*shared.Order](../../models/shared/order.md) | :heavy_minus_sign: | OK | -| `StatusCode` | *int* | :heavy_check_mark: | N/A | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | N/A | \ No newline at end of file +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/operations/getpaymentmethodrequest.md b/previous-versions/commerce/docs/models/operations/getpaymentmethodrequest.md index efa851288..6f4a54dd0 100755 --- a/previous-versions/commerce/docs/models/operations/getpaymentmethodrequest.md +++ b/previous-versions/commerce/docs/models/operations/getpaymentmethodrequest.md @@ -5,6 +5,6 @@ | Field | Type | Required | Description | Example | | --------------------------------------- | --------------------------------------- | --------------------------------------- | --------------------------------------- | --------------------------------------- | -| `CompanyID` | *string* | :heavy_check_mark: | N/A | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `ConnectionID` | *string* | :heavy_check_mark: | N/A | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `ConnectionID` | *string* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | | `PaymentMethodID` | *string* | :heavy_check_mark: | Unique identifier for a payment method. | | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/operations/getpaymentmethodresponse.md b/previous-versions/commerce/docs/models/operations/getpaymentmethodresponse.md index a69900ed5..c50bb4553 100755 --- a/previous-versions/commerce/docs/models/operations/getpaymentmethodresponse.md +++ b/previous-versions/commerce/docs/models/operations/getpaymentmethodresponse.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | N/A | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | `ErrorMessage` | [*shared.ErrorMessage](../../models/shared/errormessage.md) | :heavy_minus_sign: | Your API request was not properly authorized. | | `PaymentMethod` | [*shared.PaymentMethod](../../models/shared/paymentmethod.md) | :heavy_minus_sign: | OK | -| `StatusCode` | *int* | :heavy_check_mark: | N/A | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | N/A | \ No newline at end of file +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/operations/getpaymentrequest.md b/previous-versions/commerce/docs/models/operations/getpaymentrequest.md index 3e487fb06..ca855f08a 100755 --- a/previous-versions/commerce/docs/models/operations/getpaymentrequest.md +++ b/previous-versions/commerce/docs/models/operations/getpaymentrequest.md @@ -5,6 +5,6 @@ | Field | Type | Required | Description | Example | | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `CompanyID` | *string* | :heavy_check_mark: | N/A | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `ConnectionID` | *string* | :heavy_check_mark: | N/A | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `ConnectionID` | *string* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | | `PaymentID` | *string* | :heavy_check_mark: | Unique identifier for a payment. | | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/operations/getpaymentresponse.md b/previous-versions/commerce/docs/models/operations/getpaymentresponse.md index 331eaa121..398f05a64 100755 --- a/previous-versions/commerce/docs/models/operations/getpaymentresponse.md +++ b/previous-versions/commerce/docs/models/operations/getpaymentresponse.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | N/A | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | `ErrorMessage` | [*shared.ErrorMessage](../../models/shared/errormessage.md) | :heavy_minus_sign: | Your API request was not properly authorized. | | `Payment` | [*shared.Payment](../../models/shared/payment.md) | :heavy_minus_sign: | OK | -| `StatusCode` | *int* | :heavy_check_mark: | N/A | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | N/A | \ No newline at end of file +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/operations/getproductcategoryrequest.md b/previous-versions/commerce/docs/models/operations/getproductcategoryrequest.md index 8ab683db2..5566978b0 100755 --- a/previous-versions/commerce/docs/models/operations/getproductcategoryrequest.md +++ b/previous-versions/commerce/docs/models/operations/getproductcategoryrequest.md @@ -5,6 +5,6 @@ | Field | Type | Required | Description | Example | | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `CompanyID` | *string* | :heavy_check_mark: | N/A | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `ConnectionID` | *string* | :heavy_check_mark: | N/A | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `ConnectionID` | *string* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | | `ProductID` | *string* | :heavy_check_mark: | Unique identifier for a product. | | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/operations/getproductcategoryresponse.md b/previous-versions/commerce/docs/models/operations/getproductcategoryresponse.md index 2fe570356..9338e6e90 100755 --- a/previous-versions/commerce/docs/models/operations/getproductcategoryresponse.md +++ b/previous-versions/commerce/docs/models/operations/getproductcategoryresponse.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | N/A | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | `ErrorMessage` | [*shared.ErrorMessage](../../models/shared/errormessage.md) | :heavy_minus_sign: | Your API request was not properly authorized. | | `ProductCategory` | [*shared.ProductCategory](../../models/shared/productcategory.md) | :heavy_minus_sign: | OK | -| `StatusCode` | *int* | :heavy_check_mark: | N/A | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | N/A | \ No newline at end of file +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/operations/getproductrequest.md b/previous-versions/commerce/docs/models/operations/getproductrequest.md index a58528b3c..668d9928d 100755 --- a/previous-versions/commerce/docs/models/operations/getproductrequest.md +++ b/previous-versions/commerce/docs/models/operations/getproductrequest.md @@ -5,6 +5,6 @@ | Field | Type | Required | Description | Example | | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `CompanyID` | *string* | :heavy_check_mark: | N/A | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `ConnectionID` | *string* | :heavy_check_mark: | N/A | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `ConnectionID` | *string* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | | `ProductID` | *string* | :heavy_check_mark: | Unique identifier for a product. | | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/operations/getproductresponse.md b/previous-versions/commerce/docs/models/operations/getproductresponse.md index 7fdc8da67..83049751f 100755 --- a/previous-versions/commerce/docs/models/operations/getproductresponse.md +++ b/previous-versions/commerce/docs/models/operations/getproductresponse.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | N/A | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | `ErrorMessage` | [*shared.ErrorMessage](../../models/shared/errormessage.md) | :heavy_minus_sign: | Your API request was not properly authorized. | | `Product` | [*shared.Product](../../models/shared/product.md) | :heavy_minus_sign: | OK | -| `StatusCode` | *int* | :heavy_check_mark: | N/A | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | N/A | \ No newline at end of file +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/operations/gettaxcomponentrequest.md b/previous-versions/commerce/docs/models/operations/gettaxcomponentrequest.md index fcc571259..5bccd1b7b 100755 --- a/previous-versions/commerce/docs/models/operations/gettaxcomponentrequest.md +++ b/previous-versions/commerce/docs/models/operations/gettaxcomponentrequest.md @@ -5,6 +5,6 @@ | Field | Type | Required | Description | Example | | -------------------------------------- | -------------------------------------- | -------------------------------------- | -------------------------------------- | -------------------------------------- | -| `CompanyID` | *string* | :heavy_check_mark: | N/A | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `ConnectionID` | *string* | :heavy_check_mark: | N/A | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `ConnectionID` | *string* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | | `TaxID` | *string* | :heavy_check_mark: | Unique identifier for a tax component. | | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/operations/gettaxcomponentresponse.md b/previous-versions/commerce/docs/models/operations/gettaxcomponentresponse.md index ce6560ea5..e717062ef 100755 --- a/previous-versions/commerce/docs/models/operations/gettaxcomponentresponse.md +++ b/previous-versions/commerce/docs/models/operations/gettaxcomponentresponse.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | N/A | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | `ErrorMessage` | [*shared.ErrorMessage](../../models/shared/errormessage.md) | :heavy_minus_sign: | Your API request was not properly authorized. | -| `StatusCode` | *int* | :heavy_check_mark: | N/A | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | N/A | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | | `TaxComponent` | [*shared.TaxComponent](../../models/shared/taxcomponent.md) | :heavy_minus_sign: | OK | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/operations/gettransactionrequest.md b/previous-versions/commerce/docs/models/operations/gettransactionrequest.md index 5673e0ceb..b29075334 100755 --- a/previous-versions/commerce/docs/models/operations/gettransactionrequest.md +++ b/previous-versions/commerce/docs/models/operations/gettransactionrequest.md @@ -5,6 +5,6 @@ | Field | Type | Required | Description | Example | | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `CompanyID` | *string* | :heavy_check_mark: | N/A | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `ConnectionID` | *string* | :heavy_check_mark: | N/A | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `ConnectionID` | *string* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | | `TransactionID` | *string* | :heavy_check_mark: | Unique identifier for a transaction. | | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/operations/gettransactionresponse.md b/previous-versions/commerce/docs/models/operations/gettransactionresponse.md index 71ab255d5..9c5ff6608 100755 --- a/previous-versions/commerce/docs/models/operations/gettransactionresponse.md +++ b/previous-versions/commerce/docs/models/operations/gettransactionresponse.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | N/A | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | `ErrorMessage` | [*shared.ErrorMessage](../../models/shared/errormessage.md) | :heavy_minus_sign: | Your API request was not properly authorized. | -| `StatusCode` | *int* | :heavy_check_mark: | N/A | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | N/A | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | | `Transaction` | [*shared.Transaction](../../models/shared/transaction.md) | :heavy_minus_sign: | OK | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/operations/listcustomersrequest.md b/previous-versions/commerce/docs/models/operations/listcustomersrequest.md index aa82020ee..b1f04f35f 100755 --- a/previous-versions/commerce/docs/models/operations/listcustomersrequest.md +++ b/previous-versions/commerce/docs/models/operations/listcustomersrequest.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | Example | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | -| `CompanyID` | *string* | :heavy_check_mark: | N/A | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `ConnectionID` | *string* | :heavy_check_mark: | N/A | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `ConnectionID` | *string* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | | `OrderBy` | **string* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | | `Page` | **int* | :heavy_minus_sign: | Page number. [Read more](https://docs.codat.io/using-the-api/paging). | 1 | | `PageSize` | **int* | :heavy_minus_sign: | Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). | 100 | diff --git a/previous-versions/commerce/docs/models/operations/listcustomersresponse.md b/previous-versions/commerce/docs/models/operations/listcustomersresponse.md index 3868b472c..255a9612f 100755 --- a/previous-versions/commerce/docs/models/operations/listcustomersresponse.md +++ b/previous-versions/commerce/docs/models/operations/listcustomersresponse.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | N/A | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | `Customers` | [*shared.Customers](../../models/shared/customers.md) | :heavy_minus_sign: | OK | | `ErrorMessage` | [*shared.ErrorMessage](../../models/shared/errormessage.md) | :heavy_minus_sign: | Your `query` parameter was not correctly formed | -| `StatusCode` | *int* | :heavy_check_mark: | N/A | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | N/A | \ No newline at end of file +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/operations/listdisputesrequest.md b/previous-versions/commerce/docs/models/operations/listdisputesrequest.md index 6397b4b0a..abc0d73e1 100755 --- a/previous-versions/commerce/docs/models/operations/listdisputesrequest.md +++ b/previous-versions/commerce/docs/models/operations/listdisputesrequest.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | Example | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | -| `CompanyID` | *string* | :heavy_check_mark: | N/A | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `ConnectionID` | *string* | :heavy_check_mark: | N/A | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `ConnectionID` | *string* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | | `OrderBy` | **string* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | | `Page` | **int* | :heavy_minus_sign: | Page number. [Read more](https://docs.codat.io/using-the-api/paging). | 1 | | `PageSize` | **int* | :heavy_minus_sign: | Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). | 100 | diff --git a/previous-versions/commerce/docs/models/operations/listdisputesresponse.md b/previous-versions/commerce/docs/models/operations/listdisputesresponse.md index c613cecdc..faeb70a95 100755 --- a/previous-versions/commerce/docs/models/operations/listdisputesresponse.md +++ b/previous-versions/commerce/docs/models/operations/listdisputesresponse.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | N/A | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | `Disputes` | [*shared.Disputes](../../models/shared/disputes.md) | :heavy_minus_sign: | OK | | `ErrorMessage` | [*shared.ErrorMessage](../../models/shared/errormessage.md) | :heavy_minus_sign: | Your `query` parameter was not correctly formed | -| `StatusCode` | *int* | :heavy_check_mark: | N/A | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | N/A | \ No newline at end of file +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/operations/listlocationsrequest.md b/previous-versions/commerce/docs/models/operations/listlocationsrequest.md index 8e92f1458..bac958017 100755 --- a/previous-versions/commerce/docs/models/operations/listlocationsrequest.md +++ b/previous-versions/commerce/docs/models/operations/listlocationsrequest.md @@ -5,5 +5,5 @@ | Field | Type | Required | Description | Example | | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `CompanyID` | *string* | :heavy_check_mark: | N/A | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `ConnectionID` | *string* | :heavy_check_mark: | N/A | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | \ No newline at end of file +| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `ConnectionID` | *string* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/operations/listlocationsresponse.md b/previous-versions/commerce/docs/models/operations/listlocationsresponse.md index 6bfcabfdd..e76e60657 100755 --- a/previous-versions/commerce/docs/models/operations/listlocationsresponse.md +++ b/previous-versions/commerce/docs/models/operations/listlocationsresponse.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | N/A | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | `ErrorMessage` | [*shared.ErrorMessage](../../models/shared/errormessage.md) | :heavy_minus_sign: | Your `query` parameter was not correctly formed | | `Locations` | [*shared.Locations](../../models/shared/locations.md) | :heavy_minus_sign: | OK | -| `StatusCode` | *int* | :heavy_check_mark: | N/A | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | N/A | \ No newline at end of file +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/operations/listordersrequest.md b/previous-versions/commerce/docs/models/operations/listordersrequest.md index 06eaaa0ea..79fd810d7 100755 --- a/previous-versions/commerce/docs/models/operations/listordersrequest.md +++ b/previous-versions/commerce/docs/models/operations/listordersrequest.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | Example | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | -| `CompanyID` | *string* | :heavy_check_mark: | N/A | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `ConnectionID` | *string* | :heavy_check_mark: | N/A | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `ConnectionID` | *string* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | | `OrderBy` | **string* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | | `Page` | **int* | :heavy_minus_sign: | Page number. [Read more](https://docs.codat.io/using-the-api/paging). | 1 | | `PageSize` | **int* | :heavy_minus_sign: | Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). | 100 | diff --git a/previous-versions/commerce/docs/models/operations/listordersresponse.md b/previous-versions/commerce/docs/models/operations/listordersresponse.md index 3cdcdc8ee..9745e2477 100755 --- a/previous-versions/commerce/docs/models/operations/listordersresponse.md +++ b/previous-versions/commerce/docs/models/operations/listordersresponse.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | N/A | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | `ErrorMessage` | [*shared.ErrorMessage](../../models/shared/errormessage.md) | :heavy_minus_sign: | Your `query` parameter was not correctly formed | | `Orders` | [*shared.Orders](../../models/shared/orders.md) | :heavy_minus_sign: | OK | -| `StatusCode` | *int* | :heavy_check_mark: | N/A | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | N/A | \ No newline at end of file +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/operations/listpaymentmethodsrequest.md b/previous-versions/commerce/docs/models/operations/listpaymentmethodsrequest.md index 7887859e8..b094c98e6 100755 --- a/previous-versions/commerce/docs/models/operations/listpaymentmethodsrequest.md +++ b/previous-versions/commerce/docs/models/operations/listpaymentmethodsrequest.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | Example | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | -| `CompanyID` | *string* | :heavy_check_mark: | N/A | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `ConnectionID` | *string* | :heavy_check_mark: | N/A | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `ConnectionID` | *string* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | | `OrderBy` | **string* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | | `Page` | **int* | :heavy_minus_sign: | Page number. [Read more](https://docs.codat.io/using-the-api/paging). | 1 | | `PageSize` | **int* | :heavy_minus_sign: | Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). | 100 | diff --git a/previous-versions/commerce/docs/models/operations/listpaymentmethodsresponse.md b/previous-versions/commerce/docs/models/operations/listpaymentmethodsresponse.md index 734c604ff..b8ddc89e7 100755 --- a/previous-versions/commerce/docs/models/operations/listpaymentmethodsresponse.md +++ b/previous-versions/commerce/docs/models/operations/listpaymentmethodsresponse.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | N/A | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | `ErrorMessage` | [*shared.ErrorMessage](../../models/shared/errormessage.md) | :heavy_minus_sign: | Your `query` parameter was not correctly formed | | `PaymentMethods` | [*shared.PaymentMethods](../../models/shared/paymentmethods.md) | :heavy_minus_sign: | OK | -| `StatusCode` | *int* | :heavy_check_mark: | N/A | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | N/A | \ No newline at end of file +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/operations/listpaymentsrequest.md b/previous-versions/commerce/docs/models/operations/listpaymentsrequest.md index 2840ce481..e2273e421 100755 --- a/previous-versions/commerce/docs/models/operations/listpaymentsrequest.md +++ b/previous-versions/commerce/docs/models/operations/listpaymentsrequest.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | Example | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | -| `CompanyID` | *string* | :heavy_check_mark: | N/A | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `ConnectionID` | *string* | :heavy_check_mark: | N/A | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `ConnectionID` | *string* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | | `OrderBy` | **string* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | | `Page` | **int* | :heavy_minus_sign: | Page number. [Read more](https://docs.codat.io/using-the-api/paging). | 1 | | `PageSize` | **int* | :heavy_minus_sign: | Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). | 100 | diff --git a/previous-versions/commerce/docs/models/operations/listpaymentsresponse.md b/previous-versions/commerce/docs/models/operations/listpaymentsresponse.md index 9f74e8265..25de2f8d2 100755 --- a/previous-versions/commerce/docs/models/operations/listpaymentsresponse.md +++ b/previous-versions/commerce/docs/models/operations/listpaymentsresponse.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | N/A | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | `ErrorMessage` | [*shared.ErrorMessage](../../models/shared/errormessage.md) | :heavy_minus_sign: | Your `query` parameter was not correctly formed | | `Payments` | [*shared.Payments](../../models/shared/payments.md) | :heavy_minus_sign: | OK | -| `StatusCode` | *int* | :heavy_check_mark: | N/A | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | N/A | \ No newline at end of file +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/operations/listproductcategoriesrequest.md b/previous-versions/commerce/docs/models/operations/listproductcategoriesrequest.md index 8ccad7b68..55c2a6243 100755 --- a/previous-versions/commerce/docs/models/operations/listproductcategoriesrequest.md +++ b/previous-versions/commerce/docs/models/operations/listproductcategoriesrequest.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | Example | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | -| `CompanyID` | *string* | :heavy_check_mark: | N/A | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `ConnectionID` | *string* | :heavy_check_mark: | N/A | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `ConnectionID` | *string* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | | `OrderBy` | **string* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | | `Page` | **int* | :heavy_minus_sign: | Page number. [Read more](https://docs.codat.io/using-the-api/paging). | 1 | | `PageSize` | **int* | :heavy_minus_sign: | Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). | 100 | diff --git a/previous-versions/commerce/docs/models/operations/listproductcategoriesresponse.md b/previous-versions/commerce/docs/models/operations/listproductcategoriesresponse.md index cf943006d..70515f9fd 100755 --- a/previous-versions/commerce/docs/models/operations/listproductcategoriesresponse.md +++ b/previous-versions/commerce/docs/models/operations/listproductcategoriesresponse.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | N/A | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | `ErrorMessage` | [*shared.ErrorMessage](../../models/shared/errormessage.md) | :heavy_minus_sign: | Your `query` parameter was not correctly formed | | `ProductCategories` | [*shared.ProductCategories](../../models/shared/productcategories.md) | :heavy_minus_sign: | OK | -| `StatusCode` | *int* | :heavy_check_mark: | N/A | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | N/A | \ No newline at end of file +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/operations/listproductsrequest.md b/previous-versions/commerce/docs/models/operations/listproductsrequest.md index 60614a51c..f0a0d65af 100755 --- a/previous-versions/commerce/docs/models/operations/listproductsrequest.md +++ b/previous-versions/commerce/docs/models/operations/listproductsrequest.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | Example | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | -| `CompanyID` | *string* | :heavy_check_mark: | N/A | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `ConnectionID` | *string* | :heavy_check_mark: | N/A | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `ConnectionID` | *string* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | | `OrderBy` | **string* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | | `Page` | **int* | :heavy_minus_sign: | Page number. [Read more](https://docs.codat.io/using-the-api/paging). | 1 | | `PageSize` | **int* | :heavy_minus_sign: | Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). | 100 | diff --git a/previous-versions/commerce/docs/models/operations/listproductsresponse.md b/previous-versions/commerce/docs/models/operations/listproductsresponse.md index f07ce5753..dd9f78e1d 100755 --- a/previous-versions/commerce/docs/models/operations/listproductsresponse.md +++ b/previous-versions/commerce/docs/models/operations/listproductsresponse.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | N/A | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | `ErrorMessage` | [*shared.ErrorMessage](../../models/shared/errormessage.md) | :heavy_minus_sign: | Your `query` parameter was not correctly formed | | `Products` | [*shared.Products](../../models/shared/products.md) | :heavy_minus_sign: | OK | -| `StatusCode` | *int* | :heavy_check_mark: | N/A | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | N/A | \ No newline at end of file +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/operations/listtaxcomponentsrequest.md b/previous-versions/commerce/docs/models/operations/listtaxcomponentsrequest.md index 9ca7930d5..af1dc0d12 100755 --- a/previous-versions/commerce/docs/models/operations/listtaxcomponentsrequest.md +++ b/previous-versions/commerce/docs/models/operations/listtaxcomponentsrequest.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | Example | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | -| `CompanyID` | *string* | :heavy_check_mark: | N/A | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `ConnectionID` | *string* | :heavy_check_mark: | N/A | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `ConnectionID` | *string* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | | `OrderBy` | **string* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | | `Page` | **int* | :heavy_minus_sign: | Page number. [Read more](https://docs.codat.io/using-the-api/paging). | 1 | | `PageSize` | **int* | :heavy_minus_sign: | Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). | 100 | diff --git a/previous-versions/commerce/docs/models/operations/listtaxcomponentsresponse.md b/previous-versions/commerce/docs/models/operations/listtaxcomponentsresponse.md index 6f934c65c..3ccd76105 100755 --- a/previous-versions/commerce/docs/models/operations/listtaxcomponentsresponse.md +++ b/previous-versions/commerce/docs/models/operations/listtaxcomponentsresponse.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | N/A | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | `ErrorMessage` | [*shared.ErrorMessage](../../models/shared/errormessage.md) | :heavy_minus_sign: | Your `query` parameter was not correctly formed | -| `StatusCode` | *int* | :heavy_check_mark: | N/A | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | N/A | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | | `TaxComponents` | [*shared.TaxComponents](../../models/shared/taxcomponents.md) | :heavy_minus_sign: | OK | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/operations/listtransactionsrequest.md b/previous-versions/commerce/docs/models/operations/listtransactionsrequest.md index 716b97432..7b63d5f48 100755 --- a/previous-versions/commerce/docs/models/operations/listtransactionsrequest.md +++ b/previous-versions/commerce/docs/models/operations/listtransactionsrequest.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | Example | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | -| `CompanyID` | *string* | :heavy_check_mark: | N/A | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `ConnectionID` | *string* | :heavy_check_mark: | N/A | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `ConnectionID` | *string* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | | `OrderBy` | **string* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | | `Page` | **int* | :heavy_minus_sign: | Page number. [Read more](https://docs.codat.io/using-the-api/paging). | 1 | | `PageSize` | **int* | :heavy_minus_sign: | Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). | 100 | diff --git a/previous-versions/commerce/docs/models/operations/listtransactionsresponse.md b/previous-versions/commerce/docs/models/operations/listtransactionsresponse.md index b99a2d09e..1b4b32100 100755 --- a/previous-versions/commerce/docs/models/operations/listtransactionsresponse.md +++ b/previous-versions/commerce/docs/models/operations/listtransactionsresponse.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | N/A | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | `ErrorMessage` | [*shared.ErrorMessage](../../models/shared/errormessage.md) | :heavy_minus_sign: | Your `query` parameter was not correctly formed | -| `StatusCode` | *int* | :heavy_check_mark: | N/A | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | N/A | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | | `Transactions` | [*shared.Transactions](../../models/shared/transactions.md) | :heavy_minus_sign: | OK | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/accountbalance.md b/previous-versions/commerce/docs/models/shared/accountbalance.md index 40649580e..afe626e0e 100755 --- a/previous-versions/commerce/docs/models/shared/accountbalance.md +++ b/previous-versions/commerce/docs/models/shared/accountbalance.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | -| `Available` | **types.Decimal* | :heavy_minus_sign: | The account's current balance | | -| `Currency` | **string* | :heavy_minus_sign: | The currency of the account | GBP | -| `Pending` | **types.Decimal* | :heavy_minus_sign: | Funds that are not yet available in the balance | | -| `Reserved` | *interface{}* | :heavy_minus_sign: | Funds reserved as holdings | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | +| `Available` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | The account's current balance | | +| `Currency` | **string* | :heavy_minus_sign: | The currency of the account | GBP | +| `Pending` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Funds that are not yet available in the balance | | +| `Reserved` | *interface{}* | :heavy_minus_sign: | Funds reserved as holdings | | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/companyinfo.md b/previous-versions/commerce/docs/models/shared/companyinfo.md index fa198b91f..67716abf3 100755 --- a/previous-versions/commerce/docs/models/shared/companyinfo.md +++ b/previous-versions/commerce/docs/models/shared/companyinfo.md @@ -22,5 +22,5 @@ Explore our [data coverage](https://knowledge.codat.io/supported-features/commer | `PhoneNumbers` | [][PhoneNumber](../../models/shared/phonenumber.md) | :heavy_minus_sign: | Phone numbers associated with the company | | | `RegistrationNumber` | **string* | :heavy_minus_sign: | The registration number of the company | 10480375 | | `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23T00:00:00.000Z | -| `SourceUrls` | map[string]*string* | :heavy_minus_sign: | URL addresses for the originating system. For example, potential use cases include 'deeplinking' to the originating system | | -| `WebLinks` | [][CompanyInfoWeblink](../../models/shared/companyinfoweblink.md) | :heavy_minus_sign: | Weblinks associated with the company | | \ No newline at end of file +| `SourceUrls` | map[string]*string* | :heavy_minus_sign: | URL addresses for the originating system. For example, potential use cases include 'deeplinking' to the originating system | [object Object] | +| `WebLinks` | [][CompanyInfoWeblink](../../models/shared/companyinfoweblink.md) | :heavy_minus_sign: | Weblinks associated with the company | [object Object] | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/customers.md b/previous-versions/commerce/docs/models/shared/customers.md index 6eede4ddd..d088c42ba 100755 --- a/previous-versions/commerce/docs/models/shared/customers.md +++ b/previous-versions/commerce/docs/models/shared/customers.md @@ -6,7 +6,7 @@ | Field | Type | Required | Description | | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | | `Links` | [Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | -| `PageNumber` | *int64* | :heavy_check_mark: | N/A | -| `PageSize` | *int64* | :heavy_check_mark: | N/A | +| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | +| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | | `Results` | [][Customer](../../models/shared/customer.md) | :heavy_minus_sign: | N/A | -| `TotalResults` | *int64* | :heavy_check_mark: | N/A | \ No newline at end of file +| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/dispute.md b/previous-versions/commerce/docs/models/shared/dispute.md index c77cbaff0..c496c7271 100755 --- a/previous-versions/commerce/docs/models/shared/dispute.md +++ b/previous-versions/commerce/docs/models/shared/dispute.md @@ -23,4 +23,4 @@ Explore our [data coverage](https://knowledge.codat.io/supported-features/commer | `Reason` | **string* | :heavy_minus_sign: | Reason for the dispute | Unhappy with product | | `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23T00:00:00.000Z | | `Status` | [*DisputeStatus](../../models/shared/disputestatus.md) | :heavy_minus_sign: | Current status of the dispute | EvidenceRequired | -| `TotalAmount` | *interface{}* | :heavy_minus_sign: | Total transaction amount that is under dispute. | | \ No newline at end of file +| `TotalAmount` | *interface{}* | :heavy_minus_sign: | Total transaction amount that is under dispute. | 194.12 | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/disputes.md b/previous-versions/commerce/docs/models/shared/disputes.md index 2fc5de96c..cecada84e 100755 --- a/previous-versions/commerce/docs/models/shared/disputes.md +++ b/previous-versions/commerce/docs/models/shared/disputes.md @@ -6,7 +6,7 @@ | Field | Type | Required | Description | | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | | `Links` | [Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | -| `PageNumber` | *int64* | :heavy_check_mark: | N/A | -| `PageSize` | *int64* | :heavy_check_mark: | N/A | +| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | +| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | | `Results` | [][Dispute](../../models/shared/dispute.md) | :heavy_minus_sign: | N/A | -| `TotalResults` | *int64* | :heavy_check_mark: | N/A | \ No newline at end of file +| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/errormessage.md b/previous-versions/commerce/docs/models/shared/errormessage.md index 5563c6b27..a9ae779b4 100755 --- a/previous-versions/commerce/docs/models/shared/errormessage.md +++ b/previous-versions/commerce/docs/models/shared/errormessage.md @@ -3,11 +3,11 @@ ## Fields -| Field | Type | Required | Description | -| ------------------- | ------------------- | ------------------- | ------------------- | -| `CanBeRetried` | **string* | :heavy_minus_sign: | N/A | -| `CorrelationID` | **string* | :heavy_minus_sign: | N/A | -| `DetailedErrorCode` | **int64* | :heavy_minus_sign: | N/A | -| `Error` | **string* | :heavy_minus_sign: | N/A | -| `Service` | **string* | :heavy_minus_sign: | N/A | -| `StatusCode` | **int64* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | +| `CanBeRetried` | **string* | :heavy_minus_sign: | `True` if the error occurred transiently and can be retried. | +| `CorrelationID` | **string* | :heavy_minus_sign: | Unique identifier used to propagate to all downstream services and determine the source of the error. | +| `DetailedErrorCode` | **int64* | :heavy_minus_sign: | Machine readable error code used to automate processes based on the code returned. | +| `Error` | **string* | :heavy_minus_sign: | A brief description of the error. | +| `Service` | **string* | :heavy_minus_sign: | Codat's service the returned the error. | +| `StatusCode` | **int64* | :heavy_minus_sign: | The HTTP status code returned by the error. | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/halref.md b/previous-versions/commerce/docs/models/shared/halref.md index 65e9997de..0d0bfe8ef 100755 --- a/previous-versions/commerce/docs/models/shared/halref.md +++ b/previous-versions/commerce/docs/models/shared/halref.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `Href` | **string* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------ | ------------------------ | ------------------------ | ------------------------ | +| `Href` | **string* | :heavy_minus_sign: | Uri hypertext reference. | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/locations.md b/previous-versions/commerce/docs/models/shared/locations.md index f6b3e31d9..a52f739ac 100755 --- a/previous-versions/commerce/docs/models/shared/locations.md +++ b/previous-versions/commerce/docs/models/shared/locations.md @@ -6,7 +6,7 @@ | Field | Type | Required | Description | | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | | `Links` | [Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | -| `PageNumber` | *int64* | :heavy_check_mark: | N/A | -| `PageSize` | *int64* | :heavy_check_mark: | N/A | +| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | +| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | | `Results` | [][Location](../../models/shared/location.md) | :heavy_minus_sign: | N/A | -| `TotalResults` | *int64* | :heavy_check_mark: | N/A | \ No newline at end of file +| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/order.md b/previous-versions/commerce/docs/models/shared/order.md index 311d467ad..9c1c6d3fb 100755 --- a/previous-versions/commerce/docs/models/shared/order.md +++ b/previous-versions/commerce/docs/models/shared/order.md @@ -23,9 +23,9 @@ Explore our [data coverage](https://knowledge.codat.io/supported-features/commer | `Payments` | [][PaymentRef](../../models/shared/paymentref.md) | :heavy_minus_sign: | N/A | | | `ServiceCharges` | [][ServiceCharge](../../models/shared/servicecharge.md) | :heavy_minus_sign: | N/A | | | `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23T00:00:00.000Z | -| `SupplementalData` | [*OrderSupplementalData](../../models/shared/ordersupplementaldata.md) | :heavy_minus_sign: | Supplemental data is additional data you can include in our standard data types.

It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. | | -| `TotalAmount` | **types.Decimal* | :heavy_minus_sign: | Total amount of the order, including tax, net of any discounts and refunds. | | -| `TotalDiscount` | **types.Decimal* | :heavy_minus_sign: | Total amount of discount applied to the order. | | -| `TotalGratuity` | **types.Decimal* | :heavy_minus_sign: | Extra amount added to a bill. | | -| `TotalRefund` | **types.Decimal* | :heavy_minus_sign: | Total amount refunded issued by a merchant on an order (always a negative value). | | -| `TotalTaxAmount` | **types.Decimal* | :heavy_minus_sign: | Total amount of tax applied to the order. | | \ No newline at end of file +| `SupplementalData` | [*SupplementalData](../../models/shared/supplementaldata.md) | :heavy_minus_sign: | Supplemental data is additional data you can include in our standard data types.

It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. | | +| `TotalAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Total amount of the order, including discounts, refunds, and tax, but excluding gratuities. | | +| `TotalDiscount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Total amount of any discounts applied to the order, excluding tax. This is typically positive (for discounts which decrease the amount of the order), but can also be negative (for discounts which increase the amount of the order). | | +| `TotalGratuity` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Extra amount added to the order. | | +| `TotalRefund` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Total amount of any refunds issued on the order, including discounts and tax, but excluding gratuities. This is always negative. | | +| `TotalTaxAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Total amount of tax applied to the order. | | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/orderdiscountallocation.md b/previous-versions/commerce/docs/models/shared/orderdiscountallocation.md index b46e1d494..2a8ade64d 100755 --- a/previous-versions/commerce/docs/models/shared/orderdiscountallocation.md +++ b/previous-versions/commerce/docs/models/shared/orderdiscountallocation.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | -| `Name` | **string* | :heavy_minus_sign: | Name of the discount in the commerce or point of sale platform. | Promotional Discount | -| `TotalAmount` | **types.Decimal* | :heavy_minus_sign: | Total amount of discount applied. | 15.25 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `Name` | **string* | :heavy_minus_sign: | Name of the discount in the commerce or point of sale platform. | Promotional Discount | +| `TotalAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Total amount of discount applied, excluding tax. This is typically positive (for discounts which decrease the amount of the order line), but can also be negative (for discounts which increase the amount of the order line). | 15.25 | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/orderlineitem.md b/previous-versions/commerce/docs/models/shared/orderlineitem.md index 27eb14a58..6a2606e6e 100755 --- a/previous-versions/commerce/docs/models/shared/orderlineitem.md +++ b/previous-versions/commerce/docs/models/shared/orderlineitem.md @@ -9,9 +9,9 @@ | `ID` | *string* | :heavy_check_mark: | A unique, persistent identifier for this record | 13d946f0-c5d5-42bc-b092-97ece17923ab | | `ProductRef` | [*ProductRef](../../models/shared/productref.md) | :heavy_minus_sign: | Reference that links the line item to the correct product details. | | | `ProductVariantRef` | [*ProductVariantRef](../../models/shared/productvariantref.md) | :heavy_minus_sign: | Reference that links the line item to the specific version of product that has been ordered. | | -| `Quantity` | **types.Decimal* | :heavy_minus_sign: | Number of units of the product sold.
For refunds, quantity is a negative value.
| | -| `TaxPercentage` | **types.Decimal* | :heavy_minus_sign: | Percentage rate (from 0 to 100) of any sale tax applied to the unit amount. | 0 | +| `Quantity` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Number of units of the product sold.
For refunds, quantity is negative.
| | +| `TaxPercentage` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Percentage rate (from 0 to 100) of any sales tax applied to the unit price. | 0 | | `Taxes` | [][TaxComponentAllocation](../../models/shared/taxcomponentallocation.md) | :heavy_minus_sign: | Taxes breakdown as applied to order lines. | | -| `TotalAmount` | **types.Decimal* | :heavy_minus_sign: | Total price of the line item, including discounts, tax and minus any refunds. | | -| `TotalTaxAmount` | **types.Decimal* | :heavy_minus_sign: | Total amount of tax applied to the line item. | | -| `UnitPrice` | **types.Decimal* | :heavy_minus_sign: | Price per unit of goods or service. | | \ No newline at end of file +| `TotalAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Total amount of the line item, including discounts and tax. | | +| `TotalTaxAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Total amount of tax applied to the line item, factoring in any discounts. | | +| `UnitPrice` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Price per unit of goods or services, excluding discounts and tax. | | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/orders.md b/previous-versions/commerce/docs/models/shared/orders.md index 6a0314228..3b091c23a 100755 --- a/previous-versions/commerce/docs/models/shared/orders.md +++ b/previous-versions/commerce/docs/models/shared/orders.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| --------------------------------------- | --------------------------------------- | --------------------------------------- | --------------------------------------- | -| `Links` | [Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | -| `PageNumber` | *int64* | :heavy_check_mark: | N/A | -| `PageSize` | *int64* | :heavy_check_mark: | N/A | -| `Results` | [][Order](../../models/shared/order.md) | :heavy_minus_sign: | N/A | -| `TotalResults` | *int64* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | +| `Links` | [Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | +| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | +| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | +| `Results` | [][Order](../../models/shared/order.md) | :heavy_minus_sign: | N/A | +| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/payment.md b/previous-versions/commerce/docs/models/shared/payment.md index 8686c3947..7dd34a9af 100755 --- a/previous-versions/commerce/docs/models/shared/payment.md +++ b/previous-versions/commerce/docs/models/shared/payment.md @@ -13,13 +13,14 @@ Explore our [data coverage](https://knowledge.codat.io/supported-features/commer | Field | Type | Required | Description | Example | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Amount` | **types.Decimal* | :heavy_minus_sign: | Payment Amount (including gratuity) | 194.12 | +| `Amount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Payment Amount (including gratuity) | 194.12 | | `CreatedDate` | **string* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

```
2020-10-08T22:40:50Z
2021-01-01T00:00:00
```



When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information:

- Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z`
- Unqualified local time: `2021-11-15T01:00:00`
- UTC time offsets: `2021-11-15T01:00:00-05:00`

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23T00:00:00.000Z | | `Currency` | **string* | :heavy_minus_sign: | The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_.

## Unknown currencies

In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction.

There are only a very small number of edge cases where this currency code is returned by the Codat system. | GBP | | `DueDate` | **string* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

```
2020-10-08T22:40:50Z
2021-01-01T00:00:00
```



When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information:

- Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z`
- Unqualified local time: `2021-11-15T01:00:00`
- UTC time offsets: `2021-11-15T01:00:00-05:00`

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23T00:00:00.000Z | | `ID` | *string* | :heavy_check_mark: | A unique, persistent identifier for this record | 13d946f0-c5d5-42bc-b092-97ece17923ab | | `ModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23T00:00:00.000Z | -| `PaymentMethodRef` | *interface{}* | :heavy_minus_sign: | N/A | | +| `PaymentMethodRef` | [*PaymentMethodRef](../../models/shared/paymentmethodref.md) | :heavy_minus_sign: | The payment method the record is linked to in the accounting or commerce platform. | | | `PaymentProvider` | **string* | :heavy_minus_sign: | Service provider of the payment, if applicable. | Amazon Pay | | `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23T00:00:00.000Z | -| `Status` | [*PaymentStatus](../../models/shared/paymentstatus.md) | :heavy_minus_sign: | Status of the payment. | | \ No newline at end of file +| `Status` | [*PaymentStatus](../../models/shared/paymentstatus.md) | :heavy_minus_sign: | Status of the payment. | | +| `SupplementalData` | [*SupplementalData](../../models/shared/supplementaldata.md) | :heavy_minus_sign: | Supplemental data is additional data you can include in our standard data types.

It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. | | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/paymentmethod.md b/previous-versions/commerce/docs/models/shared/paymentmethod.md index 105542851..5d78a7656 100755 --- a/previous-versions/commerce/docs/models/shared/paymentmethod.md +++ b/previous-versions/commerce/docs/models/shared/paymentmethod.md @@ -13,4 +13,4 @@ Explore our [data coverage](https://knowledge.codat.io/supported-features/commer | `ModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23T00:00:00.000Z | | `Name` | **string* | :heavy_minus_sign: | The name of the PaymentMethod | Alipay | | `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23T00:00:00.000Z | -| `Status` | [*PaymentMethodStatus](../../models/shared/paymentmethodstatus.md) | :heavy_minus_sign: | Status of the Payment Method | Active | \ No newline at end of file +| `Status` | [*PaymentMethodStatus](../../models/shared/paymentmethodstatus.md) | :heavy_minus_sign: | Status of the Payment Method. | | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/paymentmethodref.md b/previous-versions/commerce/docs/models/shared/paymentmethodref.md new file mode 100755 index 000000000..26eaa8224 --- /dev/null +++ b/previous-versions/commerce/docs/models/shared/paymentmethodref.md @@ -0,0 +1,11 @@ +# PaymentMethodRef + +The payment method the record is linked to in the accounting or commerce platform. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `ID` | *string* | :heavy_check_mark: | The unique identifier of the location being referenced. | +| `Name` | **string* | :heavy_minus_sign: | Name of the location being referenced. | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/paymentmethods.md b/previous-versions/commerce/docs/models/shared/paymentmethods.md index c66e66e5b..8c57cbe12 100755 --- a/previous-versions/commerce/docs/models/shared/paymentmethods.md +++ b/previous-versions/commerce/docs/models/shared/paymentmethods.md @@ -6,7 +6,7 @@ | Field | Type | Required | Description | | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | | `Links` | [Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | -| `PageNumber` | *int64* | :heavy_check_mark: | N/A | -| `PageSize` | *int64* | :heavy_check_mark: | N/A | +| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | +| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | | `Results` | [][PaymentMethod](../../models/shared/paymentmethod.md) | :heavy_minus_sign: | N/A | -| `TotalResults` | *int64* | :heavy_check_mark: | N/A | \ No newline at end of file +| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/paymentmethodstatus.md b/previous-versions/commerce/docs/models/shared/paymentmethodstatus.md index 6e3c7a99a..ffddf00f4 100755 --- a/previous-versions/commerce/docs/models/shared/paymentmethodstatus.md +++ b/previous-versions/commerce/docs/models/shared/paymentmethodstatus.md @@ -1,12 +1,12 @@ # PaymentMethodStatus -Status of the Payment Method +Status of the Payment Method. ## Values | Name | Value | | ----------------------------- | ----------------------------- | +| `PaymentMethodStatusUnknown` | Unknown | | `PaymentMethodStatusActive` | Active | -| `PaymentMethodStatusArchived` | Archived | -| `PaymentMethodStatusUnknown` | Unknown | \ No newline at end of file +| `PaymentMethodStatusArchived` | Archived | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/paymentref.md b/previous-versions/commerce/docs/models/shared/paymentref.md index f8c0abdf2..496faf9f0 100755 --- a/previous-versions/commerce/docs/models/shared/paymentref.md +++ b/previous-versions/commerce/docs/models/shared/paymentref.md @@ -5,7 +5,7 @@ | Field | Type | Required | Description | Example | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Amount` | **types.Decimal* | :heavy_minus_sign: | Payment Amount (including gratuity). | 194.12 | +| `Amount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Payment Amount (including gratuity). | 194.12 | | `CreatedDate` | **string* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

```
2020-10-08T22:40:50Z
2021-01-01T00:00:00
```



When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information:

- Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z`
- Unqualified local time: `2021-11-15T01:00:00`
- UTC time offsets: `2021-11-15T01:00:00-05:00`

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23T00:00:00.000Z | | `Currency` | **string* | :heavy_minus_sign: | The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_.

## Unknown currencies

In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction.

There are only a very small number of edge cases where this currency code is returned by the Codat system. | GBP | | `DueDate` | **string* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

```
2020-10-08T22:40:50Z
2021-01-01T00:00:00
```



When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information:

- Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z`
- Unqualified local time: `2021-11-15T01:00:00`
- UTC time offsets: `2021-11-15T01:00:00-05:00`

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23T00:00:00.000Z | diff --git a/previous-versions/commerce/docs/models/shared/payments.md b/previous-versions/commerce/docs/models/shared/payments.md index db3309361..e6d14c800 100755 --- a/previous-versions/commerce/docs/models/shared/payments.md +++ b/previous-versions/commerce/docs/models/shared/payments.md @@ -6,7 +6,7 @@ | Field | Type | Required | Description | | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | | `Links` | [Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | -| `PageNumber` | *int64* | :heavy_check_mark: | N/A | -| `PageSize` | *int64* | :heavy_check_mark: | N/A | +| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | +| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | | `Results` | [][Payment](../../models/shared/payment.md) | :heavy_minus_sign: | N/A | -| `TotalResults` | *int64* | :heavy_check_mark: | N/A | \ No newline at end of file +| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/product.md b/previous-versions/commerce/docs/models/shared/product.md index 4949923fe..ef8bb35bf 100755 --- a/previous-versions/commerce/docs/models/shared/product.md +++ b/previous-versions/commerce/docs/models/shared/product.md @@ -8,11 +8,12 @@ Explore our [data coverage](https://knowledge.codat.io/supported-features/commer ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | -| `Categorization` | **string* | :heavy_minus_sign: | Retail category that the product is assigned to | Hardware | -| `Description` | **string* | :heavy_minus_sign: | Description of the product recorded in the commerce or point of sale platform. | 1tb Western Digital Hard Drive | -| `ID` | *string* | :heavy_check_mark: | A unique, persistent identifier for this record | 13d946f0-c5d5-42bc-b092-97ece17923ab | -| `IsGiftCard` | **bool* | :heavy_minus_sign: | Whether the product represents a gift card or voucher that
can be redeemed in the commerce or POS platform
| | -| `Name` | **string* | :heavy_minus_sign: | Name of the product in the commerce or POS system | Hard Drive | -| `Variants` | [][ProductVariant](../../models/shared/productvariant.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Categorization` | **string* | :heavy_minus_sign: | Retail category that the product is assigned to e.g. `Hardware`. | Hardware | +| `Description` | **string* | :heavy_minus_sign: | Description of the product recorded in the commerce or point of sale platform. | 1tb Western Digital Hard Drive | +| `ID` | *string* | :heavy_check_mark: | A unique, persistent identifier for this record | 13d946f0-c5d5-42bc-b092-97ece17923ab | +| `IsGiftCard` | **bool* | :heavy_minus_sign: | Whether the product represents a gift card or voucher that
can be redeemed in the commerce or POS platform.
| | +| `Name` | **string* | :heavy_minus_sign: | Name of the product in the commerce or POS system | Hard Drive | +| `SupplementalData` | [*SupplementalData](../../models/shared/supplementaldata.md) | :heavy_minus_sign: | Supplemental data is additional data you can include in our standard data types.

It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. | | +| `Variants` | [][ProductVariant](../../models/shared/productvariant.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/productcategories.md b/previous-versions/commerce/docs/models/shared/productcategories.md index c2368871a..cd47fcba5 100755 --- a/previous-versions/commerce/docs/models/shared/productcategories.md +++ b/previous-versions/commerce/docs/models/shared/productcategories.md @@ -6,7 +6,7 @@ | Field | Type | Required | Description | | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | | `Links` | [Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | -| `PageNumber` | *int64* | :heavy_check_mark: | N/A | -| `PageSize` | *int64* | :heavy_check_mark: | N/A | +| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | +| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | | `Results` | [][ProductCategory](../../models/shared/productcategory.md) | :heavy_minus_sign: | N/A | -| `TotalResults` | *int64* | :heavy_check_mark: | N/A | \ No newline at end of file +| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/productinventory.md b/previous-versions/commerce/docs/models/shared/productinventory.md index ca5942082..483cf4068 100755 --- a/previous-versions/commerce/docs/models/shared/productinventory.md +++ b/previous-versions/commerce/docs/models/shared/productinventory.md @@ -8,4 +8,4 @@ Information about the total inventory as well as the locations inventory is in. | Field | Type | Required | Description | | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | | `Locations` | [][ProductInventoryLocation](../../models/shared/productinventorylocation.md) | :heavy_minus_sign: | N/A | -| `TotalQuantity` | **types.Decimal* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `TotalQuantity` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | The total quantity of stock remaining across locations. | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/productinventorylocation.md b/previous-versions/commerce/docs/models/shared/productinventorylocation.md index 8e5a7ad82..4f139b3fd 100755 --- a/previous-versions/commerce/docs/models/shared/productinventorylocation.md +++ b/previous-versions/commerce/docs/models/shared/productinventorylocation.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | -| `LocationRef` | [*LocationRef](../../models/shared/locationref.md) | :heavy_minus_sign: | Reference to the geographic location where the order was placed. | -| `Quantity` | **types.Decimal* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | +| `LocationRef` | [*LocationRef](../../models/shared/locationref.md) | :heavy_minus_sign: | Reference to the geographic location where the order was placed. | +| `Quantity` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | The quantity of stock remaining at location. | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/productprice.md b/previous-versions/commerce/docs/models/shared/productprice.md index 1764a6b75..243de24a7 100755 --- a/previous-versions/commerce/docs/models/shared/productprice.md +++ b/previous-versions/commerce/docs/models/shared/productprice.md @@ -6,4 +6,4 @@ | Field | Type | Required | Description | Example | | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Currency` | **string* | :heavy_minus_sign: | The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_.

## Unknown currencies

In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction.

There are only a very small number of edge cases where this currency code is returned by the Codat system. | GBP | -| `UnitPrice` | **types.Decimal* | :heavy_minus_sign: | N/A | | \ No newline at end of file +| `UnitPrice` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | The product variant's unit price. | | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/productref.md b/previous-versions/commerce/docs/models/shared/productref.md index 823228fc1..5b05be04b 100755 --- a/previous-versions/commerce/docs/models/shared/productref.md +++ b/previous-versions/commerce/docs/models/shared/productref.md @@ -5,7 +5,7 @@ Reference that links the line item to the correct product details. ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | -| `ID` | *string* | :heavy_check_mark: | The unique identitifer of the product being referenced. | 13d946f0-c5d5-42bc-b092-97ece17923ab | -| `Name` | **string* | :heavy_minus_sign: | Name of the product being referenced. | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | +| `ID` | *string* | :heavy_check_mark: | The unique identifier of the product being referenced. | 13d946f0-c5d5-42bc-b092-97ece17923ab | +| `Name` | **string* | :heavy_minus_sign: | Name of the product being referenced. | | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/products.md b/previous-versions/commerce/docs/models/shared/products.md index 1657867c1..665fe8a2e 100755 --- a/previous-versions/commerce/docs/models/shared/products.md +++ b/previous-versions/commerce/docs/models/shared/products.md @@ -6,7 +6,7 @@ | Field | Type | Required | Description | | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | | `Links` | [Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | -| `PageNumber` | *int64* | :heavy_check_mark: | N/A | -| `PageSize` | *int64* | :heavy_check_mark: | N/A | +| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | +| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | | `Results` | [][Product](../../models/shared/product.md) | :heavy_minus_sign: | N/A | -| `TotalResults` | *int64* | :heavy_check_mark: | N/A | \ No newline at end of file +| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/productvariant.md b/previous-versions/commerce/docs/models/shared/productvariant.md index 3560b8f2c..e330dff3e 100755 --- a/previous-versions/commerce/docs/models/shared/productvariant.md +++ b/previous-versions/commerce/docs/models/shared/productvariant.md @@ -19,6 +19,6 @@ Represents a variation of a product available for sale, for example an item of c | `ShippingRequired` | **bool* | :heavy_minus_sign: | Indicates whether or not the product requires physical delivery. | | | `Sku` | **string* | :heavy_minus_sign: | SKU (stock keeping unit) of the variant, as defined by the merchant. | Coat-Red-Lrg | | `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23T00:00:00.000Z | -| `Status` | [*ProductVariantStatus](../../models/shared/productvariantstatus.md) | :heavy_minus_sign: | N/A | | +| `Status` | [*ProductVariantStatus](../../models/shared/productvariantstatus.md) | :heavy_minus_sign: | The status of the product variant. | | | `UnitOfMeasure` | **string* | :heavy_minus_sign: | Unit of measure for the variant, such as `kg` or `meters`. | kg | -| `VatPercentage` | **types.Decimal* | :heavy_minus_sign: | VAT rate for the product variant if sales taxes are enabled. | 12.5 | \ No newline at end of file +| `VatPercentage` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | VAT rate for the product variant if sales taxes are enabled. | 12.5 | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/productvariantref.md b/previous-versions/commerce/docs/models/shared/productvariantref.md index 6cad65cd6..048d59e7a 100755 --- a/previous-versions/commerce/docs/models/shared/productvariantref.md +++ b/previous-versions/commerce/docs/models/shared/productvariantref.md @@ -5,7 +5,7 @@ Reference that links the line item to the specific version of product that has b ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | -| `ID` | *string* | :heavy_check_mark: | The unique identitifer of the product variant being referenced. | 13d946f0-c5d5-42bc-b092-97ece17923ab | -| `Name` | **string* | :heavy_minus_sign: | Name of the product variant being referenced. | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | +| `ID` | *string* | :heavy_check_mark: | The unique identifier of the product variant being referenced. | 13d946f0-c5d5-42bc-b092-97ece17923ab | +| `Name` | **string* | :heavy_minus_sign: | Name of the product variant being referenced. | | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/productvariantstatus.md b/previous-versions/commerce/docs/models/shared/productvariantstatus.md index ec518f885..3c76da744 100755 --- a/previous-versions/commerce/docs/models/shared/productvariantstatus.md +++ b/previous-versions/commerce/docs/models/shared/productvariantstatus.md @@ -1,5 +1,7 @@ # ProductVariantStatus +The status of the product variant. + ## Values diff --git a/previous-versions/commerce/docs/models/shared/servicecharge.md b/previous-versions/commerce/docs/models/shared/servicecharge.md index 56c89163c..80901a317 100755 --- a/previous-versions/commerce/docs/models/shared/servicecharge.md +++ b/previous-versions/commerce/docs/models/shared/servicecharge.md @@ -7,8 +7,8 @@ | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | | `Description` | **string* | :heavy_minus_sign: | Service charges for this order. | A service charge | | `Quantity` | **int64* | :heavy_minus_sign: | The number of times the charge is charged. | 1 | -| `TaxAmount` | **types.Decimal* | :heavy_minus_sign: | Amount of the service charge that is tax. | 0 | -| `TaxPercentage` | **types.Decimal* | :heavy_minus_sign: | Percentage rate (from 0 to 100) of any tax applied to the service charge. | 0 | +| `TaxAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Amount of the service charge that is tax. | 0 | +| `TaxPercentage` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Percentage rate (from 0 to 100) of any tax applied to the service charge. | 0 | | `Taxes` | [][TaxComponentAllocation](../../models/shared/taxcomponentallocation.md) | :heavy_minus_sign: | Taxes breakdown as applied to service charges. | | -| `TotalAmount` | **types.Decimal* | :heavy_minus_sign: | Total service charge, including taxes. | 0 | +| `TotalAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Total amount of the service charge, including tax. | 0 | | `Type` | [*ServiceChargeType](../../models/shared/servicechargetype.md) | :heavy_minus_sign: | The type of the service charge. | Overpayment | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/ordersupplementaldata.md b/previous-versions/commerce/docs/models/shared/supplementaldata.md similarity index 96% rename from previous-versions/commerce/docs/models/shared/ordersupplementaldata.md rename to previous-versions/commerce/docs/models/shared/supplementaldata.md index cede4cb0a..691487372 100755 --- a/previous-versions/commerce/docs/models/shared/ordersupplementaldata.md +++ b/previous-versions/commerce/docs/models/shared/supplementaldata.md @@ -1,4 +1,4 @@ -# OrderSupplementalData +# SupplementalData Supplemental data is additional data you can include in our standard data types. diff --git a/previous-versions/commerce/docs/models/shared/taxcomponent.md b/previous-versions/commerce/docs/models/shared/taxcomponent.md index 2a980da67..c20a1056d 100755 --- a/previous-versions/commerce/docs/models/shared/taxcomponent.md +++ b/previous-versions/commerce/docs/models/shared/taxcomponent.md @@ -13,5 +13,5 @@ Explore our [data coverage](https://knowledge.codat.io/supported-features/commer | `IsCompound` | **bool* | :heavy_minus_sign: | The Boolean flag to indicate when a Tax Rate Component compounds on a sale. | true | | `ModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23T00:00:00.000Z | | `Name` | **string* | :heavy_minus_sign: | Name of the Tax Rate Component in the source commerce platform. | Sales Tax | -| `Rate` | **types.Decimal* | :heavy_minus_sign: | Rate of taxation represented as a fraction of the net price (typically in the range 0.00 - 1.00). | 0.15 | +| `Rate` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Rate of taxation represented as a fraction of the net price (typically in the range 0.00 - 1.00). | 0.15 | | `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23T00:00:00.000Z | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/taxcomponentallocation.md b/previous-versions/commerce/docs/models/shared/taxcomponentallocation.md index 82eab7361..3f635e707 100755 --- a/previous-versions/commerce/docs/models/shared/taxcomponentallocation.md +++ b/previous-versions/commerce/docs/models/shared/taxcomponentallocation.md @@ -5,5 +5,5 @@ | Field | Type | Required | Description | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | -| `Rate` | **types.Decimal* | :heavy_minus_sign: | Tax amount on order line sale as available from source commerce platform. | +| `Rate` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Tax amount on order line sale as available from source commerce platform. | | `TaxComponentRef` | [*TaxComponentRef](../../models/shared/taxcomponentref.md) | :heavy_minus_sign: | Taxes rates reference object depending on the rates being available on source commerce package. | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/taxcomponents.md b/previous-versions/commerce/docs/models/shared/taxcomponents.md index b02cc6e21..5050d3f49 100755 --- a/previous-versions/commerce/docs/models/shared/taxcomponents.md +++ b/previous-versions/commerce/docs/models/shared/taxcomponents.md @@ -6,7 +6,7 @@ | Field | Type | Required | Description | | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | | `Links` | [Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | -| `PageNumber` | *int64* | :heavy_check_mark: | N/A | -| `PageSize` | *int64* | :heavy_check_mark: | N/A | +| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | +| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | | `Results` | [][TaxComponent](../../models/shared/taxcomponent.md) | :heavy_minus_sign: | N/A | -| `TotalResults` | *int64* | :heavy_check_mark: | N/A | \ No newline at end of file +| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/transaction.md b/previous-versions/commerce/docs/models/shared/transaction.md index 79c0ce646..96a1011fe 100755 --- a/previous-versions/commerce/docs/models/shared/transaction.md +++ b/previous-versions/commerce/docs/models/shared/transaction.md @@ -23,6 +23,7 @@ Explore our [data coverage](https://knowledge.codat.io/supported-features/commer | `SourceCreatedDate` | **string* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

```
2020-10-08T22:40:50Z
2021-01-01T00:00:00
```



When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information:

- Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z`
- Unqualified local time: `2021-11-15T01:00:00`
- UTC time offsets: `2021-11-15T01:00:00-05:00`

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23T00:00:00.000Z | | `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23T00:00:00.000Z | | `SubType` | **string* | :heavy_minus_sign: | Non-standardised transaction type data from the commerce platform | CardPayment | -| `TotalAmount` | **types.Decimal* | :heavy_minus_sign: | The total transaction amount | 194.12 | +| `SupplementalData` | [*SupplementalData](../../models/shared/supplementaldata.md) | :heavy_minus_sign: | Supplemental data is additional data you can include in our standard data types.

It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. | | +| `TotalAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | The total transaction amount | 194.12 | | `TransactionSourceRef` | [*TransactionSourceRef](../../models/shared/transactionsourceref.md) | :heavy_minus_sign: | Link to the source event which triggered this transaction | | | `Type` | [*TransactionType](../../models/shared/transactiontype.md) | :heavy_minus_sign: | The type of the platform transaction:
- `Unknown`
- `FailedPayout` — Failed transfer of funds from the seller's merchant account to their bank account.
- `Payment` — Credit and debit card payments.
- `PaymentFee` — Payment provider's fee on each card payment.
- `PaymentFeeRefund` — Payment provider's fee that has been refunded to the seller.
- `Payout` — Transfer of funds from the seller's merchant account to their bank account.
- `Refund` — Refunds to a customer's credit or debit card.
- `Transfer` — Secure transfer of funds to the seller's bank account. | | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/transactions.md b/previous-versions/commerce/docs/models/shared/transactions.md index a812867d3..e67e5946c 100755 --- a/previous-versions/commerce/docs/models/shared/transactions.md +++ b/previous-versions/commerce/docs/models/shared/transactions.md @@ -6,7 +6,7 @@ | Field | Type | Required | Description | | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | | `Links` | [Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | -| `PageNumber` | *int64* | :heavy_check_mark: | N/A | -| `PageSize` | *int64* | :heavy_check_mark: | N/A | +| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | +| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | | `Results` | [][Transaction](../../models/shared/transaction.md) | :heavy_minus_sign: | N/A | -| `TotalResults` | *int64* | :heavy_check_mark: | N/A | \ No newline at end of file +| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/transactionsourceref.md b/previous-versions/commerce/docs/models/shared/transactionsourceref.md index bbda79ac9..b2370d957 100755 --- a/previous-versions/commerce/docs/models/shared/transactionsourceref.md +++ b/previous-versions/commerce/docs/models/shared/transactionsourceref.md @@ -6,4 +6,4 @@ | Field | Type | Required | Description | Example | | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | | `ID` | *string* | :heavy_check_mark: | The unique identitifer of the record being referenced | 13d946f0-c5d5-42bc-b092-97ece17923ab | -| `Type` | [TransactionSourceType](../../models/shared/transactionsourcetype.md) | :heavy_check_mark: | N/A | | \ No newline at end of file +| `Type` | [TransactionSourceType](../../models/shared/transactionsourcetype.md) | :heavy_check_mark: | The type of source the transaction arose. | | \ No newline at end of file diff --git a/previous-versions/commerce/docs/models/shared/transactionsourcetype.md b/previous-versions/commerce/docs/models/shared/transactionsourcetype.md index 575548d98..b0f596608 100755 --- a/previous-versions/commerce/docs/models/shared/transactionsourcetype.md +++ b/previous-versions/commerce/docs/models/shared/transactionsourcetype.md @@ -1,5 +1,7 @@ # TransactionSourceType +The type of source the transaction arose. + ## Values diff --git a/previous-versions/commerce/docs/sdks/codatcommerce/README.md b/previous-versions/commerce/docs/sdks/codatcommerce/README.md index 793f3ac7e..9f0d358e5 100755 --- a/previous-versions/commerce/docs/sdks/codatcommerce/README.md +++ b/previous-versions/commerce/docs/sdks/codatcommerce/README.md @@ -1,5 +1,6 @@ # CodatCommerce SDK + ## Overview Codat's Commerce API allows you to access standardised data from over 11 commerce and POS systems. diff --git a/previous-versions/commerce/docs/sdks/companyinfo/README.md b/previous-versions/commerce/docs/sdks/companyinfo/README.md index 98a1ee405..35db8db61 100755 --- a/previous-versions/commerce/docs/sdks/companyinfo/README.md +++ b/previous-versions/commerce/docs/sdks/companyinfo/README.md @@ -1,4 +1,5 @@ # CompanyInfo +(*CompanyInfo*) ## Overview @@ -28,8 +29,8 @@ import( ) func main() { - s := codatcommerce.New( - codatcommerce.WithSecurity(shared.Security{ + s := commerce.New( + commerce.WithSecurity(shared.Security{ AuthHeader: "Basic BASE_64_ENCODED(API_KEY)", }), ) diff --git a/previous-versions/commerce/docs/sdks/customers/README.md b/previous-versions/commerce/docs/sdks/customers/README.md index 5a5c19484..fb1afec2f 100755 --- a/previous-versions/commerce/docs/sdks/customers/README.md +++ b/previous-versions/commerce/docs/sdks/customers/README.md @@ -1,4 +1,5 @@ # Customers +(*Customers*) ## Overview @@ -34,8 +35,8 @@ import( ) func main() { - s := codatcommerce.New( - codatcommerce.WithSecurity(shared.Security{ + s := commerce.New( + commerce.WithSecurity(shared.Security{ AuthHeader: "Basic BASE_64_ENCODED(API_KEY)", }), ) @@ -44,7 +45,7 @@ func main() { res, err := s.Customers.Get(ctx, operations.GetCustomerRequest{ CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", - CustomerID: "corrupti", + CustomerID: "Northeast Hatchback Kia", }) if err != nil { log.Fatal(err) @@ -93,8 +94,8 @@ import( ) func main() { - s := codatcommerce.New( - codatcommerce.WithSecurity(shared.Security{ + s := commerce.New( + commerce.WithSecurity(shared.Security{ AuthHeader: "Basic BASE_64_ENCODED(API_KEY)", }), ) @@ -103,10 +104,9 @@ func main() { res, err := s.Customers.List(ctx, operations.ListCustomersRequest{ CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", - OrderBy: codatcommerce.String("-modifiedDate"), - Page: codatcommerce.Int(1), - PageSize: codatcommerce.Int(100), - Query: codatcommerce.String("provident"), + OrderBy: commerce.String("-modifiedDate"), + Page: commerce.Int(1), + PageSize: commerce.Int(100), }) if err != nil { log.Fatal(err) diff --git a/previous-versions/commerce/docs/sdks/disputes/README.md b/previous-versions/commerce/docs/sdks/disputes/README.md index 2d453cff0..2f24d02a2 100755 --- a/previous-versions/commerce/docs/sdks/disputes/README.md +++ b/previous-versions/commerce/docs/sdks/disputes/README.md @@ -1,4 +1,5 @@ # Disputes +(*Disputes*) ## Overview @@ -34,8 +35,8 @@ import( ) func main() { - s := codatcommerce.New( - codatcommerce.WithSecurity(shared.Security{ + s := commerce.New( + commerce.WithSecurity(shared.Security{ AuthHeader: "Basic BASE_64_ENCODED(API_KEY)", }), ) @@ -44,7 +45,7 @@ func main() { res, err := s.Disputes.Get(ctx, operations.GetDisputeRequest{ CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", - DisputeID: "distinctio", + DisputeID: "Northeast Hatchback Kia", }) if err != nil { log.Fatal(err) @@ -93,8 +94,8 @@ import( ) func main() { - s := codatcommerce.New( - codatcommerce.WithSecurity(shared.Security{ + s := commerce.New( + commerce.WithSecurity(shared.Security{ AuthHeader: "Basic BASE_64_ENCODED(API_KEY)", }), ) @@ -103,10 +104,9 @@ func main() { res, err := s.Disputes.List(ctx, operations.ListDisputesRequest{ CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", - OrderBy: codatcommerce.String("-modifiedDate"), - Page: codatcommerce.Int(1), - PageSize: codatcommerce.Int(100), - Query: codatcommerce.String("quibusdam"), + OrderBy: commerce.String("-modifiedDate"), + Page: commerce.Int(1), + PageSize: commerce.Int(100), }) if err != nil { log.Fatal(err) diff --git a/previous-versions/commerce/docs/sdks/locations/README.md b/previous-versions/commerce/docs/sdks/locations/README.md index 363fd132f..95a190bf8 100755 --- a/previous-versions/commerce/docs/sdks/locations/README.md +++ b/previous-versions/commerce/docs/sdks/locations/README.md @@ -1,4 +1,5 @@ # Locations +(*Locations*) ## Overview @@ -34,8 +35,8 @@ import( ) func main() { - s := codatcommerce.New( - codatcommerce.WithSecurity(shared.Security{ + s := commerce.New( + commerce.WithSecurity(shared.Security{ AuthHeader: "Basic BASE_64_ENCODED(API_KEY)", }), ) @@ -44,7 +45,7 @@ func main() { res, err := s.Locations.Get(ctx, operations.GetLocationRequest{ CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", - LocationID: "unde", + LocationID: "Northeast Hatchback Kia", }) if err != nil { log.Fatal(err) @@ -93,8 +94,8 @@ import( ) func main() { - s := codatcommerce.New( - codatcommerce.WithSecurity(shared.Security{ + s := commerce.New( + commerce.WithSecurity(shared.Security{ AuthHeader: "Basic BASE_64_ENCODED(API_KEY)", }), ) diff --git a/previous-versions/commerce/docs/sdks/orders/README.md b/previous-versions/commerce/docs/sdks/orders/README.md index f93564fc2..d919c34a7 100755 --- a/previous-versions/commerce/docs/sdks/orders/README.md +++ b/previous-versions/commerce/docs/sdks/orders/README.md @@ -1,4 +1,5 @@ # Orders +(*Orders*) ## Overview @@ -34,8 +35,8 @@ import( ) func main() { - s := codatcommerce.New( - codatcommerce.WithSecurity(shared.Security{ + s := commerce.New( + commerce.WithSecurity(shared.Security{ AuthHeader: "Basic BASE_64_ENCODED(API_KEY)", }), ) @@ -44,7 +45,7 @@ func main() { res, err := s.Orders.Get(ctx, operations.GetOrderRequest{ CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", - OrderID: "nulla", + OrderID: "Northeast Hatchback Kia", }) if err != nil { log.Fatal(err) @@ -93,8 +94,8 @@ import( ) func main() { - s := codatcommerce.New( - codatcommerce.WithSecurity(shared.Security{ + s := commerce.New( + commerce.WithSecurity(shared.Security{ AuthHeader: "Basic BASE_64_ENCODED(API_KEY)", }), ) @@ -103,10 +104,9 @@ func main() { res, err := s.Orders.List(ctx, operations.ListOrdersRequest{ CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", - OrderBy: codatcommerce.String("-modifiedDate"), - Page: codatcommerce.Int(1), - PageSize: codatcommerce.Int(100), - Query: codatcommerce.String("corrupti"), + OrderBy: commerce.String("-modifiedDate"), + Page: commerce.Int(1), + PageSize: commerce.Int(100), }) if err != nil { log.Fatal(err) diff --git a/previous-versions/commerce/docs/sdks/payments/README.md b/previous-versions/commerce/docs/sdks/payments/README.md index 8928dce70..2a40cddb5 100755 --- a/previous-versions/commerce/docs/sdks/payments/README.md +++ b/previous-versions/commerce/docs/sdks/payments/README.md @@ -1,4 +1,5 @@ # Payments +(*Payments*) ## Overview @@ -36,8 +37,8 @@ import( ) func main() { - s := codatcommerce.New( - codatcommerce.WithSecurity(shared.Security{ + s := commerce.New( + commerce.WithSecurity(shared.Security{ AuthHeader: "Basic BASE_64_ENCODED(API_KEY)", }), ) @@ -46,7 +47,7 @@ func main() { res, err := s.Payments.Get(ctx, operations.GetPaymentRequest{ CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", - PaymentID: "illum", + PaymentID: "Northeast Hatchback Kia", }) if err != nil { log.Fatal(err) @@ -97,8 +98,8 @@ import( ) func main() { - s := codatcommerce.New( - codatcommerce.WithSecurity(shared.Security{ + s := commerce.New( + commerce.WithSecurity(shared.Security{ AuthHeader: "Basic BASE_64_ENCODED(API_KEY)", }), ) @@ -107,7 +108,7 @@ func main() { res, err := s.Payments.GetMethod(ctx, operations.GetPaymentMethodRequest{ CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", - PaymentMethodID: "vel", + PaymentMethodID: "Markets", }) if err != nil { log.Fatal(err) @@ -156,8 +157,8 @@ import( ) func main() { - s := codatcommerce.New( - codatcommerce.WithSecurity(shared.Security{ + s := commerce.New( + commerce.WithSecurity(shared.Security{ AuthHeader: "Basic BASE_64_ENCODED(API_KEY)", }), ) @@ -166,10 +167,9 @@ func main() { res, err := s.Payments.List(ctx, operations.ListPaymentsRequest{ CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", - OrderBy: codatcommerce.String("-modifiedDate"), - Page: codatcommerce.Int(1), - PageSize: codatcommerce.Int(100), - Query: codatcommerce.String("error"), + OrderBy: commerce.String("-modifiedDate"), + Page: commerce.Int(1), + PageSize: commerce.Int(100), }) if err != nil { log.Fatal(err) @@ -218,8 +218,8 @@ import( ) func main() { - s := codatcommerce.New( - codatcommerce.WithSecurity(shared.Security{ + s := commerce.New( + commerce.WithSecurity(shared.Security{ AuthHeader: "Basic BASE_64_ENCODED(API_KEY)", }), ) @@ -228,10 +228,9 @@ func main() { res, err := s.Payments.ListMethods(ctx, operations.ListPaymentMethodsRequest{ CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", - OrderBy: codatcommerce.String("-modifiedDate"), - Page: codatcommerce.Int(1), - PageSize: codatcommerce.Int(100), - Query: codatcommerce.String("deserunt"), + OrderBy: commerce.String("-modifiedDate"), + Page: commerce.Int(1), + PageSize: commerce.Int(100), }) if err != nil { log.Fatal(err) diff --git a/previous-versions/commerce/docs/sdks/products/README.md b/previous-versions/commerce/docs/sdks/products/README.md index d0d460d81..5ca01ee92 100755 --- a/previous-versions/commerce/docs/sdks/products/README.md +++ b/previous-versions/commerce/docs/sdks/products/README.md @@ -1,4 +1,5 @@ # Products +(*Products*) ## Overview @@ -36,8 +37,8 @@ import( ) func main() { - s := codatcommerce.New( - codatcommerce.WithSecurity(shared.Security{ + s := commerce.New( + commerce.WithSecurity(shared.Security{ AuthHeader: "Basic BASE_64_ENCODED(API_KEY)", }), ) @@ -46,7 +47,7 @@ func main() { res, err := s.Products.Get(ctx, operations.GetProductRequest{ CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", - ProductID: "suscipit", + ProductID: "Northeast Hatchback Kia", }) if err != nil { log.Fatal(err) @@ -97,8 +98,8 @@ import( ) func main() { - s := codatcommerce.New( - codatcommerce.WithSecurity(shared.Security{ + s := commerce.New( + commerce.WithSecurity(shared.Security{ AuthHeader: "Basic BASE_64_ENCODED(API_KEY)", }), ) @@ -107,7 +108,7 @@ func main() { res, err := s.Products.GetCategory(ctx, operations.GetProductCategoryRequest{ CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", - ProductID: "iure", + ProductID: "personalise contingency", }) if err != nil { log.Fatal(err) @@ -156,8 +157,8 @@ import( ) func main() { - s := codatcommerce.New( - codatcommerce.WithSecurity(shared.Security{ + s := commerce.New( + commerce.WithSecurity(shared.Security{ AuthHeader: "Basic BASE_64_ENCODED(API_KEY)", }), ) @@ -166,10 +167,9 @@ func main() { res, err := s.Products.List(ctx, operations.ListProductsRequest{ CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", - OrderBy: codatcommerce.String("-modifiedDate"), - Page: codatcommerce.Int(1), - PageSize: codatcommerce.Int(100), - Query: codatcommerce.String("magnam"), + OrderBy: commerce.String("-modifiedDate"), + Page: commerce.Int(1), + PageSize: commerce.Int(100), }) if err != nil { log.Fatal(err) @@ -218,8 +218,8 @@ import( ) func main() { - s := codatcommerce.New( - codatcommerce.WithSecurity(shared.Security{ + s := commerce.New( + commerce.WithSecurity(shared.Security{ AuthHeader: "Basic BASE_64_ENCODED(API_KEY)", }), ) @@ -228,10 +228,9 @@ func main() { res, err := s.Products.ListCategories(ctx, operations.ListProductCategoriesRequest{ CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", - OrderBy: codatcommerce.String("-modifiedDate"), - Page: codatcommerce.Int(1), - PageSize: codatcommerce.Int(100), - Query: codatcommerce.String("debitis"), + OrderBy: commerce.String("-modifiedDate"), + Page: commerce.Int(1), + PageSize: commerce.Int(100), }) if err != nil { log.Fatal(err) diff --git a/previous-versions/commerce/docs/sdks/taxcomponents/README.md b/previous-versions/commerce/docs/sdks/taxcomponents/README.md index bccbbb2c6..08656496d 100755 --- a/previous-versions/commerce/docs/sdks/taxcomponents/README.md +++ b/previous-versions/commerce/docs/sdks/taxcomponents/README.md @@ -1,4 +1,5 @@ # TaxComponents +(*TaxComponents*) ## Overview @@ -34,8 +35,8 @@ import( ) func main() { - s := codatcommerce.New( - codatcommerce.WithSecurity(shared.Security{ + s := commerce.New( + commerce.WithSecurity(shared.Security{ AuthHeader: "Basic BASE_64_ENCODED(API_KEY)", }), ) @@ -44,7 +45,7 @@ func main() { res, err := s.TaxComponents.Get(ctx, operations.GetTaxComponentRequest{ CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", - TaxID: "ipsa", + TaxID: "Northeast Hatchback Kia", }) if err != nil { log.Fatal(err) @@ -93,8 +94,8 @@ import( ) func main() { - s := codatcommerce.New( - codatcommerce.WithSecurity(shared.Security{ + s := commerce.New( + commerce.WithSecurity(shared.Security{ AuthHeader: "Basic BASE_64_ENCODED(API_KEY)", }), ) @@ -103,10 +104,9 @@ func main() { res, err := s.TaxComponents.List(ctx, operations.ListTaxComponentsRequest{ CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", - OrderBy: codatcommerce.String("-modifiedDate"), - Page: codatcommerce.Int(1), - PageSize: codatcommerce.Int(100), - Query: codatcommerce.String("delectus"), + OrderBy: commerce.String("-modifiedDate"), + Page: commerce.Int(1), + PageSize: commerce.Int(100), }) if err != nil { log.Fatal(err) diff --git a/previous-versions/commerce/docs/sdks/transactions/README.md b/previous-versions/commerce/docs/sdks/transactions/README.md index 5c18001e2..df471dd49 100755 --- a/previous-versions/commerce/docs/sdks/transactions/README.md +++ b/previous-versions/commerce/docs/sdks/transactions/README.md @@ -1,4 +1,5 @@ # Transactions +(*Transactions*) ## Overview @@ -34,8 +35,8 @@ import( ) func main() { - s := codatcommerce.New( - codatcommerce.WithSecurity(shared.Security{ + s := commerce.New( + commerce.WithSecurity(shared.Security{ AuthHeader: "Basic BASE_64_ENCODED(API_KEY)", }), ) @@ -44,7 +45,7 @@ func main() { res, err := s.Transactions.Get(ctx, operations.GetTransactionRequest{ CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", - TransactionID: "tempora", + TransactionID: "Northeast Hatchback Kia", }) if err != nil { log.Fatal(err) @@ -93,8 +94,8 @@ import( ) func main() { - s := codatcommerce.New( - codatcommerce.WithSecurity(shared.Security{ + s := commerce.New( + commerce.WithSecurity(shared.Security{ AuthHeader: "Basic BASE_64_ENCODED(API_KEY)", }), ) @@ -103,10 +104,9 @@ func main() { res, err := s.Transactions.List(ctx, operations.ListTransactionsRequest{ CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", - OrderBy: codatcommerce.String("-modifiedDate"), - Page: codatcommerce.Int(1), - PageSize: codatcommerce.Int(100), - Query: codatcommerce.String("suscipit"), + OrderBy: commerce.String("-modifiedDate"), + Page: commerce.Int(1), + PageSize: commerce.Int(100), }) if err != nil { log.Fatal(err) diff --git a/previous-versions/commerce/files.gen b/previous-versions/commerce/files.gen index bf6c8e5c6..aa4a9ef58 100755 --- a/previous-versions/commerce/files.gen +++ b/previous-versions/commerce/files.gen @@ -15,15 +15,18 @@ pkg/types/bigint.go pkg/types/date.go pkg/types/datetime.go pkg/types/decimal.go +pkg/types/pointers.go pkg/utils/contenttype.go pkg/utils/form.go pkg/utils/headers.go +pkg/utils/json.go pkg/utils/pathparams.go pkg/utils/queryparams.go pkg/utils/requestbody.go pkg/utils/retries.go pkg/utils/security.go pkg/utils/utils.go +tests/helpers.go pkg/models/operations/getcompanyinfo.go pkg/models/operations/getcustomer.go pkg/models/operations/listcustomers.go @@ -64,6 +67,7 @@ pkg/models/shared/disputes.go pkg/models/shared/location.go pkg/models/shared/locations.go pkg/models/shared/order.go +pkg/models/shared/supplementaldata.go pkg/models/shared/servicecharge.go pkg/models/shared/servicechargetype.go pkg/models/shared/taxcomponentallocation.go @@ -79,8 +83,8 @@ pkg/models/shared/locationref.go pkg/models/shared/commercecustomerref.go pkg/models/shared/orders.go pkg/models/shared/payment.go +pkg/models/shared/paymentmethodref.go pkg/models/shared/paymentmethod.go -pkg/models/shared/paymentmethodstatus.go pkg/models/shared/payments.go pkg/models/shared/paymentmethods.go pkg/models/shared/product.go @@ -99,17 +103,6 @@ pkg/models/shared/transaction.go pkg/models/shared/transactiontype.go pkg/models/shared/transactions.go pkg/models/shared/security.go -docs/sdks/codatcommerce/README.md -docs/models/operations/option.md -docs/sdks/companyinfo/README.md -docs/sdks/customers/README.md -docs/sdks/disputes/README.md -docs/sdks/locations/README.md -docs/sdks/orders/README.md -docs/sdks/payments/README.md -docs/sdks/products/README.md -docs/sdks/taxcomponents/README.md -docs/sdks/transactions/README.md USAGE.md docs/models/operations/getcompanyinforequest.md docs/models/operations/getcompanyinforesponse.md @@ -173,8 +166,8 @@ docs/models/shared/transactionsourcetype.md docs/models/shared/disputes.md docs/models/shared/location.md docs/models/shared/locations.md -docs/models/shared/ordersupplementaldata.md docs/models/shared/order.md +docs/models/shared/supplementaldata.md docs/models/shared/servicecharge.md docs/models/shared/servicechargetype.md docs/models/shared/taxcomponentallocation.md @@ -190,8 +183,9 @@ docs/models/shared/locationref.md docs/models/shared/commercecustomerref.md docs/models/shared/orders.md docs/models/shared/payment.md -docs/models/shared/paymentmethod.md +docs/models/shared/paymentmethodref.md docs/models/shared/paymentmethodstatus.md +docs/models/shared/paymentmethod.md docs/models/shared/payments.md docs/models/shared/paymentmethods.md docs/models/shared/product.md @@ -210,5 +204,16 @@ docs/models/shared/transaction.md docs/models/shared/transactiontype.md docs/models/shared/transactions.md docs/models/shared/security.md +docs/sdks/codatcommerce/README.md +docs/models/operations/option.md +docs/sdks/companyinfo/README.md +docs/sdks/customers/README.md +docs/sdks/disputes/README.md +docs/sdks/locations/README.md +docs/sdks/orders/README.md +docs/sdks/payments/README.md +docs/sdks/products/README.md +docs/sdks/taxcomponents/README.md +docs/sdks/transactions/README.md pkg/models/operations/options.go .gitattributes \ No newline at end of file diff --git a/previous-versions/commerce/gen.yaml b/previous-versions/commerce/gen.yaml index 39ba784eb..58e6b66da 100644 --- a/previous-versions/commerce/gen.yaml +++ b/previous-versions/commerce/gen.yaml @@ -1,22 +1,24 @@ configVersion: 1.0.0 management: - docChecksum: cc36397272491818b6a27163e5776c60 + docChecksum: 640f5d08c51ea84e84a6d38fbe2231e6 docVersion: 3.0.0 - speakeasyVersion: 1.83.0 - generationVersion: 2.109.1 + speakeasyVersion: 1.100.2 + generationVersion: 2.159.2 generation: sdkClassName: CodatCommerce singleTagPerOp: false telemetryEnabled: true features: go: - core: 2.88.0 + constsAndDefaults: 0.1.1 + core: 2.91.5 examples: 2.81.2 - globalSecurity: 2.81.1 + globalSecurity: 2.82.2 globalServerURLs: 2.82.0 nameOverrides: 2.81.1 retries: 2.82.1 go: - version: 0.24.0 + version: 0.25.0 + flattenGlobalSecurity: false maxMethodParams: 0 packageName: github.com/codatio/client-sdk-go/previous-versions/commerce diff --git a/previous-versions/commerce/go.mod b/previous-versions/commerce/go.mod index 1647c7292..9734f9c8f 100755 --- a/previous-versions/commerce/go.mod +++ b/previous-versions/commerce/go.mod @@ -4,6 +4,7 @@ go 1.14 require ( github.com/cenkalti/backoff/v4 v4.2.0 - github.com/spyzhov/ajson v0.8.0 // indirect github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05 + github.com/mitchellh/mapstructure v1.5.0 + github.com/spyzhov/ajson v0.8.0 ) diff --git a/previous-versions/commerce/go.sum b/previous-versions/commerce/go.sum index 1f07f5100..ae03a472a 100755 --- a/previous-versions/commerce/go.sum +++ b/previous-versions/commerce/go.sum @@ -2,5 +2,7 @@ github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+M github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05 h1:S92OBrGuLLZsyM5ybUzgc/mPjIYk2AZqufieooe98uw= github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05/go.mod h1:M9R1FoZ3y//hwwnJtO51ypFGwm8ZfpxPT/ZLtO1mcgQ= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/spyzhov/ajson v0.8.0 h1:sFXyMbi4Y/BKjrsfkUZHSjA2JM1184enheSjjoT/zCc= github.com/spyzhov/ajson v0.8.0/go.mod h1:63V+CGM6f1Bu/p4nLIN8885ojBdt88TbLoSFzyqMuVA= diff --git a/previous-versions/commerce/locations.go b/previous-versions/commerce/locations.go index 1c337e53c..77ec8c325 100755 --- a/previous-versions/commerce/locations.go +++ b/previous-versions/commerce/locations.go @@ -1,6 +1,6 @@ // Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. -package codatcommerce +package commerce import ( "bytes" @@ -55,7 +55,7 @@ func (s *locations) Get(ctx context.Context, request operations.GetLocationReque return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) client := s.sdkConfiguration.SecurityClient @@ -95,13 +95,6 @@ func (s *locations) Get(ctx context.Context, request operations.GetLocationReque return nil, fmt.Errorf("error sending request: no response") } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") res := &operations.GetLocationResponse{ @@ -109,16 +102,23 @@ func (s *locations) Get(ctx context.Context, request operations.GetLocationReque ContentType: contentType, RawResponse: httpRes, } + + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.Location - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.Location + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.Location = out + res.Location = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -131,12 +131,12 @@ func (s *locations) Get(ctx context.Context, request operations.GetLocationReque case httpRes.StatusCode == 429: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ErrorMessage - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ErrorMessage + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ErrorMessage = out + res.ErrorMessage = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -173,7 +173,7 @@ func (s *locations) List(ctx context.Context, request operations.ListLocationsRe return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) client := s.sdkConfiguration.SecurityClient @@ -213,13 +213,6 @@ func (s *locations) List(ctx context.Context, request operations.ListLocationsRe return nil, fmt.Errorf("error sending request: no response") } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") res := &operations.ListLocationsResponse{ @@ -227,16 +220,23 @@ func (s *locations) List(ctx context.Context, request operations.ListLocationsRe ContentType: contentType, RawResponse: httpRes, } + + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.Locations - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.Locations + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.Locations = out + res.Locations = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -251,12 +251,12 @@ func (s *locations) List(ctx context.Context, request operations.ListLocationsRe case httpRes.StatusCode == 429: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ErrorMessage - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ErrorMessage + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ErrorMessage = out + res.ErrorMessage = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } diff --git a/previous-versions/commerce/orders.go b/previous-versions/commerce/orders.go index abc05ea19..d660698de 100755 --- a/previous-versions/commerce/orders.go +++ b/previous-versions/commerce/orders.go @@ -1,6 +1,6 @@ // Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. -package codatcommerce +package commerce import ( "bytes" @@ -55,7 +55,7 @@ func (s *orders) Get(ctx context.Context, request operations.GetOrderRequest, op return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) client := s.sdkConfiguration.SecurityClient @@ -95,13 +95,6 @@ func (s *orders) Get(ctx context.Context, request operations.GetOrderRequest, op return nil, fmt.Errorf("error sending request: no response") } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") res := &operations.GetOrderResponse{ @@ -109,16 +102,23 @@ func (s *orders) Get(ctx context.Context, request operations.GetOrderRequest, op ContentType: contentType, RawResponse: httpRes, } + + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.Order - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.Order + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.Order = out + res.Order = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -131,12 +131,12 @@ func (s *orders) Get(ctx context.Context, request operations.GetOrderRequest, op case httpRes.StatusCode == 429: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ErrorMessage - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ErrorMessage + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ErrorMessage = out + res.ErrorMessage = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -173,7 +173,7 @@ func (s *orders) List(ctx context.Context, request operations.ListOrdersRequest, return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) @@ -217,13 +217,6 @@ func (s *orders) List(ctx context.Context, request operations.ListOrdersRequest, return nil, fmt.Errorf("error sending request: no response") } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") res := &operations.ListOrdersResponse{ @@ -231,16 +224,23 @@ func (s *orders) List(ctx context.Context, request operations.ListOrdersRequest, ContentType: contentType, RawResponse: httpRes, } + + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.Orders - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.Orders + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.Orders = out + res.Orders = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -255,12 +255,12 @@ func (s *orders) List(ctx context.Context, request operations.ListOrdersRequest, case httpRes.StatusCode == 429: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ErrorMessage - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ErrorMessage + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ErrorMessage = out + res.ErrorMessage = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } diff --git a/previous-versions/commerce/payments.go b/previous-versions/commerce/payments.go index 3e877c564..34bd5ca3b 100755 --- a/previous-versions/commerce/payments.go +++ b/previous-versions/commerce/payments.go @@ -1,6 +1,6 @@ // Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. -package codatcommerce +package commerce import ( "bytes" @@ -55,7 +55,7 @@ func (s *payments) Get(ctx context.Context, request operations.GetPaymentRequest return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) client := s.sdkConfiguration.SecurityClient @@ -95,13 +95,6 @@ func (s *payments) Get(ctx context.Context, request operations.GetPaymentRequest return nil, fmt.Errorf("error sending request: no response") } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") res := &operations.GetPaymentResponse{ @@ -109,16 +102,23 @@ func (s *payments) Get(ctx context.Context, request operations.GetPaymentRequest ContentType: contentType, RawResponse: httpRes, } + + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.Payment - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.Payment + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.Payment = out + res.Payment = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -131,12 +131,12 @@ func (s *payments) Get(ctx context.Context, request operations.GetPaymentRequest case httpRes.StatusCode == 429: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ErrorMessage - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ErrorMessage + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ErrorMessage = out + res.ErrorMessage = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -175,7 +175,7 @@ func (s *payments) GetMethod(ctx context.Context, request operations.GetPaymentM return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) client := s.sdkConfiguration.SecurityClient @@ -215,13 +215,6 @@ func (s *payments) GetMethod(ctx context.Context, request operations.GetPaymentM return nil, fmt.Errorf("error sending request: no response") } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") res := &operations.GetPaymentMethodResponse{ @@ -229,16 +222,23 @@ func (s *payments) GetMethod(ctx context.Context, request operations.GetPaymentM ContentType: contentType, RawResponse: httpRes, } + + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.PaymentMethod - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.PaymentMethod + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.PaymentMethod = out + res.PaymentMethod = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -251,12 +251,12 @@ func (s *payments) GetMethod(ctx context.Context, request operations.GetPaymentM case httpRes.StatusCode == 429: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ErrorMessage - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ErrorMessage + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ErrorMessage = out + res.ErrorMessage = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -293,7 +293,7 @@ func (s *payments) List(ctx context.Context, request operations.ListPaymentsRequ return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) @@ -337,13 +337,6 @@ func (s *payments) List(ctx context.Context, request operations.ListPaymentsRequ return nil, fmt.Errorf("error sending request: no response") } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") res := &operations.ListPaymentsResponse{ @@ -351,16 +344,23 @@ func (s *payments) List(ctx context.Context, request operations.ListPaymentsRequ ContentType: contentType, RawResponse: httpRes, } + + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.Payments - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.Payments + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.Payments = out + res.Payments = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -375,12 +375,12 @@ func (s *payments) List(ctx context.Context, request operations.ListPaymentsRequ case httpRes.StatusCode == 429: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ErrorMessage - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ErrorMessage + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ErrorMessage = out + res.ErrorMessage = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -417,7 +417,7 @@ func (s *payments) ListMethods(ctx context.Context, request operations.ListPayme return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) @@ -461,13 +461,6 @@ func (s *payments) ListMethods(ctx context.Context, request operations.ListPayme return nil, fmt.Errorf("error sending request: no response") } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") res := &operations.ListPaymentMethodsResponse{ @@ -475,16 +468,23 @@ func (s *payments) ListMethods(ctx context.Context, request operations.ListPayme ContentType: contentType, RawResponse: httpRes, } + + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.PaymentMethods - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.PaymentMethods + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.PaymentMethods = out + res.PaymentMethods = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -499,12 +499,12 @@ func (s *payments) ListMethods(ctx context.Context, request operations.ListPayme case httpRes.StatusCode == 429: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ErrorMessage - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ErrorMessage + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ErrorMessage = out + res.ErrorMessage = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } diff --git a/previous-versions/commerce/pkg/models/operations/getcompanyinfo.go b/previous-versions/commerce/pkg/models/operations/getcompanyinfo.go index 7d08e81bd..cf71e4a40 100755 --- a/previous-versions/commerce/pkg/models/operations/getcompanyinfo.go +++ b/previous-versions/commerce/pkg/models/operations/getcompanyinfo.go @@ -8,7 +8,9 @@ import ( ) type GetCompanyInfoRequest struct { - CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a company. + CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a connection. ConnectionID string `pathParam:"style=simple,explode=false,name=connectionId"` } @@ -29,11 +31,14 @@ func (o *GetCompanyInfoRequest) GetConnectionID() string { type GetCompanyInfoResponse struct { // OK CompanyInfo *shared.CompanyInfo + // HTTP response content type for this operation ContentType string // Your API request was not properly authorized. ErrorMessage *shared.ErrorMessage - StatusCode int - RawResponse *http.Response + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response } func (o *GetCompanyInfoResponse) GetCompanyInfo() *shared.CompanyInfo { diff --git a/previous-versions/commerce/pkg/models/operations/getcustomer.go b/previous-versions/commerce/pkg/models/operations/getcustomer.go index 1b887f015..85381fffa 100755 --- a/previous-versions/commerce/pkg/models/operations/getcustomer.go +++ b/previous-versions/commerce/pkg/models/operations/getcustomer.go @@ -8,7 +8,9 @@ import ( ) type GetCustomerRequest struct { - CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a company. + CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a connection. ConnectionID string `pathParam:"style=simple,explode=false,name=connectionId"` // Unique identifier for a customer. CustomerID string `pathParam:"style=simple,explode=false,name=customerId"` @@ -36,13 +38,16 @@ func (o *GetCustomerRequest) GetCustomerID() string { } type GetCustomerResponse struct { + // HTTP response content type for this operation ContentType string // OK Customer *shared.Customer // Your API request was not properly authorized. ErrorMessage *shared.ErrorMessage - StatusCode int - RawResponse *http.Response + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response } func (o *GetCustomerResponse) GetContentType() string { diff --git a/previous-versions/commerce/pkg/models/operations/getdispute.go b/previous-versions/commerce/pkg/models/operations/getdispute.go index 22e58ddd1..92d6d9227 100755 --- a/previous-versions/commerce/pkg/models/operations/getdispute.go +++ b/previous-versions/commerce/pkg/models/operations/getdispute.go @@ -8,7 +8,9 @@ import ( ) type GetDisputeRequest struct { - CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a company. + CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a connection. ConnectionID string `pathParam:"style=simple,explode=false,name=connectionId"` // Unique identifier for a dispute. DisputeID string `pathParam:"style=simple,explode=false,name=disputeId"` @@ -36,13 +38,16 @@ func (o *GetDisputeRequest) GetDisputeID() string { } type GetDisputeResponse struct { + // HTTP response content type for this operation ContentType string // OK Dispute *shared.Dispute // Your API request was not properly authorized. ErrorMessage *shared.ErrorMessage - StatusCode int - RawResponse *http.Response + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response } func (o *GetDisputeResponse) GetContentType() string { diff --git a/previous-versions/commerce/pkg/models/operations/getlocation.go b/previous-versions/commerce/pkg/models/operations/getlocation.go index 2b0d1a628..0ba0793bf 100755 --- a/previous-versions/commerce/pkg/models/operations/getlocation.go +++ b/previous-versions/commerce/pkg/models/operations/getlocation.go @@ -8,7 +8,9 @@ import ( ) type GetLocationRequest struct { - CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a company. + CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a connection. ConnectionID string `pathParam:"style=simple,explode=false,name=connectionId"` // Unique identifier for a location. LocationID string `pathParam:"style=simple,explode=false,name=locationId"` @@ -36,12 +38,15 @@ func (o *GetLocationRequest) GetLocationID() string { } type GetLocationResponse struct { + // HTTP response content type for this operation ContentType string // Your API request was not properly authorized. ErrorMessage *shared.ErrorMessage // OK - Location *shared.Location - StatusCode int + Location *shared.Location + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response } diff --git a/previous-versions/commerce/pkg/models/operations/getorder.go b/previous-versions/commerce/pkg/models/operations/getorder.go index f798112b6..e4a04805e 100755 --- a/previous-versions/commerce/pkg/models/operations/getorder.go +++ b/previous-versions/commerce/pkg/models/operations/getorder.go @@ -8,7 +8,9 @@ import ( ) type GetOrderRequest struct { - CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a company. + CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a connection. ConnectionID string `pathParam:"style=simple,explode=false,name=connectionId"` // Unique identifier for an order. OrderID string `pathParam:"style=simple,explode=false,name=orderId"` @@ -36,12 +38,15 @@ func (o *GetOrderRequest) GetOrderID() string { } type GetOrderResponse struct { + // HTTP response content type for this operation ContentType string // Your API request was not properly authorized. ErrorMessage *shared.ErrorMessage // OK - Order *shared.Order - StatusCode int + Order *shared.Order + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response } diff --git a/previous-versions/commerce/pkg/models/operations/getpayment.go b/previous-versions/commerce/pkg/models/operations/getpayment.go index 74870dfdb..b22d909ae 100755 --- a/previous-versions/commerce/pkg/models/operations/getpayment.go +++ b/previous-versions/commerce/pkg/models/operations/getpayment.go @@ -8,7 +8,9 @@ import ( ) type GetPaymentRequest struct { - CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a company. + CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a connection. ConnectionID string `pathParam:"style=simple,explode=false,name=connectionId"` // Unique identifier for a payment. PaymentID string `pathParam:"style=simple,explode=false,name=paymentId"` @@ -36,12 +38,15 @@ func (o *GetPaymentRequest) GetPaymentID() string { } type GetPaymentResponse struct { + // HTTP response content type for this operation ContentType string // Your API request was not properly authorized. ErrorMessage *shared.ErrorMessage // OK - Payment *shared.Payment - StatusCode int + Payment *shared.Payment + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response } diff --git a/previous-versions/commerce/pkg/models/operations/getpaymentmethod.go b/previous-versions/commerce/pkg/models/operations/getpaymentmethod.go index 1e5f75180..243424b16 100755 --- a/previous-versions/commerce/pkg/models/operations/getpaymentmethod.go +++ b/previous-versions/commerce/pkg/models/operations/getpaymentmethod.go @@ -8,7 +8,9 @@ import ( ) type GetPaymentMethodRequest struct { - CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a company. + CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a connection. ConnectionID string `pathParam:"style=simple,explode=false,name=connectionId"` // Unique identifier for a payment method. PaymentMethodID string `pathParam:"style=simple,explode=false,name=paymentMethodId"` @@ -36,13 +38,16 @@ func (o *GetPaymentMethodRequest) GetPaymentMethodID() string { } type GetPaymentMethodResponse struct { + // HTTP response content type for this operation ContentType string // Your API request was not properly authorized. ErrorMessage *shared.ErrorMessage // OK PaymentMethod *shared.PaymentMethod - StatusCode int - RawResponse *http.Response + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response } func (o *GetPaymentMethodResponse) GetContentType() string { diff --git a/previous-versions/commerce/pkg/models/operations/getproduct.go b/previous-versions/commerce/pkg/models/operations/getproduct.go index c0fa2acef..b4c8429cb 100755 --- a/previous-versions/commerce/pkg/models/operations/getproduct.go +++ b/previous-versions/commerce/pkg/models/operations/getproduct.go @@ -8,7 +8,9 @@ import ( ) type GetProductRequest struct { - CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a company. + CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a connection. ConnectionID string `pathParam:"style=simple,explode=false,name=connectionId"` // Unique identifier for a product. ProductID string `pathParam:"style=simple,explode=false,name=productId"` @@ -36,12 +38,15 @@ func (o *GetProductRequest) GetProductID() string { } type GetProductResponse struct { + // HTTP response content type for this operation ContentType string // Your API request was not properly authorized. ErrorMessage *shared.ErrorMessage // OK - Product *shared.Product - StatusCode int + Product *shared.Product + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response } diff --git a/previous-versions/commerce/pkg/models/operations/getproductcategory.go b/previous-versions/commerce/pkg/models/operations/getproductcategory.go index 8269ac45f..7f0509a36 100755 --- a/previous-versions/commerce/pkg/models/operations/getproductcategory.go +++ b/previous-versions/commerce/pkg/models/operations/getproductcategory.go @@ -8,7 +8,9 @@ import ( ) type GetProductCategoryRequest struct { - CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a company. + CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a connection. ConnectionID string `pathParam:"style=simple,explode=false,name=connectionId"` // Unique identifier for a product. ProductID string `pathParam:"style=simple,explode=false,name=productId"` @@ -36,13 +38,16 @@ func (o *GetProductCategoryRequest) GetProductID() string { } type GetProductCategoryResponse struct { + // HTTP response content type for this operation ContentType string // Your API request was not properly authorized. ErrorMessage *shared.ErrorMessage // OK ProductCategory *shared.ProductCategory - StatusCode int - RawResponse *http.Response + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response } func (o *GetProductCategoryResponse) GetContentType() string { diff --git a/previous-versions/commerce/pkg/models/operations/gettaxcomponent.go b/previous-versions/commerce/pkg/models/operations/gettaxcomponent.go index 1122fe673..b3beca386 100755 --- a/previous-versions/commerce/pkg/models/operations/gettaxcomponent.go +++ b/previous-versions/commerce/pkg/models/operations/gettaxcomponent.go @@ -8,7 +8,9 @@ import ( ) type GetTaxComponentRequest struct { - CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a company. + CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a connection. ConnectionID string `pathParam:"style=simple,explode=false,name=connectionId"` // Unique identifier for a tax component. TaxID string `pathParam:"style=simple,explode=false,name=taxId"` @@ -36,11 +38,14 @@ func (o *GetTaxComponentRequest) GetTaxID() string { } type GetTaxComponentResponse struct { + // HTTP response content type for this operation ContentType string // Your API request was not properly authorized. ErrorMessage *shared.ErrorMessage - StatusCode int - RawResponse *http.Response + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // OK TaxComponent *shared.TaxComponent } diff --git a/previous-versions/commerce/pkg/models/operations/gettransaction.go b/previous-versions/commerce/pkg/models/operations/gettransaction.go index 2dd8aed9a..c14b44887 100755 --- a/previous-versions/commerce/pkg/models/operations/gettransaction.go +++ b/previous-versions/commerce/pkg/models/operations/gettransaction.go @@ -8,7 +8,9 @@ import ( ) type GetTransactionRequest struct { - CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a company. + CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a connection. ConnectionID string `pathParam:"style=simple,explode=false,name=connectionId"` // Unique identifier for a transaction. TransactionID string `pathParam:"style=simple,explode=false,name=transactionId"` @@ -36,11 +38,14 @@ func (o *GetTransactionRequest) GetTransactionID() string { } type GetTransactionResponse struct { + // HTTP response content type for this operation ContentType string // Your API request was not properly authorized. ErrorMessage *shared.ErrorMessage - StatusCode int - RawResponse *http.Response + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // OK Transaction *shared.Transaction } diff --git a/previous-versions/commerce/pkg/models/operations/listcustomers.go b/previous-versions/commerce/pkg/models/operations/listcustomers.go index d0a1889ac..4e64724d6 100755 --- a/previous-versions/commerce/pkg/models/operations/listcustomers.go +++ b/previous-versions/commerce/pkg/models/operations/listcustomers.go @@ -4,22 +4,36 @@ package operations import ( "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/utils" "net/http" ) type ListCustomersRequest struct { - CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a company. + CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a connection. ConnectionID string `pathParam:"style=simple,explode=false,name=connectionId"` // Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). OrderBy *string `queryParam:"style=form,explode=true,name=orderBy"` // Page number. [Read more](https://docs.codat.io/using-the-api/paging). - Page *int `queryParam:"style=form,explode=true,name=page"` + Page *int `default:"1" queryParam:"style=form,explode=true,name=page"` // Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). - PageSize *int `queryParam:"style=form,explode=true,name=pageSize"` + PageSize *int `default:"100" queryParam:"style=form,explode=true,name=pageSize"` // Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). Query *string `queryParam:"style=form,explode=true,name=query"` } +func (l ListCustomersRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListCustomersRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + func (o *ListCustomersRequest) GetCompanyID() string { if o == nil { return "" @@ -63,13 +77,16 @@ func (o *ListCustomersRequest) GetQuery() *string { } type ListCustomersResponse struct { + // HTTP response content type for this operation ContentType string // OK Customers *shared.Customers // Your `query` parameter was not correctly formed ErrorMessage *shared.ErrorMessage - StatusCode int - RawResponse *http.Response + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response } func (o *ListCustomersResponse) GetContentType() string { diff --git a/previous-versions/commerce/pkg/models/operations/listdisputes.go b/previous-versions/commerce/pkg/models/operations/listdisputes.go index 817b74dac..0233ccb6f 100755 --- a/previous-versions/commerce/pkg/models/operations/listdisputes.go +++ b/previous-versions/commerce/pkg/models/operations/listdisputes.go @@ -4,22 +4,36 @@ package operations import ( "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/utils" "net/http" ) type ListDisputesRequest struct { - CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a company. + CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a connection. ConnectionID string `pathParam:"style=simple,explode=false,name=connectionId"` // Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). OrderBy *string `queryParam:"style=form,explode=true,name=orderBy"` // Page number. [Read more](https://docs.codat.io/using-the-api/paging). - Page *int `queryParam:"style=form,explode=true,name=page"` + Page *int `default:"1" queryParam:"style=form,explode=true,name=page"` // Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). - PageSize *int `queryParam:"style=form,explode=true,name=pageSize"` + PageSize *int `default:"100" queryParam:"style=form,explode=true,name=pageSize"` // Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). Query *string `queryParam:"style=form,explode=true,name=query"` } +func (l ListDisputesRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListDisputesRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + func (o *ListDisputesRequest) GetCompanyID() string { if o == nil { return "" @@ -63,13 +77,16 @@ func (o *ListDisputesRequest) GetQuery() *string { } type ListDisputesResponse struct { + // HTTP response content type for this operation ContentType string // OK Disputes *shared.Disputes // Your `query` parameter was not correctly formed ErrorMessage *shared.ErrorMessage - StatusCode int - RawResponse *http.Response + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response } func (o *ListDisputesResponse) GetContentType() string { diff --git a/previous-versions/commerce/pkg/models/operations/listlocations.go b/previous-versions/commerce/pkg/models/operations/listlocations.go index fc3e5cbbb..ab7bcf245 100755 --- a/previous-versions/commerce/pkg/models/operations/listlocations.go +++ b/previous-versions/commerce/pkg/models/operations/listlocations.go @@ -8,7 +8,9 @@ import ( ) type ListLocationsRequest struct { - CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a company. + CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a connection. ConnectionID string `pathParam:"style=simple,explode=false,name=connectionId"` } @@ -27,12 +29,15 @@ func (o *ListLocationsRequest) GetConnectionID() string { } type ListLocationsResponse struct { + // HTTP response content type for this operation ContentType string // Your `query` parameter was not correctly formed ErrorMessage *shared.ErrorMessage // OK - Locations *shared.Locations - StatusCode int + Locations *shared.Locations + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response } diff --git a/previous-versions/commerce/pkg/models/operations/listorders.go b/previous-versions/commerce/pkg/models/operations/listorders.go index b6f5c2caf..28b8b74de 100755 --- a/previous-versions/commerce/pkg/models/operations/listorders.go +++ b/previous-versions/commerce/pkg/models/operations/listorders.go @@ -4,22 +4,36 @@ package operations import ( "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/utils" "net/http" ) type ListOrdersRequest struct { - CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a company. + CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a connection. ConnectionID string `pathParam:"style=simple,explode=false,name=connectionId"` // Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). OrderBy *string `queryParam:"style=form,explode=true,name=orderBy"` // Page number. [Read more](https://docs.codat.io/using-the-api/paging). - Page *int `queryParam:"style=form,explode=true,name=page"` + Page *int `default:"1" queryParam:"style=form,explode=true,name=page"` // Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). - PageSize *int `queryParam:"style=form,explode=true,name=pageSize"` + PageSize *int `default:"100" queryParam:"style=form,explode=true,name=pageSize"` // Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). Query *string `queryParam:"style=form,explode=true,name=query"` } +func (l ListOrdersRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListOrdersRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + func (o *ListOrdersRequest) GetCompanyID() string { if o == nil { return "" @@ -63,12 +77,15 @@ func (o *ListOrdersRequest) GetQuery() *string { } type ListOrdersResponse struct { + // HTTP response content type for this operation ContentType string // Your `query` parameter was not correctly formed ErrorMessage *shared.ErrorMessage // OK - Orders *shared.Orders - StatusCode int + Orders *shared.Orders + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response } diff --git a/previous-versions/commerce/pkg/models/operations/listpaymentmethods.go b/previous-versions/commerce/pkg/models/operations/listpaymentmethods.go index 581c1f5db..b7831ec1f 100755 --- a/previous-versions/commerce/pkg/models/operations/listpaymentmethods.go +++ b/previous-versions/commerce/pkg/models/operations/listpaymentmethods.go @@ -4,22 +4,36 @@ package operations import ( "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/utils" "net/http" ) type ListPaymentMethodsRequest struct { - CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a company. + CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a connection. ConnectionID string `pathParam:"style=simple,explode=false,name=connectionId"` // Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). OrderBy *string `queryParam:"style=form,explode=true,name=orderBy"` // Page number. [Read more](https://docs.codat.io/using-the-api/paging). - Page *int `queryParam:"style=form,explode=true,name=page"` + Page *int `default:"1" queryParam:"style=form,explode=true,name=page"` // Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). - PageSize *int `queryParam:"style=form,explode=true,name=pageSize"` + PageSize *int `default:"100" queryParam:"style=form,explode=true,name=pageSize"` // Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). Query *string `queryParam:"style=form,explode=true,name=query"` } +func (l ListPaymentMethodsRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListPaymentMethodsRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + func (o *ListPaymentMethodsRequest) GetCompanyID() string { if o == nil { return "" @@ -63,13 +77,16 @@ func (o *ListPaymentMethodsRequest) GetQuery() *string { } type ListPaymentMethodsResponse struct { + // HTTP response content type for this operation ContentType string // Your `query` parameter was not correctly formed ErrorMessage *shared.ErrorMessage // OK PaymentMethods *shared.PaymentMethods - StatusCode int - RawResponse *http.Response + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response } func (o *ListPaymentMethodsResponse) GetContentType() string { diff --git a/previous-versions/commerce/pkg/models/operations/listpayments.go b/previous-versions/commerce/pkg/models/operations/listpayments.go index 24de4b90f..867784bfb 100755 --- a/previous-versions/commerce/pkg/models/operations/listpayments.go +++ b/previous-versions/commerce/pkg/models/operations/listpayments.go @@ -4,22 +4,36 @@ package operations import ( "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/utils" "net/http" ) type ListPaymentsRequest struct { - CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a company. + CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a connection. ConnectionID string `pathParam:"style=simple,explode=false,name=connectionId"` // Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). OrderBy *string `queryParam:"style=form,explode=true,name=orderBy"` // Page number. [Read more](https://docs.codat.io/using-the-api/paging). - Page *int `queryParam:"style=form,explode=true,name=page"` + Page *int `default:"1" queryParam:"style=form,explode=true,name=page"` // Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). - PageSize *int `queryParam:"style=form,explode=true,name=pageSize"` + PageSize *int `default:"100" queryParam:"style=form,explode=true,name=pageSize"` // Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). Query *string `queryParam:"style=form,explode=true,name=query"` } +func (l ListPaymentsRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListPaymentsRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + func (o *ListPaymentsRequest) GetCompanyID() string { if o == nil { return "" @@ -63,12 +77,15 @@ func (o *ListPaymentsRequest) GetQuery() *string { } type ListPaymentsResponse struct { + // HTTP response content type for this operation ContentType string // Your `query` parameter was not correctly formed ErrorMessage *shared.ErrorMessage // OK - Payments *shared.Payments - StatusCode int + Payments *shared.Payments + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response } diff --git a/previous-versions/commerce/pkg/models/operations/listproductcategories.go b/previous-versions/commerce/pkg/models/operations/listproductcategories.go index ee2f58e98..5fecea4d1 100755 --- a/previous-versions/commerce/pkg/models/operations/listproductcategories.go +++ b/previous-versions/commerce/pkg/models/operations/listproductcategories.go @@ -4,22 +4,36 @@ package operations import ( "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/utils" "net/http" ) type ListProductCategoriesRequest struct { - CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a company. + CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a connection. ConnectionID string `pathParam:"style=simple,explode=false,name=connectionId"` // Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). OrderBy *string `queryParam:"style=form,explode=true,name=orderBy"` // Page number. [Read more](https://docs.codat.io/using-the-api/paging). - Page *int `queryParam:"style=form,explode=true,name=page"` + Page *int `default:"1" queryParam:"style=form,explode=true,name=page"` // Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). - PageSize *int `queryParam:"style=form,explode=true,name=pageSize"` + PageSize *int `default:"100" queryParam:"style=form,explode=true,name=pageSize"` // Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). Query *string `queryParam:"style=form,explode=true,name=query"` } +func (l ListProductCategoriesRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListProductCategoriesRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + func (o *ListProductCategoriesRequest) GetCompanyID() string { if o == nil { return "" @@ -63,13 +77,16 @@ func (o *ListProductCategoriesRequest) GetQuery() *string { } type ListProductCategoriesResponse struct { + // HTTP response content type for this operation ContentType string // Your `query` parameter was not correctly formed ErrorMessage *shared.ErrorMessage // OK ProductCategories *shared.ProductCategories - StatusCode int - RawResponse *http.Response + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response } func (o *ListProductCategoriesResponse) GetContentType() string { diff --git a/previous-versions/commerce/pkg/models/operations/listproducts.go b/previous-versions/commerce/pkg/models/operations/listproducts.go index 3920337f8..872801182 100755 --- a/previous-versions/commerce/pkg/models/operations/listproducts.go +++ b/previous-versions/commerce/pkg/models/operations/listproducts.go @@ -4,22 +4,36 @@ package operations import ( "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/utils" "net/http" ) type ListProductsRequest struct { - CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a company. + CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a connection. ConnectionID string `pathParam:"style=simple,explode=false,name=connectionId"` // Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). OrderBy *string `queryParam:"style=form,explode=true,name=orderBy"` // Page number. [Read more](https://docs.codat.io/using-the-api/paging). - Page *int `queryParam:"style=form,explode=true,name=page"` + Page *int `default:"1" queryParam:"style=form,explode=true,name=page"` // Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). - PageSize *int `queryParam:"style=form,explode=true,name=pageSize"` + PageSize *int `default:"100" queryParam:"style=form,explode=true,name=pageSize"` // Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). Query *string `queryParam:"style=form,explode=true,name=query"` } +func (l ListProductsRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListProductsRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + func (o *ListProductsRequest) GetCompanyID() string { if o == nil { return "" @@ -63,12 +77,15 @@ func (o *ListProductsRequest) GetQuery() *string { } type ListProductsResponse struct { + // HTTP response content type for this operation ContentType string // Your `query` parameter was not correctly formed ErrorMessage *shared.ErrorMessage // OK - Products *shared.Products - StatusCode int + Products *shared.Products + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response } diff --git a/previous-versions/commerce/pkg/models/operations/listtaxcomponents.go b/previous-versions/commerce/pkg/models/operations/listtaxcomponents.go index 44c1394e9..d046655df 100755 --- a/previous-versions/commerce/pkg/models/operations/listtaxcomponents.go +++ b/previous-versions/commerce/pkg/models/operations/listtaxcomponents.go @@ -4,22 +4,36 @@ package operations import ( "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/utils" "net/http" ) type ListTaxComponentsRequest struct { - CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a company. + CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a connection. ConnectionID string `pathParam:"style=simple,explode=false,name=connectionId"` // Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). OrderBy *string `queryParam:"style=form,explode=true,name=orderBy"` // Page number. [Read more](https://docs.codat.io/using-the-api/paging). - Page *int `queryParam:"style=form,explode=true,name=page"` + Page *int `default:"1" queryParam:"style=form,explode=true,name=page"` // Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). - PageSize *int `queryParam:"style=form,explode=true,name=pageSize"` + PageSize *int `default:"100" queryParam:"style=form,explode=true,name=pageSize"` // Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). Query *string `queryParam:"style=form,explode=true,name=query"` } +func (l ListTaxComponentsRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListTaxComponentsRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + func (o *ListTaxComponentsRequest) GetCompanyID() string { if o == nil { return "" @@ -63,11 +77,14 @@ func (o *ListTaxComponentsRequest) GetQuery() *string { } type ListTaxComponentsResponse struct { + // HTTP response content type for this operation ContentType string // Your `query` parameter was not correctly formed ErrorMessage *shared.ErrorMessage - StatusCode int - RawResponse *http.Response + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // OK TaxComponents *shared.TaxComponents } diff --git a/previous-versions/commerce/pkg/models/operations/listtransactions.go b/previous-versions/commerce/pkg/models/operations/listtransactions.go index fb9358ff9..8debde486 100755 --- a/previous-versions/commerce/pkg/models/operations/listtransactions.go +++ b/previous-versions/commerce/pkg/models/operations/listtransactions.go @@ -4,22 +4,36 @@ package operations import ( "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/utils" "net/http" ) type ListTransactionsRequest struct { - CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a company. + CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a connection. ConnectionID string `pathParam:"style=simple,explode=false,name=connectionId"` // Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). OrderBy *string `queryParam:"style=form,explode=true,name=orderBy"` // Page number. [Read more](https://docs.codat.io/using-the-api/paging). - Page *int `queryParam:"style=form,explode=true,name=page"` + Page *int `default:"1" queryParam:"style=form,explode=true,name=page"` // Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). - PageSize *int `queryParam:"style=form,explode=true,name=pageSize"` + PageSize *int `default:"100" queryParam:"style=form,explode=true,name=pageSize"` // Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). Query *string `queryParam:"style=form,explode=true,name=query"` } +func (l ListTransactionsRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListTransactionsRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + func (o *ListTransactionsRequest) GetCompanyID() string { if o == nil { return "" @@ -63,11 +77,14 @@ func (o *ListTransactionsRequest) GetQuery() *string { } type ListTransactionsResponse struct { + // HTTP response content type for this operation ContentType string // Your `query` parameter was not correctly formed ErrorMessage *shared.ErrorMessage - StatusCode int - RawResponse *http.Response + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // OK Transactions *shared.Transactions } diff --git a/previous-versions/commerce/pkg/models/shared/accountbalance.go b/previous-versions/commerce/pkg/models/shared/accountbalance.go index 9e1c18015..fe7b211f9 100755 --- a/previous-versions/commerce/pkg/models/shared/accountbalance.go +++ b/previous-versions/commerce/pkg/models/shared/accountbalance.go @@ -3,21 +3,33 @@ package shared import ( - "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/types" + "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/utils" + "github.com/ericlagergren/decimal" ) type AccountBalance struct { // The account's current balance - Available *types.Decimal `json:"available,omitempty"` + Available *decimal.Big `decimal:"number" json:"available,omitempty"` // The currency of the account Currency *string `json:"currency,omitempty"` // Funds that are not yet available in the balance - Pending *types.Decimal `json:"pending,omitempty"` + Pending *decimal.Big `decimal:"number" json:"pending,omitempty"` // Funds reserved as holdings Reserved interface{} `json:"reserved,omitempty"` } -func (o *AccountBalance) GetAvailable() *types.Decimal { +func (a AccountBalance) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(a, "", false) +} + +func (a *AccountBalance) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &a, "", false, false); err != nil { + return err + } + return nil +} + +func (o *AccountBalance) GetAvailable() *decimal.Big { if o == nil { return nil } @@ -31,7 +43,7 @@ func (o *AccountBalance) GetCurrency() *string { return o.Currency } -func (o *AccountBalance) GetPending() *types.Decimal { +func (o *AccountBalance) GetPending() *decimal.Big { if o == nil { return nil } diff --git a/previous-versions/commerce/pkg/models/shared/customers.go b/previous-versions/commerce/pkg/models/shared/customers.go index 77ab8ccc9..398cfb524 100755 --- a/previous-versions/commerce/pkg/models/shared/customers.go +++ b/previous-versions/commerce/pkg/models/shared/customers.go @@ -3,11 +3,14 @@ package shared type Customers struct { - Links Links `json:"_links"` - PageNumber int64 `json:"pageNumber"` - PageSize int64 `json:"pageSize"` - Results []Customer `json:"results,omitempty"` - TotalResults int64 `json:"totalResults"` + Links Links `json:"_links"` + // Current page number. + PageNumber int64 `json:"pageNumber"` + // Number of items to return in results array. + PageSize int64 `json:"pageSize"` + Results []Customer `json:"results,omitempty"` + // Total number of items. + TotalResults int64 `json:"totalResults"` } func (o *Customers) GetLinks() Links { diff --git a/previous-versions/commerce/pkg/models/shared/disputes.go b/previous-versions/commerce/pkg/models/shared/disputes.go index a4925b7d4..0d4808785 100755 --- a/previous-versions/commerce/pkg/models/shared/disputes.go +++ b/previous-versions/commerce/pkg/models/shared/disputes.go @@ -3,11 +3,14 @@ package shared type Disputes struct { - Links Links `json:"_links"` - PageNumber int64 `json:"pageNumber"` - PageSize int64 `json:"pageSize"` - Results []Dispute `json:"results,omitempty"` - TotalResults int64 `json:"totalResults"` + Links Links `json:"_links"` + // Current page number. + PageNumber int64 `json:"pageNumber"` + // Number of items to return in results array. + PageSize int64 `json:"pageSize"` + Results []Dispute `json:"results,omitempty"` + // Total number of items. + TotalResults int64 `json:"totalResults"` } func (o *Disputes) GetLinks() Links { diff --git a/previous-versions/commerce/pkg/models/shared/errormessage.go b/previous-versions/commerce/pkg/models/shared/errormessage.go index f89dde9bb..fcbb14d7c 100755 --- a/previous-versions/commerce/pkg/models/shared/errormessage.go +++ b/previous-versions/commerce/pkg/models/shared/errormessage.go @@ -3,12 +3,18 @@ package shared type ErrorMessage struct { - CanBeRetried *string `json:"canBeRetried,omitempty"` - CorrelationID *string `json:"correlationId,omitempty"` - DetailedErrorCode *int64 `json:"detailedErrorCode,omitempty"` - Error *string `json:"error,omitempty"` - Service *string `json:"service,omitempty"` - StatusCode *int64 `json:"statusCode,omitempty"` + // `True` if the error occurred transiently and can be retried. + CanBeRetried *string `json:"canBeRetried,omitempty"` + // Unique identifier used to propagate to all downstream services and determine the source of the error. + CorrelationID *string `json:"correlationId,omitempty"` + // Machine readable error code used to automate processes based on the code returned. + DetailedErrorCode *int64 `json:"detailedErrorCode,omitempty"` + // A brief description of the error. + Error *string `json:"error,omitempty"` + // Codat's service the returned the error. + Service *string `json:"service,omitempty"` + // The HTTP status code returned by the error. + StatusCode *int64 `json:"statusCode,omitempty"` } func (o *ErrorMessage) GetCanBeRetried() *string { diff --git a/previous-versions/commerce/pkg/models/shared/halref.go b/previous-versions/commerce/pkg/models/shared/halref.go index d60c9084f..06ee18c03 100755 --- a/previous-versions/commerce/pkg/models/shared/halref.go +++ b/previous-versions/commerce/pkg/models/shared/halref.go @@ -3,6 +3,7 @@ package shared type HalRef struct { + // Uri hypertext reference. Href *string `json:"href,omitempty"` } diff --git a/previous-versions/commerce/pkg/models/shared/locations.go b/previous-versions/commerce/pkg/models/shared/locations.go index 6a33a56e2..0af7deaac 100755 --- a/previous-versions/commerce/pkg/models/shared/locations.go +++ b/previous-versions/commerce/pkg/models/shared/locations.go @@ -3,11 +3,14 @@ package shared type Locations struct { - Links Links `json:"_links"` - PageNumber int64 `json:"pageNumber"` - PageSize int64 `json:"pageSize"` - Results []Location `json:"results,omitempty"` - TotalResults int64 `json:"totalResults"` + Links Links `json:"_links"` + // Current page number. + PageNumber int64 `json:"pageNumber"` + // Number of items to return in results array. + PageSize int64 `json:"pageSize"` + Results []Location `json:"results,omitempty"` + // Total number of items. + TotalResults int64 `json:"totalResults"` } func (o *Locations) GetLinks() Links { diff --git a/previous-versions/commerce/pkg/models/shared/order.go b/previous-versions/commerce/pkg/models/shared/order.go index 8a1912681..884389a5e 100755 --- a/previous-versions/commerce/pkg/models/shared/order.go +++ b/previous-versions/commerce/pkg/models/shared/order.go @@ -3,23 +3,10 @@ package shared import ( - "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/types" + "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/utils" + "github.com/ericlagergren/decimal" ) -// OrderSupplementalData - Supplemental data is additional data you can include in our standard data types. -// -// It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. -type OrderSupplementalData struct { - Content map[string]map[string]interface{} `json:"content,omitempty"` -} - -func (o *OrderSupplementalData) GetContent() map[string]map[string]interface{} { - if o == nil { - return nil - } - return o.Content -} - // Order - Orders contain the transaction details for all products sold by the company, and include details of any payments, service charges, or refunds related to each order. You can use data from the Orders endpoints to calculate key metrics, such as gross sales values and monthly recurring revenue (MRR). // // Explore our [data coverage](https://knowledge.codat.io/supported-features/commerce?view=tab-by-data-type&dataType=commerce-orders) for this data type. @@ -87,17 +74,28 @@ type Order struct { // Supplemental data is additional data you can include in our standard data types. // // It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. - SupplementalData *OrderSupplementalData `json:"supplementalData,omitempty"` - // Total amount of the order, including tax, net of any discounts and refunds. - TotalAmount *types.Decimal `json:"totalAmount,omitempty"` - // Total amount of discount applied to the order. - TotalDiscount *types.Decimal `json:"totalDiscount,omitempty"` - // Extra amount added to a bill. - TotalGratuity *types.Decimal `json:"totalGratuity,omitempty"` - // Total amount refunded issued by a merchant on an order (always a negative value). - TotalRefund *types.Decimal `json:"totalRefund,omitempty"` + SupplementalData *SupplementalData `json:"supplementalData,omitempty"` + // Total amount of the order, including discounts, refunds, and tax, but excluding gratuities. + TotalAmount *decimal.Big `decimal:"number" json:"totalAmount,omitempty"` + // Total amount of any discounts applied to the order, excluding tax. This is typically positive (for discounts which decrease the amount of the order), but can also be negative (for discounts which increase the amount of the order). + TotalDiscount *decimal.Big `decimal:"number" json:"totalDiscount,omitempty"` + // Extra amount added to the order. + TotalGratuity *decimal.Big `decimal:"number" json:"totalGratuity,omitempty"` + // Total amount of any refunds issued on the order, including discounts and tax, but excluding gratuities. This is always negative. + TotalRefund *decimal.Big `decimal:"number" json:"totalRefund,omitempty"` // Total amount of tax applied to the order. - TotalTaxAmount *types.Decimal `json:"totalTaxAmount,omitempty"` + TotalTaxAmount *decimal.Big `decimal:"number" json:"totalTaxAmount,omitempty"` +} + +func (o Order) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(o, "", false) +} + +func (o *Order) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &o, "", false, false); err != nil { + return err + } + return nil } func (o *Order) GetClosedDate() *string { @@ -191,42 +189,42 @@ func (o *Order) GetSourceModifiedDate() *string { return o.SourceModifiedDate } -func (o *Order) GetSupplementalData() *OrderSupplementalData { +func (o *Order) GetSupplementalData() *SupplementalData { if o == nil { return nil } return o.SupplementalData } -func (o *Order) GetTotalAmount() *types.Decimal { +func (o *Order) GetTotalAmount() *decimal.Big { if o == nil { return nil } return o.TotalAmount } -func (o *Order) GetTotalDiscount() *types.Decimal { +func (o *Order) GetTotalDiscount() *decimal.Big { if o == nil { return nil } return o.TotalDiscount } -func (o *Order) GetTotalGratuity() *types.Decimal { +func (o *Order) GetTotalGratuity() *decimal.Big { if o == nil { return nil } return o.TotalGratuity } -func (o *Order) GetTotalRefund() *types.Decimal { +func (o *Order) GetTotalRefund() *decimal.Big { if o == nil { return nil } return o.TotalRefund } -func (o *Order) GetTotalTaxAmount() *types.Decimal { +func (o *Order) GetTotalTaxAmount() *decimal.Big { if o == nil { return nil } diff --git a/previous-versions/commerce/pkg/models/shared/orderdiscountallocation.go b/previous-versions/commerce/pkg/models/shared/orderdiscountallocation.go index 41d84b006..e5cf420e8 100755 --- a/previous-versions/commerce/pkg/models/shared/orderdiscountallocation.go +++ b/previous-versions/commerce/pkg/models/shared/orderdiscountallocation.go @@ -3,14 +3,26 @@ package shared import ( - "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/types" + "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/utils" + "github.com/ericlagergren/decimal" ) type OrderDiscountAllocation struct { // Name of the discount in the commerce or point of sale platform. Name *string `json:"name,omitempty"` - // Total amount of discount applied. - TotalAmount *types.Decimal `json:"totalAmount,omitempty"` + // Total amount of discount applied, excluding tax. This is typically positive (for discounts which decrease the amount of the order line), but can also be negative (for discounts which increase the amount of the order line). + TotalAmount *decimal.Big `decimal:"number" json:"totalAmount,omitempty"` +} + +func (o OrderDiscountAllocation) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(o, "", false) +} + +func (o *OrderDiscountAllocation) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &o, "", false, false); err != nil { + return err + } + return nil } func (o *OrderDiscountAllocation) GetName() *string { @@ -20,7 +32,7 @@ func (o *OrderDiscountAllocation) GetName() *string { return o.Name } -func (o *OrderDiscountAllocation) GetTotalAmount() *types.Decimal { +func (o *OrderDiscountAllocation) GetTotalAmount() *decimal.Big { if o == nil { return nil } diff --git a/previous-versions/commerce/pkg/models/shared/orderlineitem.go b/previous-versions/commerce/pkg/models/shared/orderlineitem.go index d0e2bd9fc..ec4172127 100755 --- a/previous-versions/commerce/pkg/models/shared/orderlineitem.go +++ b/previous-versions/commerce/pkg/models/shared/orderlineitem.go @@ -3,7 +3,8 @@ package shared import ( - "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/types" + "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/utils" + "github.com/ericlagergren/decimal" ) type OrderLineItem struct { @@ -15,19 +16,30 @@ type OrderLineItem struct { // Reference that links the line item to the specific version of product that has been ordered. ProductVariantRef *ProductVariantRef `json:"productVariantRef,omitempty"` // Number of units of the product sold. - // For refunds, quantity is a negative value. + // For refunds, quantity is negative. // - Quantity *types.Decimal `json:"quantity,omitempty"` - // Percentage rate (from 0 to 100) of any sale tax applied to the unit amount. - TaxPercentage *types.Decimal `json:"taxPercentage,omitempty"` + Quantity *decimal.Big `decimal:"number" json:"quantity,omitempty"` + // Percentage rate (from 0 to 100) of any sales tax applied to the unit price. + TaxPercentage *decimal.Big `decimal:"number" json:"taxPercentage,omitempty"` // Taxes breakdown as applied to order lines. Taxes []TaxComponentAllocation `json:"taxes,omitempty"` - // Total price of the line item, including discounts, tax and minus any refunds. - TotalAmount *types.Decimal `json:"totalAmount,omitempty"` - // Total amount of tax applied to the line item. - TotalTaxAmount *types.Decimal `json:"totalTaxAmount,omitempty"` - // Price per unit of goods or service. - UnitPrice *types.Decimal `json:"unitPrice,omitempty"` + // Total amount of the line item, including discounts and tax. + TotalAmount *decimal.Big `decimal:"number" json:"totalAmount,omitempty"` + // Total amount of tax applied to the line item, factoring in any discounts. + TotalTaxAmount *decimal.Big `decimal:"number" json:"totalTaxAmount,omitempty"` + // Price per unit of goods or services, excluding discounts and tax. + UnitPrice *decimal.Big `decimal:"number" json:"unitPrice,omitempty"` +} + +func (o OrderLineItem) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(o, "", false) +} + +func (o *OrderLineItem) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &o, "", false, false); err != nil { + return err + } + return nil } func (o *OrderLineItem) GetDiscountAllocations() []OrderDiscountAllocation { @@ -58,14 +70,14 @@ func (o *OrderLineItem) GetProductVariantRef() *ProductVariantRef { return o.ProductVariantRef } -func (o *OrderLineItem) GetQuantity() *types.Decimal { +func (o *OrderLineItem) GetQuantity() *decimal.Big { if o == nil { return nil } return o.Quantity } -func (o *OrderLineItem) GetTaxPercentage() *types.Decimal { +func (o *OrderLineItem) GetTaxPercentage() *decimal.Big { if o == nil { return nil } @@ -79,21 +91,21 @@ func (o *OrderLineItem) GetTaxes() []TaxComponentAllocation { return o.Taxes } -func (o *OrderLineItem) GetTotalAmount() *types.Decimal { +func (o *OrderLineItem) GetTotalAmount() *decimal.Big { if o == nil { return nil } return o.TotalAmount } -func (o *OrderLineItem) GetTotalTaxAmount() *types.Decimal { +func (o *OrderLineItem) GetTotalTaxAmount() *decimal.Big { if o == nil { return nil } return o.TotalTaxAmount } -func (o *OrderLineItem) GetUnitPrice() *types.Decimal { +func (o *OrderLineItem) GetUnitPrice() *decimal.Big { if o == nil { return nil } diff --git a/previous-versions/commerce/pkg/models/shared/orders.go b/previous-versions/commerce/pkg/models/shared/orders.go index f63114012..a88283adf 100755 --- a/previous-versions/commerce/pkg/models/shared/orders.go +++ b/previous-versions/commerce/pkg/models/shared/orders.go @@ -3,11 +3,14 @@ package shared type Orders struct { - Links Links `json:"_links"` - PageNumber int64 `json:"pageNumber"` - PageSize int64 `json:"pageSize"` - Results []Order `json:"results,omitempty"` - TotalResults int64 `json:"totalResults"` + Links Links `json:"_links"` + // Current page number. + PageNumber int64 `json:"pageNumber"` + // Number of items to return in results array. + PageSize int64 `json:"pageSize"` + Results []Order `json:"results,omitempty"` + // Total number of items. + TotalResults int64 `json:"totalResults"` } func (o *Orders) GetLinks() Links { diff --git a/previous-versions/commerce/pkg/models/shared/payment.go b/previous-versions/commerce/pkg/models/shared/payment.go index d5894e58a..7d3b7cfde 100755 --- a/previous-versions/commerce/pkg/models/shared/payment.go +++ b/previous-versions/commerce/pkg/models/shared/payment.go @@ -3,7 +3,8 @@ package shared import ( - "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/types" + "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/utils" + "github.com/ericlagergren/decimal" ) // Payment - Payments contain details of all payments made by customers to a company, including: amounts, currency used, payment method, payment provider, and payment status. @@ -15,7 +16,7 @@ import ( // Explore our [data coverage](https://knowledge.codat.io/supported-features/commerce?view=tab-by-data-type&dataType=commerce-payments) for this data type. type Payment struct { // Payment Amount (including gratuity) - Amount *types.Decimal `json:"amount,omitempty"` + Amount *decimal.Big `decimal:"number" json:"amount,omitempty"` // In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: // // ``` @@ -65,17 +66,33 @@ type Payment struct { // > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. DueDate *string `json:"dueDate,omitempty"` // A unique, persistent identifier for this record - ID string `json:"id"` - ModifiedDate *string `json:"modifiedDate,omitempty"` - PaymentMethodRef interface{} `json:"paymentMethodRef,omitempty"` + ID string `json:"id"` + ModifiedDate *string `json:"modifiedDate,omitempty"` + // The payment method the record is linked to in the accounting or commerce platform. + PaymentMethodRef *PaymentMethodRef `json:"paymentMethodRef,omitempty"` // Service provider of the payment, if applicable. PaymentProvider *string `json:"paymentProvider,omitempty"` SourceModifiedDate *string `json:"sourceModifiedDate,omitempty"` // Status of the payment. Status *PaymentStatus `json:"status,omitempty"` + // Supplemental data is additional data you can include in our standard data types. + // + // It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. + SupplementalData *SupplementalData `json:"supplementalData,omitempty"` +} + +func (p Payment) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(p, "", false) +} + +func (p *Payment) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { + return err + } + return nil } -func (o *Payment) GetAmount() *types.Decimal { +func (o *Payment) GetAmount() *decimal.Big { if o == nil { return nil } @@ -117,7 +134,7 @@ func (o *Payment) GetModifiedDate() *string { return o.ModifiedDate } -func (o *Payment) GetPaymentMethodRef() interface{} { +func (o *Payment) GetPaymentMethodRef() *PaymentMethodRef { if o == nil { return nil } @@ -144,3 +161,10 @@ func (o *Payment) GetStatus() *PaymentStatus { } return o.Status } + +func (o *Payment) GetSupplementalData() *SupplementalData { + if o == nil { + return nil + } + return o.SupplementalData +} diff --git a/previous-versions/commerce/pkg/models/shared/paymentmethod.go b/previous-versions/commerce/pkg/models/shared/paymentmethod.go index bd4532906..0fe548db1 100755 --- a/previous-versions/commerce/pkg/models/shared/paymentmethod.go +++ b/previous-versions/commerce/pkg/models/shared/paymentmethod.go @@ -2,6 +2,42 @@ package shared +import ( + "encoding/json" + "fmt" +) + +// PaymentMethodStatus - Status of the Payment Method. +type PaymentMethodStatus string + +const ( + PaymentMethodStatusUnknown PaymentMethodStatus = "Unknown" + PaymentMethodStatusActive PaymentMethodStatus = "Active" + PaymentMethodStatusArchived PaymentMethodStatus = "Archived" +) + +func (e PaymentMethodStatus) ToPointer() *PaymentMethodStatus { + return &e +} + +func (e *PaymentMethodStatus) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Unknown": + fallthrough + case "Active": + fallthrough + case "Archived": + *e = PaymentMethodStatus(v) + return nil + default: + return fmt.Errorf("invalid value for PaymentMethodStatus: %v", v) + } +} + // PaymentMethod - A Payment Method represents the payment method(s) used to make payments. // // Explore our [data coverage](https://knowledge.codat.io/supported-features/commerce?view=tab-by-data-type&dataType=commerce-paymentMethods) for this data type. @@ -12,7 +48,7 @@ type PaymentMethod struct { // The name of the PaymentMethod Name *string `json:"name,omitempty"` SourceModifiedDate *string `json:"sourceModifiedDate,omitempty"` - // Status of the Payment Method + // Status of the Payment Method. Status *PaymentMethodStatus `json:"status,omitempty"` } diff --git a/previous-versions/commerce/pkg/models/shared/paymentmethodref.go b/previous-versions/commerce/pkg/models/shared/paymentmethodref.go new file mode 100755 index 000000000..a1694da7f --- /dev/null +++ b/previous-versions/commerce/pkg/models/shared/paymentmethodref.go @@ -0,0 +1,25 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +package shared + +// PaymentMethodRef - The payment method the record is linked to in the accounting or commerce platform. +type PaymentMethodRef struct { + // The unique identifier of the location being referenced. + ID string `json:"id"` + // Name of the location being referenced. + Name *string `json:"name,omitempty"` +} + +func (o *PaymentMethodRef) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *PaymentMethodRef) GetName() *string { + if o == nil { + return nil + } + return o.Name +} diff --git a/previous-versions/commerce/pkg/models/shared/paymentmethods.go b/previous-versions/commerce/pkg/models/shared/paymentmethods.go index b960763c6..841cdeb7d 100755 --- a/previous-versions/commerce/pkg/models/shared/paymentmethods.go +++ b/previous-versions/commerce/pkg/models/shared/paymentmethods.go @@ -3,11 +3,14 @@ package shared type PaymentMethods struct { - Links Links `json:"_links"` - PageNumber int64 `json:"pageNumber"` - PageSize int64 `json:"pageSize"` - Results []PaymentMethod `json:"results,omitempty"` - TotalResults int64 `json:"totalResults"` + Links Links `json:"_links"` + // Current page number. + PageNumber int64 `json:"pageNumber"` + // Number of items to return in results array. + PageSize int64 `json:"pageSize"` + Results []PaymentMethod `json:"results,omitempty"` + // Total number of items. + TotalResults int64 `json:"totalResults"` } func (o *PaymentMethods) GetLinks() Links { diff --git a/previous-versions/commerce/pkg/models/shared/paymentmethodstatus.go b/previous-versions/commerce/pkg/models/shared/paymentmethodstatus.go deleted file mode 100755 index c637e2055..000000000 --- a/previous-versions/commerce/pkg/models/shared/paymentmethodstatus.go +++ /dev/null @@ -1,39 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -// PaymentMethodStatus - Status of the Payment Method -type PaymentMethodStatus string - -const ( - PaymentMethodStatusActive PaymentMethodStatus = "Active" - PaymentMethodStatusArchived PaymentMethodStatus = "Archived" - PaymentMethodStatusUnknown PaymentMethodStatus = "Unknown" -) - -func (e PaymentMethodStatus) ToPointer() *PaymentMethodStatus { - return &e -} - -func (e *PaymentMethodStatus) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "Active": - fallthrough - case "Archived": - fallthrough - case "Unknown": - *e = PaymentMethodStatus(v) - return nil - default: - return fmt.Errorf("invalid value for PaymentMethodStatus: %v", v) - } -} diff --git a/previous-versions/commerce/pkg/models/shared/paymentref.go b/previous-versions/commerce/pkg/models/shared/paymentref.go index 6d91d3cc8..fe6f87956 100755 --- a/previous-versions/commerce/pkg/models/shared/paymentref.go +++ b/previous-versions/commerce/pkg/models/shared/paymentref.go @@ -3,12 +3,13 @@ package shared import ( - "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/types" + "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/utils" + "github.com/ericlagergren/decimal" ) type PaymentRef struct { // Payment Amount (including gratuity). - Amount *types.Decimal `json:"amount,omitempty"` + Amount *decimal.Big `decimal:"number" json:"amount,omitempty"` // In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: // // ``` @@ -69,7 +70,18 @@ type PaymentRef struct { Type *PaymentType `json:"type,omitempty"` } -func (o *PaymentRef) GetAmount() *types.Decimal { +func (p PaymentRef) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(p, "", false) +} + +func (p *PaymentRef) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { + return err + } + return nil +} + +func (o *PaymentRef) GetAmount() *decimal.Big { if o == nil { return nil } diff --git a/previous-versions/commerce/pkg/models/shared/payments.go b/previous-versions/commerce/pkg/models/shared/payments.go index 9c940b932..71481e571 100755 --- a/previous-versions/commerce/pkg/models/shared/payments.go +++ b/previous-versions/commerce/pkg/models/shared/payments.go @@ -3,11 +3,14 @@ package shared type Payments struct { - Links Links `json:"_links"` - PageNumber int64 `json:"pageNumber"` - PageSize int64 `json:"pageSize"` - Results []Payment `json:"results,omitempty"` - TotalResults int64 `json:"totalResults"` + Links Links `json:"_links"` + // Current page number. + PageNumber int64 `json:"pageNumber"` + // Number of items to return in results array. + PageSize int64 `json:"pageSize"` + Results []Payment `json:"results,omitempty"` + // Total number of items. + TotalResults int64 `json:"totalResults"` } func (o *Payments) GetLinks() Links { diff --git a/previous-versions/commerce/pkg/models/shared/product.go b/previous-versions/commerce/pkg/models/shared/product.go index afe2a21bd..00d61d5f6 100755 --- a/previous-versions/commerce/pkg/models/shared/product.go +++ b/previous-versions/commerce/pkg/models/shared/product.go @@ -6,19 +6,23 @@ package shared // // Explore our [data coverage](https://knowledge.codat.io/supported-features/commerce?view=tab-by-data-type&dataType=commerce-products) for this data type. type Product struct { - // Retail category that the product is assigned to + // Retail category that the product is assigned to e.g. `Hardware`. Categorization *string `json:"categorization,omitempty"` // Description of the product recorded in the commerce or point of sale platform. Description *string `json:"description,omitempty"` // A unique, persistent identifier for this record ID string `json:"id"` // Whether the product represents a gift card or voucher that - // can be redeemed in the commerce or POS platform + // can be redeemed in the commerce or POS platform. // IsGiftCard *bool `json:"isGiftCard,omitempty"` // Name of the product in the commerce or POS system - Name *string `json:"name,omitempty"` - Variants []ProductVariant `json:"variants,omitempty"` + Name *string `json:"name,omitempty"` + // Supplemental data is additional data you can include in our standard data types. + // + // It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. + SupplementalData *SupplementalData `json:"supplementalData,omitempty"` + Variants []ProductVariant `json:"variants,omitempty"` } func (o *Product) GetCategorization() *string { @@ -56,6 +60,13 @@ func (o *Product) GetName() *string { return o.Name } +func (o *Product) GetSupplementalData() *SupplementalData { + if o == nil { + return nil + } + return o.SupplementalData +} + func (o *Product) GetVariants() []ProductVariant { if o == nil { return nil diff --git a/previous-versions/commerce/pkg/models/shared/productcategories.go b/previous-versions/commerce/pkg/models/shared/productcategories.go index 8fef3d258..802dd3bd2 100755 --- a/previous-versions/commerce/pkg/models/shared/productcategories.go +++ b/previous-versions/commerce/pkg/models/shared/productcategories.go @@ -3,11 +3,14 @@ package shared type ProductCategories struct { - Links Links `json:"_links"` - PageNumber int64 `json:"pageNumber"` - PageSize int64 `json:"pageSize"` - Results []ProductCategory `json:"results,omitempty"` - TotalResults int64 `json:"totalResults"` + Links Links `json:"_links"` + // Current page number. + PageNumber int64 `json:"pageNumber"` + // Number of items to return in results array. + PageSize int64 `json:"pageSize"` + Results []ProductCategory `json:"results,omitempty"` + // Total number of items. + TotalResults int64 `json:"totalResults"` } func (o *ProductCategories) GetLinks() Links { diff --git a/previous-versions/commerce/pkg/models/shared/productinventory.go b/previous-versions/commerce/pkg/models/shared/productinventory.go index 85f08d1ce..37a0cfc02 100755 --- a/previous-versions/commerce/pkg/models/shared/productinventory.go +++ b/previous-versions/commerce/pkg/models/shared/productinventory.go @@ -3,13 +3,26 @@ package shared import ( - "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/types" + "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/utils" + "github.com/ericlagergren/decimal" ) // ProductInventory - Information about the total inventory as well as the locations inventory is in. type ProductInventory struct { - Locations []ProductInventoryLocation `json:"locations,omitempty"` - TotalQuantity *types.Decimal `json:"totalQuantity,omitempty"` + Locations []ProductInventoryLocation `json:"locations,omitempty"` + // The total quantity of stock remaining across locations. + TotalQuantity *decimal.Big `decimal:"number" json:"totalQuantity,omitempty"` +} + +func (p ProductInventory) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(p, "", false) +} + +func (p *ProductInventory) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { + return err + } + return nil } func (o *ProductInventory) GetLocations() []ProductInventoryLocation { @@ -19,7 +32,7 @@ func (o *ProductInventory) GetLocations() []ProductInventoryLocation { return o.Locations } -func (o *ProductInventory) GetTotalQuantity() *types.Decimal { +func (o *ProductInventory) GetTotalQuantity() *decimal.Big { if o == nil { return nil } diff --git a/previous-versions/commerce/pkg/models/shared/productinventorylocation.go b/previous-versions/commerce/pkg/models/shared/productinventorylocation.go index b71b79b62..fc81a391c 100755 --- a/previous-versions/commerce/pkg/models/shared/productinventorylocation.go +++ b/previous-versions/commerce/pkg/models/shared/productinventorylocation.go @@ -3,13 +3,26 @@ package shared import ( - "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/types" + "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/utils" + "github.com/ericlagergren/decimal" ) type ProductInventoryLocation struct { // Reference to the geographic location where the order was placed. - LocationRef *LocationRef `json:"locationRef,omitempty"` - Quantity *types.Decimal `json:"quantity,omitempty"` + LocationRef *LocationRef `json:"locationRef,omitempty"` + // The quantity of stock remaining at location. + Quantity *decimal.Big `decimal:"number" json:"quantity,omitempty"` +} + +func (p ProductInventoryLocation) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(p, "", false) +} + +func (p *ProductInventoryLocation) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { + return err + } + return nil } func (o *ProductInventoryLocation) GetLocationRef() *LocationRef { @@ -19,7 +32,7 @@ func (o *ProductInventoryLocation) GetLocationRef() *LocationRef { return o.LocationRef } -func (o *ProductInventoryLocation) GetQuantity() *types.Decimal { +func (o *ProductInventoryLocation) GetQuantity() *decimal.Big { if o == nil { return nil } diff --git a/previous-versions/commerce/pkg/models/shared/productprice.go b/previous-versions/commerce/pkg/models/shared/productprice.go index 4ba98eded..ecf48f546 100755 --- a/previous-versions/commerce/pkg/models/shared/productprice.go +++ b/previous-versions/commerce/pkg/models/shared/productprice.go @@ -3,7 +3,8 @@ package shared import ( - "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/types" + "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/utils" + "github.com/ericlagergren/decimal" ) type ProductPrice struct { @@ -14,8 +15,20 @@ type ProductPrice struct { // In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. // // There are only a very small number of edge cases where this currency code is returned by the Codat system. - Currency *string `json:"currency,omitempty"` - UnitPrice *types.Decimal `json:"unitPrice,omitempty"` + Currency *string `json:"currency,omitempty"` + // The product variant's unit price. + UnitPrice *decimal.Big `decimal:"number" json:"unitPrice,omitempty"` +} + +func (p ProductPrice) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(p, "", false) +} + +func (p *ProductPrice) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { + return err + } + return nil } func (o *ProductPrice) GetCurrency() *string { @@ -25,7 +38,7 @@ func (o *ProductPrice) GetCurrency() *string { return o.Currency } -func (o *ProductPrice) GetUnitPrice() *types.Decimal { +func (o *ProductPrice) GetUnitPrice() *decimal.Big { if o == nil { return nil } diff --git a/previous-versions/commerce/pkg/models/shared/productref.go b/previous-versions/commerce/pkg/models/shared/productref.go index 4836d1fb2..70f60eb92 100755 --- a/previous-versions/commerce/pkg/models/shared/productref.go +++ b/previous-versions/commerce/pkg/models/shared/productref.go @@ -4,7 +4,7 @@ package shared // ProductRef - Reference that links the line item to the correct product details. type ProductRef struct { - // The unique identitifer of the product being referenced. + // The unique identifier of the product being referenced. ID string `json:"id"` // Name of the product being referenced. Name *string `json:"name,omitempty"` diff --git a/previous-versions/commerce/pkg/models/shared/products.go b/previous-versions/commerce/pkg/models/shared/products.go index 6bfa09577..ee32e1a11 100755 --- a/previous-versions/commerce/pkg/models/shared/products.go +++ b/previous-versions/commerce/pkg/models/shared/products.go @@ -3,11 +3,14 @@ package shared type Products struct { - Links Links `json:"_links"` - PageNumber int64 `json:"pageNumber"` - PageSize int64 `json:"pageSize"` - Results []Product `json:"results,omitempty"` - TotalResults int64 `json:"totalResults"` + Links Links `json:"_links"` + // Current page number. + PageNumber int64 `json:"pageNumber"` + // Number of items to return in results array. + PageSize int64 `json:"pageSize"` + Results []Product `json:"results,omitempty"` + // Total number of items. + TotalResults int64 `json:"totalResults"` } func (o *Products) GetLinks() Links { diff --git a/previous-versions/commerce/pkg/models/shared/productvariant.go b/previous-versions/commerce/pkg/models/shared/productvariant.go index e72bf747a..c45207d74 100755 --- a/previous-versions/commerce/pkg/models/shared/productvariant.go +++ b/previous-versions/commerce/pkg/models/shared/productvariant.go @@ -3,7 +3,8 @@ package shared import ( - "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/types" + "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/utils" + "github.com/ericlagergren/decimal" ) // ProductVariant - Represents a variation of a product available for sale, for example an item of clothing that may be available for sale in multiple sizes and colors. @@ -44,13 +45,25 @@ type ProductVariant struct { // Indicates whether or not the product requires physical delivery. ShippingRequired *bool `json:"shippingRequired,omitempty"` // SKU (stock keeping unit) of the variant, as defined by the merchant. - Sku *string `json:"sku,omitempty"` - SourceModifiedDate *string `json:"sourceModifiedDate,omitempty"` - Status *ProductVariantStatus `json:"status,omitempty"` + Sku *string `json:"sku,omitempty"` + SourceModifiedDate *string `json:"sourceModifiedDate,omitempty"` + // The status of the product variant. + Status *ProductVariantStatus `json:"status,omitempty"` // Unit of measure for the variant, such as `kg` or `meters`. UnitOfMeasure *string `json:"unitOfMeasure,omitempty"` // VAT rate for the product variant if sales taxes are enabled. - VatPercentage *types.Decimal `json:"vatPercentage,omitempty"` + VatPercentage *decimal.Big `decimal:"number" json:"vatPercentage,omitempty"` +} + +func (p ProductVariant) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(p, "", false) +} + +func (p *ProductVariant) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { + return err + } + return nil } func (o *ProductVariant) GetBarcode() *string { @@ -144,7 +157,7 @@ func (o *ProductVariant) GetUnitOfMeasure() *string { return o.UnitOfMeasure } -func (o *ProductVariant) GetVatPercentage() *types.Decimal { +func (o *ProductVariant) GetVatPercentage() *decimal.Big { if o == nil { return nil } diff --git a/previous-versions/commerce/pkg/models/shared/productvariantref.go b/previous-versions/commerce/pkg/models/shared/productvariantref.go index 40628794c..6ad5d1940 100755 --- a/previous-versions/commerce/pkg/models/shared/productvariantref.go +++ b/previous-versions/commerce/pkg/models/shared/productvariantref.go @@ -4,7 +4,7 @@ package shared // ProductVariantRef - Reference that links the line item to the specific version of product that has been ordered. type ProductVariantRef struct { - // The unique identitifer of the product variant being referenced. + // The unique identifier of the product variant being referenced. ID string `json:"id"` // Name of the product variant being referenced. Name *string `json:"name,omitempty"` diff --git a/previous-versions/commerce/pkg/models/shared/productvariantstatus.go b/previous-versions/commerce/pkg/models/shared/productvariantstatus.go index 8ccc150cc..9c2be05c1 100755 --- a/previous-versions/commerce/pkg/models/shared/productvariantstatus.go +++ b/previous-versions/commerce/pkg/models/shared/productvariantstatus.go @@ -7,6 +7,7 @@ import ( "fmt" ) +// ProductVariantStatus - The status of the product variant. type ProductVariantStatus string const ( diff --git a/previous-versions/commerce/pkg/models/shared/servicecharge.go b/previous-versions/commerce/pkg/models/shared/servicecharge.go index 62c5a294f..5f7ac2412 100755 --- a/previous-versions/commerce/pkg/models/shared/servicecharge.go +++ b/previous-versions/commerce/pkg/models/shared/servicecharge.go @@ -3,7 +3,8 @@ package shared import ( - "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/types" + "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/utils" + "github.com/ericlagergren/decimal" ) type ServiceCharge struct { @@ -12,17 +13,28 @@ type ServiceCharge struct { // The number of times the charge is charged. Quantity *int64 `json:"quantity,omitempty"` // Amount of the service charge that is tax. - TaxAmount *types.Decimal `json:"taxAmount,omitempty"` + TaxAmount *decimal.Big `decimal:"number" json:"taxAmount,omitempty"` // Percentage rate (from 0 to 100) of any tax applied to the service charge. - TaxPercentage *types.Decimal `json:"taxPercentage,omitempty"` + TaxPercentage *decimal.Big `decimal:"number" json:"taxPercentage,omitempty"` // Taxes breakdown as applied to service charges. Taxes []TaxComponentAllocation `json:"taxes,omitempty"` - // Total service charge, including taxes. - TotalAmount *types.Decimal `json:"totalAmount,omitempty"` + // Total amount of the service charge, including tax. + TotalAmount *decimal.Big `decimal:"number" json:"totalAmount,omitempty"` // The type of the service charge. Type *ServiceChargeType `json:"type,omitempty"` } +func (s ServiceCharge) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(s, "", false) +} + +func (s *ServiceCharge) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &s, "", false, false); err != nil { + return err + } + return nil +} + func (o *ServiceCharge) GetDescription() *string { if o == nil { return nil @@ -37,14 +49,14 @@ func (o *ServiceCharge) GetQuantity() *int64 { return o.Quantity } -func (o *ServiceCharge) GetTaxAmount() *types.Decimal { +func (o *ServiceCharge) GetTaxAmount() *decimal.Big { if o == nil { return nil } return o.TaxAmount } -func (o *ServiceCharge) GetTaxPercentage() *types.Decimal { +func (o *ServiceCharge) GetTaxPercentage() *decimal.Big { if o == nil { return nil } @@ -58,7 +70,7 @@ func (o *ServiceCharge) GetTaxes() []TaxComponentAllocation { return o.Taxes } -func (o *ServiceCharge) GetTotalAmount() *types.Decimal { +func (o *ServiceCharge) GetTotalAmount() *decimal.Big { if o == nil { return nil } diff --git a/previous-versions/commerce/pkg/models/shared/supplementaldata.go b/previous-versions/commerce/pkg/models/shared/supplementaldata.go new file mode 100755 index 000000000..edb51f9fc --- /dev/null +++ b/previous-versions/commerce/pkg/models/shared/supplementaldata.go @@ -0,0 +1,17 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +package shared + +// SupplementalData - Supplemental data is additional data you can include in our standard data types. +// +// It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. +type SupplementalData struct { + Content map[string]map[string]interface{} `json:"content,omitempty"` +} + +func (o *SupplementalData) GetContent() map[string]map[string]interface{} { + if o == nil { + return nil + } + return o.Content +} diff --git a/previous-versions/commerce/pkg/models/shared/taxcomponent.go b/previous-versions/commerce/pkg/models/shared/taxcomponent.go index d3b0aa64c..99067ef35 100755 --- a/previous-versions/commerce/pkg/models/shared/taxcomponent.go +++ b/previous-versions/commerce/pkg/models/shared/taxcomponent.go @@ -3,7 +3,8 @@ package shared import ( - "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/types" + "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/utils" + "github.com/ericlagergren/decimal" ) // TaxComponent - The Tax Components endpoints return tax rates data from the commerce platform, including tax rate names and values. This is to support the mapping of tax rates from the commerce platform to those in the accounting platform. @@ -18,8 +19,19 @@ type TaxComponent struct { // Name of the Tax Rate Component in the source commerce platform. Name *string `json:"name,omitempty"` // Rate of taxation represented as a fraction of the net price (typically in the range 0.00 - 1.00). - Rate *types.Decimal `json:"rate,omitempty"` - SourceModifiedDate *string `json:"sourceModifiedDate,omitempty"` + Rate *decimal.Big `decimal:"number" json:"rate,omitempty"` + SourceModifiedDate *string `json:"sourceModifiedDate,omitempty"` +} + +func (t TaxComponent) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(t, "", false) +} + +func (t *TaxComponent) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &t, "", false, false); err != nil { + return err + } + return nil } func (o *TaxComponent) GetID() string { @@ -50,7 +62,7 @@ func (o *TaxComponent) GetName() *string { return o.Name } -func (o *TaxComponent) GetRate() *types.Decimal { +func (o *TaxComponent) GetRate() *decimal.Big { if o == nil { return nil } diff --git a/previous-versions/commerce/pkg/models/shared/taxcomponentallocation.go b/previous-versions/commerce/pkg/models/shared/taxcomponentallocation.go index 48b447705..670b7556d 100755 --- a/previous-versions/commerce/pkg/models/shared/taxcomponentallocation.go +++ b/previous-versions/commerce/pkg/models/shared/taxcomponentallocation.go @@ -3,17 +3,29 @@ package shared import ( - "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/types" + "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/utils" + "github.com/ericlagergren/decimal" ) type TaxComponentAllocation struct { // Tax amount on order line sale as available from source commerce platform. - Rate *types.Decimal `json:"rate,omitempty"` + Rate *decimal.Big `decimal:"number" json:"rate,omitempty"` // Taxes rates reference object depending on the rates being available on source commerce package. TaxComponentRef *TaxComponentRef `json:"taxComponentRef,omitempty"` } -func (o *TaxComponentAllocation) GetRate() *types.Decimal { +func (t TaxComponentAllocation) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(t, "", false) +} + +func (t *TaxComponentAllocation) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &t, "", false, false); err != nil { + return err + } + return nil +} + +func (o *TaxComponentAllocation) GetRate() *decimal.Big { if o == nil { return nil } diff --git a/previous-versions/commerce/pkg/models/shared/taxcomponents.go b/previous-versions/commerce/pkg/models/shared/taxcomponents.go index 8ad1870dc..bb90731ec 100755 --- a/previous-versions/commerce/pkg/models/shared/taxcomponents.go +++ b/previous-versions/commerce/pkg/models/shared/taxcomponents.go @@ -3,11 +3,14 @@ package shared type TaxComponents struct { - Links Links `json:"_links"` - PageNumber int64 `json:"pageNumber"` - PageSize int64 `json:"pageSize"` - Results []TaxComponent `json:"results,omitempty"` - TotalResults int64 `json:"totalResults"` + Links Links `json:"_links"` + // Current page number. + PageNumber int64 `json:"pageNumber"` + // Number of items to return in results array. + PageSize int64 `json:"pageSize"` + Results []TaxComponent `json:"results,omitempty"` + // Total number of items. + TotalResults int64 `json:"totalResults"` } func (o *TaxComponents) GetLinks() Links { diff --git a/previous-versions/commerce/pkg/models/shared/transaction.go b/previous-versions/commerce/pkg/models/shared/transaction.go index a16727b78..cea2480c7 100755 --- a/previous-versions/commerce/pkg/models/shared/transaction.go +++ b/previous-versions/commerce/pkg/models/shared/transaction.go @@ -3,7 +3,8 @@ package shared import ( - "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/types" + "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/utils" + "github.com/ericlagergren/decimal" ) // Transaction - Details of all financial transactions recorded in the commerce or point of sale system are added to the Transactions data type. For example, payments, service charges, and fees. @@ -71,8 +72,12 @@ type Transaction struct { SourceModifiedDate *string `json:"sourceModifiedDate,omitempty"` // Non-standardised transaction type data from the commerce platform SubType *string `json:"subType,omitempty"` + // Supplemental data is additional data you can include in our standard data types. + // + // It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. + SupplementalData *SupplementalData `json:"supplementalData,omitempty"` // The total transaction amount - TotalAmount *types.Decimal `json:"totalAmount,omitempty"` + TotalAmount *decimal.Big `decimal:"number" json:"totalAmount,omitempty"` // Link to the source event which triggered this transaction TransactionSourceRef *TransactionSourceRef `json:"transactionSourceRef,omitempty"` // The type of the platform transaction: @@ -87,6 +92,17 @@ type Transaction struct { Type *TransactionType `json:"type,omitempty"` } +func (t Transaction) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(t, "", false) +} + +func (t *Transaction) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &t, "", false, false); err != nil { + return err + } + return nil +} + func (o *Transaction) GetCreatedDate() *string { if o == nil { return nil @@ -136,7 +152,14 @@ func (o *Transaction) GetSubType() *string { return o.SubType } -func (o *Transaction) GetTotalAmount() *types.Decimal { +func (o *Transaction) GetSupplementalData() *SupplementalData { + if o == nil { + return nil + } + return o.SupplementalData +} + +func (o *Transaction) GetTotalAmount() *decimal.Big { if o == nil { return nil } diff --git a/previous-versions/commerce/pkg/models/shared/transactions.go b/previous-versions/commerce/pkg/models/shared/transactions.go index 16406f991..0cc78efed 100755 --- a/previous-versions/commerce/pkg/models/shared/transactions.go +++ b/previous-versions/commerce/pkg/models/shared/transactions.go @@ -3,11 +3,14 @@ package shared type Transactions struct { - Links Links `json:"_links"` - PageNumber int64 `json:"pageNumber"` - PageSize int64 `json:"pageSize"` - Results []Transaction `json:"results,omitempty"` - TotalResults int64 `json:"totalResults"` + Links Links `json:"_links"` + // Current page number. + PageNumber int64 `json:"pageNumber"` + // Number of items to return in results array. + PageSize int64 `json:"pageSize"` + Results []Transaction `json:"results,omitempty"` + // Total number of items. + TotalResults int64 `json:"totalResults"` } func (o *Transactions) GetLinks() Links { diff --git a/previous-versions/commerce/pkg/models/shared/transactionsourceref.go b/previous-versions/commerce/pkg/models/shared/transactionsourceref.go index a337210c5..5644a71b7 100755 --- a/previous-versions/commerce/pkg/models/shared/transactionsourceref.go +++ b/previous-versions/commerce/pkg/models/shared/transactionsourceref.go @@ -4,7 +4,8 @@ package shared type TransactionSourceRef struct { // The unique identitifer of the record being referenced - ID string `json:"id"` + ID string `json:"id"` + // The type of source the transaction arose. Type TransactionSourceType `json:"type"` } diff --git a/previous-versions/commerce/pkg/models/shared/transactionsourcetype.go b/previous-versions/commerce/pkg/models/shared/transactionsourcetype.go index da8b0492e..d46ae6678 100755 --- a/previous-versions/commerce/pkg/models/shared/transactionsourcetype.go +++ b/previous-versions/commerce/pkg/models/shared/transactionsourcetype.go @@ -7,6 +7,7 @@ import ( "fmt" ) +// TransactionSourceType - The type of source the transaction arose. type TransactionSourceType string const ( diff --git a/previous-versions/commerce/pkg/types/bigint.go b/previous-versions/commerce/pkg/types/bigint.go index 77382b2a7..afd0cd2b8 100755 --- a/previous-versions/commerce/pkg/types/bigint.go +++ b/previous-versions/commerce/pkg/types/bigint.go @@ -7,81 +7,14 @@ import ( "math/big" ) -// BigInt is a wrapper around big.Int that allows for JSON marshaling a big integer as a string. -type BigInt struct { - big.Int -} - -func (b BigInt) MarshalJSON() ([]byte, error) { - return []byte(`"` + b.String() + `"`), nil -} - -func (b *BigInt) UnmarshalJSON(p []byte) error { - if string(p) == "null" { - return nil - } - - stringVal := string(p) - if len(stringVal) > 2 && stringVal[0] == '"' && stringVal[len(stringVal)-1] == '"' { - stringVal = stringVal[1 : len(stringVal)-1] - } - - var z big.Int - _, ok := z.SetString(string(stringVal), 10) - if !ok { - return fmt.Errorf("not a valid big integer: %s", p) - } - b.Int = z - return nil -} - -// BigIntFromString returns a BigInt from a string -// The string is assumed to be base 10 and if it is not a valid big.Int -// then the function will return an error -func BigIntFromString(s string) (BigInt, error) { - i, ok := new(big.Int).SetString(s, 10) - if !ok { - return BigInt{}, fmt.Errorf("failed to parse string as bigint") - } - - return BigInt{ - Int: *i, - }, nil -} - -// NewBigIntFromString returns an instance of BigInt from a string -// The string is assumed to be base 10 and if it is not a valid big.Int -// then the function will return an error -func NewBigIntFromString(s string) (*BigInt, error) { - i, err := BigIntFromString(s) - if err != nil { - return nil, err - } - - return &i, nil -} - -// MustNewBigIntFromString returns an instance of BigInt from a string +// MustNewBigIntFromString returns an instance of big.Int from a string // The string is assumed to be base 10 and if it is not a valid big.Int // then the function panics. // Avoid using this function in production code. -func MustNewBigIntFromString(s string) *BigInt { - i, err := NewBigIntFromString(s) - if err != nil { - panic(err) - } - - return i -} - -// MustBigIntFromString returns an instance of BigInt from a string -// The string is assumed to be base 10 and if it is not a valid big.Int -// then the function panics. -// Avoid using this function in production code. -func MustBigIntFromString(s string) BigInt { - i, err := BigIntFromString(s) - if err != nil { - panic(err) +func MustNewBigIntFromString(s string) *big.Int { + i, ok := new(big.Int).SetString(s, 10) + if !ok { + panic(fmt.Errorf("failed to parse string as big.Int")) } return i diff --git a/previous-versions/commerce/pkg/types/date.go b/previous-versions/commerce/pkg/types/date.go index 01c69b7ac..c4648fa96 100755 --- a/previous-versions/commerce/pkg/types/date.go +++ b/previous-versions/commerce/pkg/types/date.go @@ -67,6 +67,10 @@ func MustDateFromString(str string) Date { return d } +func (d Date) GetTime() time.Time { + return d.Time +} + func (d Date) MarshalJSON() ([]byte, error) { return []byte(fmt.Sprintf(`"%s"`, d.Time.Format("2006-01-02"))), nil } diff --git a/previous-versions/commerce/pkg/types/decimal.go b/previous-versions/commerce/pkg/types/decimal.go index 58cfbee3c..a42284b92 100755 --- a/previous-versions/commerce/pkg/types/decimal.go +++ b/previous-versions/commerce/pkg/types/decimal.go @@ -8,68 +8,12 @@ import ( "github.com/ericlagergren/decimal" ) -// Decimal is a wrapper around decimal.Big that allows for JSON marshaling a decimal as a JSON number. -type Decimal struct { - decimal.Big -} - -func (d Decimal) MarshalJSON() ([]byte, error) { - return []byte(d.String()), nil -} - -func (d *Decimal) UnmarshalJSON(p []byte) error { - if string(p) == "null" { - return nil - } - - var z decimal.Big - _, ok := z.SetString(string(p)) - if !ok { - return fmt.Errorf("not a valid decimal: %s", p) - } - d.Big = z - return nil -} - -// DecimalFromString returns a Decimal from a string -func DecimalFromString(s string) (Decimal, error) { - d, ok := new(decimal.Big).SetString(s) - if !ok { - return Decimal{}, fmt.Errorf("failed to parse string as decimal") - } - - return Decimal{ - Big: *d, - }, nil -} - -// NewDecimalFromString returns an instance of Decimal from a string -func NewDecimalFromString(s string) (*Decimal, error) { - d, err := DecimalFromString(s) - if err != nil { - return nil, err - } - - return &d, nil -} - // MustNewDecimalFromString returns an instance of Decimal from a string // Avoid using this function in production code. -func MustNewDecimalFromString(s string) *Decimal { - d, err := NewDecimalFromString(s) - if err != nil { - panic(err) - } - - return d -} - -// MustDecimalFromString returns an instance of Decimal from a string -// Avoid using this function in production code. -func MustDecimalFromString(s string) Decimal { - d, err := DecimalFromString(s) - if err != nil { - panic(err) +func MustNewDecimalFromString(s string) *decimal.Big { + d, ok := new(decimal.Big).SetString(s) + if !ok { + panic(fmt.Errorf("failed to parse string as decimal.Big")) } return d diff --git a/previous-versions/commerce/pkg/types/pointers.go b/previous-versions/commerce/pkg/types/pointers.go new file mode 100755 index 000000000..4f15e99d4 --- /dev/null +++ b/previous-versions/commerce/pkg/types/pointers.go @@ -0,0 +1,10 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +package types + +func String(s string) *string { return &s } +func Bool(b bool) *bool { return &b } +func Int(i int) *int { return &i } +func Int64(i int64) *int64 { return &i } +func Float32(f float32) *float32 { return &f } +func Float64(f float64) *float64 { return &f } diff --git a/previous-versions/commerce/pkg/utils/form.go b/previous-versions/commerce/pkg/utils/form.go index bc910bd09..cfa063d19 100755 --- a/previous-versions/commerce/pkg/utils/form.go +++ b/previous-versions/commerce/pkg/utils/form.go @@ -35,12 +35,8 @@ func populateForm(paramName string, explode bool, objType reflect.Type, objValue formValues.Add(paramName, valToString(objValue.Interface())) case types.Date: formValues.Add(paramName, valToString(objValue.Interface())) - case types.BigInt: - formValues.Add(paramName, valToString(objValue.Interface())) case big.Int: formValues.Add(paramName, valToString(objValue.Interface())) - case types.Decimal: - formValues.Add(paramName, valToString(objValue.Interface())) case decimal.Big: formValues.Add(paramName, valToString(objValue.Interface())) default: diff --git a/previous-versions/commerce/pkg/utils/json.go b/previous-versions/commerce/pkg/utils/json.go new file mode 100755 index 000000000..4e84bd032 --- /dev/null +++ b/previous-versions/commerce/pkg/utils/json.go @@ -0,0 +1,579 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +package utils + +import ( + "bytes" + "encoding/json" + "fmt" + "math/big" + "reflect" + "strings" + "time" + "unsafe" + + "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/types" + + "github.com/ericlagergren/decimal" +) + +func MarshalJSON(v interface{}, tag reflect.StructTag, topLevel bool) ([]byte, error) { + typ, val := dereferencePointers(reflect.TypeOf(v), reflect.ValueOf(v)) + + switch { + case isModelType(typ): + if topLevel { + return json.Marshal(v) + } + + if isNil(typ, val) { + return []byte("null"), nil + } + + out := map[string]json.RawMessage{} + + for i := 0; i < typ.NumField(); i++ { + field := typ.Field(i) + fieldVal := val.Field(i) + + fieldName := field.Name + + omitEmpty := false + jsonTag := field.Tag.Get("json") + if jsonTag != "" { + for _, tag := range strings.Split(jsonTag, ",") { + if tag == "omitempty" { + omitEmpty = true + } else { + fieldName = tag + } + } + } + + if isNil(field.Type, fieldVal) { + if omitEmpty { + continue + } + } + + if !field.IsExported() && field.Tag.Get("const") == "" { + continue + } + + additionalProperties := field.Tag.Get("additionalProperties") + if fieldName == "-" && additionalProperties == "" { + continue + } + + if additionalProperties == "true" { + if field.Type.Kind() != reflect.Map { + return nil, fmt.Errorf("additionalProperties must be a map") + } + + for _, key := range fieldVal.MapKeys() { + r, err := marshalValue(fieldVal.MapIndex(key).Interface(), field.Tag) + if err != nil { + return nil, err + } + + out[key.String()] = r + } + + continue + } + + var fv interface{} + + if field.IsExported() { + fv = fieldVal.Interface() + } else { + pt := reflect.New(typ).Elem() + pt.Set(val) + + pf := pt.Field(i) + + fv = reflect.NewAt(pf.Type(), unsafe.Pointer(pf.UnsafeAddr())).Elem().Interface() + } + + r, err := marshalValue(fv, field.Tag) + if err != nil { + return nil, err + } + + out[fieldName] = r + } + + return json.Marshal(out) + default: + return marshalValue(v, tag) + } +} + +func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool, disallowUnknownFields bool) error { + if reflect.TypeOf(v).Kind() != reflect.Ptr { + return fmt.Errorf("v must be a pointer") + } + + typ, val := dereferencePointers(reflect.TypeOf(v), reflect.ValueOf(v)) + + switch { + case isModelType(typ): + if topLevel || bytes.Equal(b, []byte("null")) { + d := json.NewDecoder(bytes.NewReader(b)) + if disallowUnknownFields { + d.DisallowUnknownFields() + } + return d.Decode(v) + } + + var unmarhsaled map[string]json.RawMessage + + if err := json.Unmarshal(b, &unmarhsaled); err != nil { + return err + } + + var additionalPropertiesField *reflect.StructField + var additionalPropertiesValue *reflect.Value + + for i := 0; i < typ.NumField(); i++ { + field := typ.Field(i) + fieldVal := val.Field(i) + + fieldName := field.Name + + jsonTag := field.Tag.Get("json") + if jsonTag != "" { + for _, tag := range strings.Split(jsonTag, ",") { + if tag != "omitempty" { + fieldName = tag + } + } + } + + if field.Tag.Get("additionalProperties") == "true" { + additionalPropertiesField = &field + additionalPropertiesValue = &fieldVal + continue + } + + // If we receive a value for a const field ignore it but mark it as unmarshaled + if field.Tag.Get("const") != "" { + if r, ok := unmarhsaled[fieldName]; ok { + val := string(r) + if strings.HasPrefix(val, `"`) && strings.HasSuffix(val, `"`) { + val = val[1 : len(val)-1] + } + if val != field.Tag.Get("const") { + return fmt.Errorf("const field %s does not match expected value %s", fieldName, field.Tag.Get("const")) + } + + delete(unmarhsaled, fieldName) + } + } else if !field.IsExported() { + continue + } + + value, ok := unmarhsaled[fieldName] + if !ok { + defaultTag := field.Tag.Get("default") + if defaultTag != "" { + value = handleDefaultConstValue(defaultTag, fieldVal.Interface(), field.Tag) + ok = true + } + } else { + delete(unmarhsaled, fieldName) + } + + if ok { + if err := unmarshalValue(value, fieldVal, field.Tag, disallowUnknownFields); err != nil { + return err + } + } + } + + keys := make([]string, 0, len(unmarhsaled)) + for k := range unmarhsaled { + keys = append(keys, k) + } + + if len(keys) > 0 { + if disallowUnknownFields && (additionalPropertiesField == nil || additionalPropertiesValue == nil) { + return fmt.Errorf("unknown fields: %v", keys) + } + + if additionalPropertiesField != nil && additionalPropertiesValue != nil { + if additionalPropertiesValue.Kind() != reflect.Map { + return fmt.Errorf("additionalProperties must be a map") + } + + additionalPropertiesValue.Set(reflect.MakeMap(additionalPropertiesField.Type)) + + for key, value := range unmarhsaled { + val := reflect.New(additionalPropertiesField.Type.Elem()) + + if err := unmarshalValue(value, val, additionalPropertiesField.Tag, disallowUnknownFields); err != nil { + return err + } + + additionalPropertiesValue.SetMapIndex(reflect.ValueOf(key), val.Elem()) + } + } + } + default: + return unmarshalValue(b, reflect.ValueOf(v), tag, disallowUnknownFields) + } + + return nil +} + +func marshalValue(v interface{}, tag reflect.StructTag) (json.RawMessage, error) { + constTag := tag.Get("const") + if constTag != "" { + return handleDefaultConstValue(constTag, v, tag), nil + } + + if isNil(reflect.TypeOf(v), reflect.ValueOf(v)) { + defaultTag := tag.Get("default") + if defaultTag != "" { + return handleDefaultConstValue(defaultTag, v, tag), nil + } + + return []byte("null"), nil + } + + typ, val := dereferencePointers(reflect.TypeOf(v), reflect.ValueOf(v)) + switch typ.Kind() { + case reflect.Map: + if isNil(typ, val) { + return []byte("null"), nil + } + + out := map[string]json.RawMessage{} + + for _, key := range val.MapKeys() { + itemVal := val.MapIndex(key) + + if isNil(itemVal.Type(), itemVal) { + out[key.String()] = []byte("null") + continue + } + + r, err := marshalValue(itemVal.Interface(), tag) + if err != nil { + return nil, err + } + + out[key.String()] = r + } + + return json.Marshal(out) + case reflect.Slice, reflect.Array: + if isNil(typ, val) { + return []byte("null"), nil + } + + out := []json.RawMessage{} + + for i := 0; i < val.Len(); i++ { + itemVal := val.Index(i) + + if isNil(itemVal.Type(), itemVal) { + out = append(out, []byte("null")) + continue + } + + r, err := marshalValue(itemVal.Interface(), tag) + if err != nil { + return nil, err + } + + out = append(out, r) + } + + return json.Marshal(out) + case reflect.Struct: + switch typ { + case reflect.TypeOf(time.Time{}): + return []byte(fmt.Sprintf(`"%s"`, val.Interface().(time.Time).Format(time.RFC3339Nano))), nil + case reflect.TypeOf(big.Int{}): + format := tag.Get("bigint") + if format == "string" { + b := val.Interface().(big.Int) + return []byte(fmt.Sprintf(`"%s"`, (&b).String())), nil + } + case reflect.TypeOf(decimal.Big{}): + format := tag.Get("decimal") + if format == "number" { + b := val.Interface().(decimal.Big) + f, ok := (&b).Float64() + if ok { + return []byte(b.String()), nil + } + + return []byte(fmt.Sprintf(`%f`, f)), nil + } + } + } + + return json.Marshal(v) +} + +func handleDefaultConstValue(tagValue string, val interface{}, tag reflect.StructTag) json.RawMessage { + if tagValue == "null" { + return []byte("null") + } + + typ := dereferenceTypePointer(reflect.TypeOf(val)) + switch typ { + case reflect.TypeOf(time.Time{}): + return []byte(fmt.Sprintf(`"%s"`, tagValue)) + case reflect.TypeOf(big.Int{}): + bigIntTag := tag.Get("bigint") + if bigIntTag == "string" { + return []byte(fmt.Sprintf(`"%s"`, tagValue)) + } + case reflect.TypeOf(decimal.Big{}): + decimalTag := tag.Get("decimal") + if decimalTag != "number" { + return []byte(fmt.Sprintf(`"%s"`, tagValue)) + } + case reflect.TypeOf(types.Date{}): + return []byte(fmt.Sprintf(`"%s"`, tagValue)) + default: + if typ.Kind() == reflect.String { + return []byte(fmt.Sprintf(`"%s"`, tagValue)) + } + } + + return []byte(tagValue) +} + +func unmarshalValue(value json.RawMessage, v reflect.Value, tag reflect.StructTag, disallowUnknownFields bool) error { + if bytes.Equal(value, []byte("null")) { + if v.CanAddr() { + return json.Unmarshal(value, v.Addr().Interface()) + } else { + return json.Unmarshal(value, v.Interface()) + } + } + + typ := dereferenceTypePointer(v.Type()) + + switch typ.Kind() { + case reflect.Map: + if bytes.Equal(value, []byte("null")) || !isComplexValueType(dereferenceTypePointer(typ.Elem())) { + if v.CanAddr() { + return json.Unmarshal(value, v.Addr().Interface()) + } else { + return json.Unmarshal(value, v.Interface()) + } + } + + var unmarhsaled map[string]json.RawMessage + + if err := json.Unmarshal(value, &unmarhsaled); err != nil { + return err + } + + m := reflect.MakeMap(typ) + + for k, value := range unmarhsaled { + itemVal := reflect.New(typ.Elem()) + + if err := unmarshalValue(value, itemVal, tag, disallowUnknownFields); err != nil { + return err + } + + m.SetMapIndex(reflect.ValueOf(k), itemVal.Elem()) + } + + v.Set(m) + return nil + case reflect.Slice, reflect.Array: + if bytes.Equal(value, []byte("null")) || !isComplexValueType(dereferenceTypePointer(typ.Elem())) { + if v.CanAddr() { + return json.Unmarshal(value, v.Addr().Interface()) + } else { + return json.Unmarshal(value, v.Interface()) + } + } + + var unmarhsaled []json.RawMessage + + if err := json.Unmarshal(value, &unmarhsaled); err != nil { + return err + } + + arrVal := v + + for _, value := range unmarhsaled { + itemVal := reflect.New(typ.Elem()) + + if err := unmarshalValue(value, itemVal, tag, disallowUnknownFields); err != nil { + return err + } + + arrVal = reflect.Append(arrVal, itemVal.Elem()) + } + + v.Set(arrVal) + return nil + case reflect.Struct: + switch typ { + case reflect.TypeOf(time.Time{}): + var s string + if err := json.Unmarshal(value, &s); err != nil { + return err + } + + t, err := time.Parse(time.RFC3339Nano, s) + if err != nil { + return fmt.Errorf("failed to parse string as time.Time: %w", err) + } + + if v.Kind() == reflect.Ptr { + if v.IsNil() { + v.Set(reflect.New(typ)) + } + v = v.Elem() + } + + v.Set(reflect.ValueOf(t)) + return nil + case reflect.TypeOf(big.Int{}): + var b *big.Int + + format := tag.Get("bigint") + if format == "string" { + var s string + if err := json.Unmarshal(value, &s); err != nil { + return err + } + + var ok bool + b, ok = new(big.Int).SetString(s, 10) + if !ok { + return fmt.Errorf("failed to parse string as big.Int") + } + } else { + if err := json.Unmarshal(value, &b); err != nil { + return err + } + } + + if v.Kind() == reflect.Ptr && v.Elem().Kind() == reflect.Ptr { + v = v.Elem() + } + + v.Set(reflect.ValueOf(b)) + return nil + case reflect.TypeOf(decimal.Big{}): + var d *decimal.Big + format := tag.Get("decimal") + if format == "number" { + var ok bool + d, ok = new(decimal.Big).SetString(string(value)) + if !ok { + return fmt.Errorf("failed to parse number as decimal.Big") + } + } else { + if err := json.Unmarshal(value, &d); err != nil { + return err + } + } + + if v.Kind() == reflect.Ptr && v.Elem().Kind() == reflect.Ptr { + v = v.Elem() + } + + v.Set(reflect.ValueOf(d)) + return nil + case reflect.TypeOf(types.Date{}): + var s string + + if err := json.Unmarshal(value, &s); err != nil { + return err + } + + d, err := types.DateFromString(s) + if err != nil { + return fmt.Errorf("failed to parse string as types.Date: %w", err) + } + + if v.Kind() == reflect.Ptr { + if v.IsNil() { + v.Set(reflect.New(typ)) + } + v = v.Elem() + } + + v.Set(reflect.ValueOf(d)) + return nil + } + } + + var val interface{} + + if v.CanAddr() { + val = v.Addr().Interface() + } else { + val = v.Interface() + } + + d := json.NewDecoder(bytes.NewReader(value)) + if disallowUnknownFields { + d.DisallowUnknownFields() + } + return d.Decode(val) +} + +func dereferencePointers(typ reflect.Type, val reflect.Value) (reflect.Type, reflect.Value) { + if typ.Kind() == reflect.Ptr { + typ = typ.Elem() + val = val.Elem() + } else { + return typ, val + } + + return dereferencePointers(typ, val) +} + +func dereferenceTypePointer(typ reflect.Type) reflect.Type { + if typ.Kind() == reflect.Ptr { + typ = typ.Elem() + } else { + return typ + } + + return dereferenceTypePointer(typ) +} + +func isComplexValueType(typ reflect.Type) bool { + switch typ.Kind() { + case reflect.Struct: + switch typ { + case reflect.TypeOf(time.Time{}): + fallthrough + case reflect.TypeOf(big.Int{}): + fallthrough + case reflect.TypeOf(decimal.Big{}): + fallthrough + case reflect.TypeOf(types.Date{}): + return true + } + } + + return false +} + +func isModelType(typ reflect.Type) bool { + if isComplexValueType(typ) { + return false + } + + if typ.Kind() == reflect.Struct { + return true + } + + return false +} diff --git a/previous-versions/commerce/pkg/utils/pathparams.go b/previous-versions/commerce/pkg/utils/pathparams.go index e12084924..5224e464e 100755 --- a/previous-versions/commerce/pkg/utils/pathparams.go +++ b/previous-versions/commerce/pkg/utils/pathparams.go @@ -106,12 +106,8 @@ func getSimplePathParams(ctx context.Context, parentName string, objType reflect pathParams[parentName] = valToString(objValue.Interface()) case types.Date: pathParams[parentName] = valToString(objValue.Interface()) - case types.BigInt: - pathParams[parentName] = valToString(objValue.Interface()) case big.Int: pathParams[parentName] = valToString(objValue.Interface()) - case types.Decimal: - pathParams[parentName] = valToString(objValue.Interface()) case decimal.Big: pathParams[parentName] = valToString(objValue.Interface()) default: diff --git a/previous-versions/commerce/pkg/utils/requestbody.go b/previous-versions/commerce/pkg/utils/requestbody.go index d9fcbdaab..950f39a31 100755 --- a/previous-versions/commerce/pkg/utils/requestbody.go +++ b/previous-versions/commerce/pkg/utils/requestbody.go @@ -5,7 +5,6 @@ package utils import ( "bytes" "context" - "encoding/json" "fmt" "io" "mime/multipart" @@ -26,12 +25,16 @@ var ( urlEncodedEncodingRegex = regexp.MustCompile(`application\/x-www-form-urlencoded.*`) ) -func SerializeRequestBody(ctx context.Context, request interface{}, requestFieldName string, serializationMethod string) (io.Reader, string, error) { +func SerializeRequestBody(ctx context.Context, request interface{}, nullable, optional bool, requestFieldName, serializationMethod, tag string) (io.Reader, string, error) { requestStructType := reflect.TypeOf(request) requestValType := reflect.ValueOf(request) if isNil(requestStructType, requestValType) { - return nil, "", nil + if !nullable && optional { + return nil, "", nil + } + + return serializeContentType(requestFieldName, SerializationMethodToContentType[serializationMethod], requestValType, tag) } if requestStructType.Kind() == reflect.Pointer { @@ -40,7 +43,7 @@ func SerializeRequestBody(ctx context.Context, request interface{}, requestField } if requestStructType.Kind() != reflect.Struct { - return serializeContentType(requestFieldName, SerializationMethodToContentType[serializationMethod], requestValType) + return serializeContentType(requestFieldName, SerializationMethodToContentType[serializationMethod], requestValType, tag) } requestField, ok := requestStructType.FieldByName(requestFieldName) @@ -51,23 +54,43 @@ func SerializeRequestBody(ctx context.Context, request interface{}, requestField // request object (non-flattened) requestVal := requestValType.FieldByName(requestFieldName) if isNil(requestField.Type, requestVal) { - return nil, "", nil + if !nullable && optional { + return nil, "", nil + } + + return serializeContentType(requestFieldName, tag.MediaType, requestVal, string(requestField.Tag)) } - return serializeContentType(requestFieldName, tag.MediaType, requestVal) + return serializeContentType(requestFieldName, tag.MediaType, requestVal, string(requestField.Tag)) } } // flattened request object - return serializeContentType(requestFieldName, SerializationMethodToContentType[serializationMethod], requestValType) + return serializeContentType(requestFieldName, SerializationMethodToContentType[serializationMethod], reflect.ValueOf(request), tag) } -func serializeContentType(fieldName string, mediaType string, val reflect.Value) (*bytes.Buffer, string, error) { +func serializeContentType(fieldName string, mediaType string, val reflect.Value, tag string) (*bytes.Buffer, string, error) { buf := &bytes.Buffer{} + if isNil(val.Type(), val) { + // TODO: what does a null mean for other content types? Just returning an empty buffer for now + if jsonEncodingRegex.MatchString(mediaType) { + if _, err := buf.Write([]byte("null")); err != nil { + return nil, "", err + } + } + + return buf, mediaType, nil + } + switch { case jsonEncodingRegex.MatchString(mediaType): - if err := json.NewEncoder(buf).Encode(val.Interface()); err != nil { + data, err := MarshalJSON(val.Interface(), reflect.StructTag(tag), true) + if err != nil { + return nil, "", err + } + + if _, err := buf.Write(data); err != nil { return nil, "", err } case multipartEncodingRegex.MatchString(mediaType): @@ -137,7 +160,7 @@ func encodeMultipartFormData(w io.Writer, data interface{}) (string, error) { writer.Close() return "", err } - d, err := json.Marshal(valType.Interface()) + d, err := MarshalJSON(valType.Interface(), field.Tag, true) if err != nil { writer.Close() return "", err @@ -242,7 +265,7 @@ func encodeFormData(fieldName string, w io.Writer, data interface{}) error { tag := parseFormTag(field) if tag.JSON { - data, err := json.Marshal(valType.Interface()) + data, err := MarshalJSON(valType.Interface(), field.Tag, true) if err != nil { return err } diff --git a/previous-versions/commerce/pkg/utils/security.go b/previous-versions/commerce/pkg/utils/security.go index 675cd5758..fa5eff7df 100755 --- a/previous-versions/commerce/pkg/utils/security.go +++ b/previous-versions/commerce/pkg/utils/security.go @@ -3,6 +3,7 @@ package utils import ( + "context" "encoding/base64" "fmt" "net/http" @@ -26,51 +27,73 @@ type securityTag struct { SubType string } -type SecurityClient struct { - client HTTPClient +type securityConfig struct { headers map[string]string queryParams map[string]string } -func newSecurityClient(client HTTPClient) *SecurityClient { +type SecurityClient struct { + HTTPClient + security func(ctx context.Context) (interface{}, error) +} + +func newSecurityClient(client HTTPClient, security func(ctx context.Context) (interface{}, error)) *SecurityClient { return &SecurityClient{ - client: client, - headers: make(map[string]string), - queryParams: make(map[string]string), + HTTPClient: client, + security: security, } } func (c *SecurityClient) Do(req *http.Request) (*http.Response, error) { - for k, v := range c.headers { + securityCtx, err := c.security(req.Context()) + if err != nil { + return nil, err + } + + ctx := securityConfig{ + headers: make(map[string]string), + queryParams: make(map[string]string), + } + parseSecurityStruct(&ctx, securityCtx) + + for k, v := range ctx.headers { req.Header.Set(k, v) } queryParams := req.URL.Query() - for k, v := range c.queryParams { - queryParams.Set(k, v) + for k, v := range ctx.queryParams { + queryParams.Add(k, v) } req.URL.RawQuery = queryParams.Encode() - return c.client.Do(req) + return c.HTTPClient.Do(req) } -func ConfigureSecurityClient(c HTTPClient, security interface{}) *SecurityClient { - client := parseSecurityStruct(c, security) - if client != nil { - return client - } +func ConfigureSecurityClient(c HTTPClient, security func(ctx context.Context) (interface{}, error)) *SecurityClient { + return newSecurityClient(c, security) +} - return newSecurityClient(c) +func trueReflectValue(val reflect.Value) reflect.Value { + kind := val.Type().Kind() + for kind == reflect.Interface || kind == reflect.Ptr { + innerVal := val.Elem() + if !innerVal.IsValid() { + break + } + val = innerVal + kind = val.Type().Kind() + } + return val } -func parseSecurityStruct(c HTTPClient, security interface{}) *SecurityClient { - securityStructType := reflect.TypeOf(security) - securityValType := reflect.ValueOf(security) +func parseSecurityStruct(c *securityConfig, security interface{}) { + securityValType := trueReflectValue(reflect.ValueOf(security)) + securityStructType := securityValType.Type() if isNil(securityStructType, securityValType) { - return nil + return } if securityStructType.Kind() == reflect.Ptr { @@ -78,8 +101,6 @@ func parseSecurityStruct(c HTTPClient, security interface{}) *SecurityClient { securityValType = securityValType.Elem() } - client := newSecurityClient(c) - for i := 0; i < securityStructType.NumField(); i++ { fieldType := securityStructType.Field(i) valType := securityValType.Field(i) @@ -97,66 +118,51 @@ func parseSecurityStruct(c HTTPClient, security interface{}) *SecurityClient { secTag := parseSecurityTag(fieldType) if secTag != nil { if secTag.Option { - return parseSecurityOption(c, valType.Interface()) + handleSecurityOption(c, valType.Interface()) } else if secTag.Scheme { // Special case for basic auth which could be a flattened struct if secTag.SubType == "basic" && kind != reflect.Struct { - parseSecurityScheme(client, secTag, security) - return client + parseSecurityScheme(c, secTag, security) } else { - parseSecurityScheme(client, secTag, valType.Interface()) + parseSecurityScheme(c, secTag, valType.Interface()) } } } } - - return client } -func parseSecurityOption(c HTTPClient, option interface{}) *SecurityClient { - optionStructType := reflect.TypeOf(option) - optionValType := reflect.ValueOf(option) +func handleSecurityOption(c *securityConfig, option interface{}) error { + optionValType := trueReflectValue(reflect.ValueOf(option)) + optionStructType := optionValType.Type() if isNil(optionStructType, optionValType) { return nil } - if optionStructType.Kind() == reflect.Ptr { - optionStructType = optionStructType.Elem() - optionValType = optionValType.Elem() - } - - client := newSecurityClient(c) - for i := 0; i < optionStructType.NumField(); i++ { fieldType := optionStructType.Field(i) valType := optionValType.Field(i) secTag := parseSecurityTag(fieldType) if secTag != nil && secTag.Scheme { - parseSecurityScheme(client, secTag, valType.Interface()) + parseSecurityScheme(c, secTag, valType.Interface()) } } - return client + return nil } -func parseSecurityScheme(client *SecurityClient, schemeTag *securityTag, scheme interface{}) { - schemeType := reflect.TypeOf(scheme) - schemeVal := reflect.ValueOf(scheme) +func parseSecurityScheme(client *securityConfig, schemeTag *securityTag, scheme interface{}) { + schemeVal := trueReflectValue(reflect.ValueOf(scheme)) + schemeType := schemeVal.Type() if isNil(schemeType, schemeVal) { return } - if schemeType.Kind() == reflect.Ptr { - schemeType = schemeType.Elem() - schemeVal = schemeVal.Elem() - } - if schemeType.Kind() == reflect.Struct { if schemeTag.Type == "http" && schemeTag.SubType == "basic" { - parseBasicAuthScheme(client, schemeVal.Interface()) + handleBasicAuthScheme(client, schemeVal.Interface()) return } @@ -184,7 +190,7 @@ func parseSecurityScheme(client *SecurityClient, schemeTag *securityTag, scheme } } -func parseSecuritySchemeValue(client *SecurityClient, schemeTag *securityTag, secTag *securityTag, val interface{}) { +func parseSecuritySchemeValue(client *securityConfig, schemeTag *securityTag, secTag *securityTag, val interface{}) { switch schemeTag.Type { case "apiKey": switch schemeTag.SubType { @@ -221,7 +227,7 @@ func prefixBearer(authHeaderValue string) string { return fmt.Sprintf("Bearer %s", authHeaderValue) } -func parseBasicAuthScheme(client *SecurityClient, scheme interface{}) { +func handleBasicAuthScheme(client *securityConfig, scheme interface{}) { schemeStructType := reflect.TypeOf(scheme) schemeValType := reflect.ValueOf(scheme) diff --git a/previous-versions/commerce/pkg/utils/utils.go b/previous-versions/commerce/pkg/utils/utils.go index 87a4c4122..4ef632ae6 100755 --- a/previous-versions/commerce/pkg/utils/utils.go +++ b/previous-versions/commerce/pkg/utils/utils.go @@ -3,7 +3,6 @@ package utils import ( - "encoding/json" "fmt" "io" "math/big" @@ -13,8 +12,6 @@ import ( "time" "github.com/ericlagergren/decimal" - - "github.com/codatio/client-sdk-go/previous-versions/commerce/pkg/types" ) const ( @@ -34,12 +31,12 @@ var ( } ) -func UnmarshalJsonFromResponseBody(body io.Reader, out interface{}) error { +func UnmarshalJsonFromResponseBody(body io.Reader, out interface{}, tag string) error { data, err := io.ReadAll(body) if err != nil { return fmt.Errorf("error reading response body: %w", err) } - if err := json.Unmarshal(data, &out); err != nil { + if err := UnmarshalJSON(data, out, reflect.StructTag(tag), true, false); err != nil { return fmt.Errorf("error unmarshalling json response body: %w", err) } @@ -129,12 +126,8 @@ func valToString(val interface{}) string { switch v := val.(type) { case time.Time: return v.Format(time.RFC3339Nano) - case types.BigInt: - return v.String() case big.Int: return v.String() - case types.Decimal: - return v.String() case decimal.Big: return v.String() default: @@ -162,6 +155,14 @@ func populateFromGlobals(fieldType reflect.StructField, valType reflect.Value, p } func isNil(typ reflect.Type, val reflect.Value) bool { + // `reflect.TypeOf(nil) == nil` so calling typ.Kind() will cause a nil pointer + // dereference panic. Catch it and return early. + // https://github.com/golang/go/issues/51649 + // https://github.com/golang/go/issues/54208 + if typ == nil { + return true + } + if typ.Kind() == reflect.Ptr || typ.Kind() == reflect.Map || typ.Kind() == reflect.Slice || typ.Kind() == reflect.Interface { return val.IsNil() } diff --git a/previous-versions/commerce/products.go b/previous-versions/commerce/products.go index 002a7c54b..56213651c 100755 --- a/previous-versions/commerce/products.go +++ b/previous-versions/commerce/products.go @@ -1,6 +1,6 @@ // Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. -package codatcommerce +package commerce import ( "bytes" @@ -55,7 +55,7 @@ func (s *products) Get(ctx context.Context, request operations.GetProductRequest return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) client := s.sdkConfiguration.SecurityClient @@ -95,13 +95,6 @@ func (s *products) Get(ctx context.Context, request operations.GetProductRequest return nil, fmt.Errorf("error sending request: no response") } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") res := &operations.GetProductResponse{ @@ -109,16 +102,23 @@ func (s *products) Get(ctx context.Context, request operations.GetProductRequest ContentType: contentType, RawResponse: httpRes, } + + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.Product - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.Product + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.Product = out + res.Product = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -131,12 +131,12 @@ func (s *products) Get(ctx context.Context, request operations.GetProductRequest case httpRes.StatusCode == 429: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ErrorMessage - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ErrorMessage + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ErrorMessage = out + res.ErrorMessage = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -175,7 +175,7 @@ func (s *products) GetCategory(ctx context.Context, request operations.GetProduc return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) client := s.sdkConfiguration.SecurityClient @@ -215,13 +215,6 @@ func (s *products) GetCategory(ctx context.Context, request operations.GetProduc return nil, fmt.Errorf("error sending request: no response") } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") res := &operations.GetProductCategoryResponse{ @@ -229,16 +222,23 @@ func (s *products) GetCategory(ctx context.Context, request operations.GetProduc ContentType: contentType, RawResponse: httpRes, } + + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ProductCategory - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ProductCategory + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ProductCategory = out + res.ProductCategory = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -251,12 +251,12 @@ func (s *products) GetCategory(ctx context.Context, request operations.GetProduc case httpRes.StatusCode == 429: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ErrorMessage - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ErrorMessage + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ErrorMessage = out + res.ErrorMessage = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -293,7 +293,7 @@ func (s *products) List(ctx context.Context, request operations.ListProductsRequ return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) @@ -337,13 +337,6 @@ func (s *products) List(ctx context.Context, request operations.ListProductsRequ return nil, fmt.Errorf("error sending request: no response") } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") res := &operations.ListProductsResponse{ @@ -351,16 +344,23 @@ func (s *products) List(ctx context.Context, request operations.ListProductsRequ ContentType: contentType, RawResponse: httpRes, } + + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.Products - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.Products + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.Products = out + res.Products = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -375,12 +375,12 @@ func (s *products) List(ctx context.Context, request operations.ListProductsRequ case httpRes.StatusCode == 429: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ErrorMessage - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ErrorMessage + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ErrorMessage = out + res.ErrorMessage = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -417,7 +417,7 @@ func (s *products) ListCategories(ctx context.Context, request operations.ListPr return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) @@ -461,13 +461,6 @@ func (s *products) ListCategories(ctx context.Context, request operations.ListPr return nil, fmt.Errorf("error sending request: no response") } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") res := &operations.ListProductCategoriesResponse{ @@ -475,16 +468,23 @@ func (s *products) ListCategories(ctx context.Context, request operations.ListPr ContentType: contentType, RawResponse: httpRes, } + + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ProductCategories - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ProductCategories + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ProductCategories = out + res.ProductCategories = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -499,12 +499,12 @@ func (s *products) ListCategories(ctx context.Context, request operations.ListPr case httpRes.StatusCode == 429: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ErrorMessage - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ErrorMessage + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ErrorMessage = out + res.ErrorMessage = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } diff --git a/previous-versions/commerce/taxcomponents.go b/previous-versions/commerce/taxcomponents.go index e043b27f8..f51bf731f 100755 --- a/previous-versions/commerce/taxcomponents.go +++ b/previous-versions/commerce/taxcomponents.go @@ -1,6 +1,6 @@ // Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. -package codatcommerce +package commerce import ( "bytes" @@ -55,7 +55,7 @@ func (s *taxComponents) Get(ctx context.Context, request operations.GetTaxCompon return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) client := s.sdkConfiguration.SecurityClient @@ -95,13 +95,6 @@ func (s *taxComponents) Get(ctx context.Context, request operations.GetTaxCompon return nil, fmt.Errorf("error sending request: no response") } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") res := &operations.GetTaxComponentResponse{ @@ -109,16 +102,23 @@ func (s *taxComponents) Get(ctx context.Context, request operations.GetTaxCompon ContentType: contentType, RawResponse: httpRes, } + + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.TaxComponent - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.TaxComponent + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.TaxComponent = out + res.TaxComponent = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -131,12 +131,12 @@ func (s *taxComponents) Get(ctx context.Context, request operations.GetTaxCompon case httpRes.StatusCode == 429: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ErrorMessage - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ErrorMessage + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ErrorMessage = out + res.ErrorMessage = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -173,7 +173,7 @@ func (s *taxComponents) List(ctx context.Context, request operations.ListTaxComp return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) @@ -217,13 +217,6 @@ func (s *taxComponents) List(ctx context.Context, request operations.ListTaxComp return nil, fmt.Errorf("error sending request: no response") } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") res := &operations.ListTaxComponentsResponse{ @@ -231,16 +224,23 @@ func (s *taxComponents) List(ctx context.Context, request operations.ListTaxComp ContentType: contentType, RawResponse: httpRes, } + + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.TaxComponents - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.TaxComponents + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.TaxComponents = out + res.TaxComponents = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -255,12 +255,12 @@ func (s *taxComponents) List(ctx context.Context, request operations.ListTaxComp case httpRes.StatusCode == 429: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ErrorMessage - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ErrorMessage + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ErrorMessage = out + res.ErrorMessage = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } diff --git a/previous-versions/commerce/transactions.go b/previous-versions/commerce/transactions.go index 5975c66dc..52677b2cb 100755 --- a/previous-versions/commerce/transactions.go +++ b/previous-versions/commerce/transactions.go @@ -1,6 +1,6 @@ // Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. -package codatcommerce +package commerce import ( "bytes" @@ -55,7 +55,7 @@ func (s *transactions) Get(ctx context.Context, request operations.GetTransactio return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) client := s.sdkConfiguration.SecurityClient @@ -95,13 +95,6 @@ func (s *transactions) Get(ctx context.Context, request operations.GetTransactio return nil, fmt.Errorf("error sending request: no response") } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") res := &operations.GetTransactionResponse{ @@ -109,16 +102,23 @@ func (s *transactions) Get(ctx context.Context, request operations.GetTransactio ContentType: contentType, RawResponse: httpRes, } + + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.Transaction - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.Transaction + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.Transaction = out + res.Transaction = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -131,12 +131,12 @@ func (s *transactions) Get(ctx context.Context, request operations.GetTransactio case httpRes.StatusCode == 429: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ErrorMessage - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ErrorMessage + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ErrorMessage = out + res.ErrorMessage = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -173,7 +173,7 @@ func (s *transactions) List(ctx context.Context, request operations.ListTransact return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) @@ -217,13 +217,6 @@ func (s *transactions) List(ctx context.Context, request operations.ListTransact return nil, fmt.Errorf("error sending request: no response") } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") res := &operations.ListTransactionsResponse{ @@ -231,16 +224,23 @@ func (s *transactions) List(ctx context.Context, request operations.ListTransact ContentType: contentType, RawResponse: httpRes, } + + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.Transactions - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.Transactions + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.Transactions = out + res.Transactions = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } @@ -255,12 +255,12 @@ func (s *transactions) List(ctx context.Context, request operations.ListTransact case httpRes.StatusCode == 429: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ErrorMessage - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ErrorMessage + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ErrorMessage = out + res.ErrorMessage = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) }