Skip to content

Commit

Permalink
Merge pull request #338 from codatio/speakeasy-sdk-regen-1695399985
Browse files Browse the repository at this point in the history
chore: speakeasy sdk regeneration - Generate Sync for Payables library
  • Loading branch information
dcoplowe authored Sep 22, 2023
2 parents ae1a971 + 924927e commit a57a863
Show file tree
Hide file tree
Showing 142 changed files with 2,895 additions and 1,662 deletions.
74 changes: 53 additions & 21 deletions sync-for-payables/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,57 +12,56 @@ go get github.com/codatio/client-sdk-go/sync-for-payables

## Example Usage
<!-- Start SDK Example Usage -->


```go
package main

import(
"context"
"log"
"github.com/codatio/client-sdk-go/sync-for-payables"
"github.com/codatio/client-sdk-go/sync-for-payables/pkg/models/shared"
"github.com/codatio/client-sdk-go/sync-for-payables/pkg/models/operations"
syncforpayables "github.com/codatio/client-sdk-go/sync-for-payables/v2"
"github.com/codatio/client-sdk-go/sync-for-payables/v2/pkg/models/shared"
"github.com/codatio/client-sdk-go/sync-for-payables/v2/pkg/models/operations"
"github.com/codatio/client-sdk-go/sync-for-payables/v2/pkg/types"
)

func main() {
s := codatsyncpayables.New(
codatsyncpayables.WithSecurity(shared.Security{
s := syncforpayables.New(
syncforpayables.WithSecurity(shared.Security{
AuthHeader: "Basic BASE_64_ENCODED(API_KEY)",
}),
)

ctx := context.Background()
res, err := s.Accounts.Create(ctx, operations.CreateAccountRequest{
Account: &shared.Account{
Currency: codatsyncpayables.String("USD"),
Currency: syncforpayables.String("EUR"),
CurrentBalance: types.MustNewDecimalFromString("0"),
Description: codatsyncpayables.String("Invoices the business has issued but has not yet collected payment on."),
FullyQualifiedCategory: codatsyncpayables.String("Asset.Current"),
FullyQualifiedName: codatsyncpayables.String("Fixed Asset"),
ID: codatsyncpayables.String("1b6266d1-1e44-46c5-8eb5-a8f98e03124e"),
IsBankAccount: codatsyncpayables.Bool(false),
Description: syncforpayables.String("Invoices the business has issued but has not yet collected payment on."),
FullyQualifiedCategory: syncforpayables.String("Asset.Current"),
FullyQualifiedName: syncforpayables.String("Cash On Hand"),
ID: syncforpayables.String("1b6266d1-1e44-46c5-8eb5-a8f98e03124e"),
IsBankAccount: syncforpayables.Bool(false),
Metadata: &shared.Metadata{
IsDeleted: codatsyncpayables.Bool(false),
IsDeleted: syncforpayables.Bool(false),
},
ModifiedDate: codatsyncpayables.String("2022-10-23T00:00:00.000Z"),
Name: codatsyncpayables.String("Accounts Receivable"),
NominalCode: codatsyncpayables.String("610"),
SourceModifiedDate: codatsyncpayables.String("2022-10-23T00:00:00.000Z"),
ModifiedDate: syncforpayables.String("2022-10-23T00:00:00.000Z"),
Name: syncforpayables.String("Accounts Receivable"),
NominalCode: syncforpayables.String("610"),
SourceModifiedDate: syncforpayables.String("2022-10-23T00:00:00.000Z"),
Status: shared.AccountStatusActive.ToPointer(),
Type: shared.AccountTypeAsset.ToPointer(),
ValidDatatypeLinks: []shared.AccountValidDataTypeLinks{
shared.AccountValidDataTypeLinks{
Links: []string{
"unde",
"suscipit",
},
Property: codatsyncpayables.String("nulla"),
Property: syncforpayables.String("iure"),
},
},
},
CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002",
ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171",
TimeoutInMinutes: codatsyncpayables.Int(544883),
TimeoutInMinutes: syncforpayables.Int(297534),
})
if err != nil {
log.Fatal(err)
Expand Down Expand Up @@ -106,6 +105,7 @@ func main() {

* [Create](docs/sdks/bills/README.md#create) - Create bill
* [Delete](docs/sdks/bills/README.md#delete) - Delete bill
* [DeleteAttachment](docs/sdks/bills/README.md#deleteattachment) - Delete bill attachment
* [DownloadAttachment](docs/sdks/bills/README.md#downloadattachment) - Download bill attachment
* [Get](docs/sdks/bills/README.md#get) - Get bill
* [GetAttachment](docs/sdks/bills/README.md#getattachment) - Get bill attachment
Expand Down Expand Up @@ -183,4 +183,36 @@ func main() {
* [Get](docs/sdks/trackingcategories/README.md#get) - Get tracking categories
* [List](docs/sdks/trackingcategories/README.md#list) - List tracking categories
<!-- End SDK Available Operations -->



<!-- Start Dev Containers -->



<!-- End Dev Containers -->



<!-- Start Pagination -->
# Pagination

Some of the endpoints in this SDK support pagination. To use pagination, you make your SDK calls as usual, but the
returned response object will have a `Next` method that can be called to pull down the next group of results. If the
return value of `Next` is `nil`, then there are no more pages to be fetched.

Here's an example of one such pagination call:


<!-- End Pagination -->



<!-- Start Go Types -->

<!-- End Go Types -->

<!-- Placeholder for Future Speakeasy SDK Sections -->


### Library generated by [Speakeasy](https://docs.speakeasyapi.dev/docs/using-speakeasy/client-sdks)
12 changes: 11 additions & 1 deletion sync-for-payables/RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,14 @@ Based on:
### Generated
- [go v1.1.0] sync-for-payables
### Releases
- [Go v1.1.0] https://github.com/codatio/client-sdk-go/releases/tag/sync-for-payables/v1.1.0 - sync-for-payables
- [Go v1.1.0] https://github.com/codatio/client-sdk-go/releases/tag/sync-for-payables/v1.1.0 - sync-for-payables

## 2023-09-22 16:26:20
### Changes
Based on:
- OpenAPI Doc 3.0.0 https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Sync-Payables.yaml
- Speakeasy CLI 1.90.0 (2.125.1) https://github.com/speakeasy-api/speakeasy
### Generated
- [go v2.1.0] sync-for-payables
### Releases
- [Go v2.1.0] https://github.com/codatio/client-sdk-go/releases/tag/sync-for-payables/v2.1.0 - sync-for-payables
37 changes: 19 additions & 18 deletions sync-for-payables/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,50 @@ package main
import(
"context"
"log"
"github.com/codatio/client-sdk-go/sync-for-payables"
"github.com/codatio/client-sdk-go/sync-for-payables/pkg/models/shared"
"github.com/codatio/client-sdk-go/sync-for-payables/pkg/models/operations"
syncforpayables "github.com/codatio/client-sdk-go/sync-for-payables/v2"
"github.com/codatio/client-sdk-go/sync-for-payables/v2/pkg/models/shared"
"github.com/codatio/client-sdk-go/sync-for-payables/v2/pkg/models/operations"
"github.com/codatio/client-sdk-go/sync-for-payables/v2/pkg/types"
)

func main() {
s := codatsyncpayables.New(
codatsyncpayables.WithSecurity(shared.Security{
s := syncforpayables.New(
syncforpayables.WithSecurity(shared.Security{
AuthHeader: "Basic BASE_64_ENCODED(API_KEY)",
}),
)

ctx := context.Background()
res, err := s.Accounts.Create(ctx, operations.CreateAccountRequest{
Account: &shared.Account{
Currency: codatsyncpayables.String("USD"),
Currency: syncforpayables.String("USD"),
CurrentBalance: types.MustNewDecimalFromString("0"),
Description: codatsyncpayables.String("Invoices the business has issued but has not yet collected payment on."),
FullyQualifiedCategory: codatsyncpayables.String("Asset.Current"),
FullyQualifiedName: codatsyncpayables.String("Fixed Asset"),
ID: codatsyncpayables.String("1b6266d1-1e44-46c5-8eb5-a8f98e03124e"),
IsBankAccount: codatsyncpayables.Bool(false),
Description: syncforpayables.String("Invoices the business has issued but has not yet collected payment on."),
FullyQualifiedCategory: syncforpayables.String("Asset.Current"),
FullyQualifiedName: syncforpayables.String("Fixed Asset"),
ID: syncforpayables.String("1b6266d1-1e44-46c5-8eb5-a8f98e03124e"),
IsBankAccount: syncforpayables.Bool(false),
Metadata: &shared.Metadata{
IsDeleted: codatsyncpayables.Bool(false),
IsDeleted: syncforpayables.Bool(false),
},
ModifiedDate: codatsyncpayables.String("2022-10-23T00:00:00.000Z"),
Name: codatsyncpayables.String("Accounts Receivable"),
NominalCode: codatsyncpayables.String("610"),
SourceModifiedDate: codatsyncpayables.String("2022-10-23T00:00:00.000Z"),
ModifiedDate: syncforpayables.String("2022-10-23T00:00:00.000Z"),
Name: syncforpayables.String("Accounts Receivable"),
NominalCode: syncforpayables.String("610"),
SourceModifiedDate: syncforpayables.String("2022-10-23T00:00:00.000Z"),
Status: shared.AccountStatusActive.ToPointer(),
Type: shared.AccountTypeAsset.ToPointer(),
ValidDatatypeLinks: []shared.AccountValidDataTypeLinks{
shared.AccountValidDataTypeLinks{
Links: []string{
"unde",
},
Property: codatsyncpayables.String("nulla"),
Property: syncforpayables.String("nulla"),
},
},
},
CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002",
ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171",
TimeoutInMinutes: codatsyncpayables.Int(544883),
TimeoutInMinutes: syncforpayables.Int(544883),
})
if err != nil {
log.Fatal(err)
Expand Down
60 changes: 30 additions & 30 deletions sync-for-payables/accounts.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.

package codatsyncpayables
package syncforpayables

import (
"bytes"
"context"
"fmt"
"github.com/codatio/client-sdk-go/sync-for-payables/pkg/models/operations"
"github.com/codatio/client-sdk-go/sync-for-payables/pkg/models/sdkerrors"
"github.com/codatio/client-sdk-go/sync-for-payables/pkg/models/shared"
"github.com/codatio/client-sdk-go/sync-for-payables/pkg/utils"
"github.com/codatio/client-sdk-go/sync-for-payables/v2/pkg/models/operations"
"github.com/codatio/client-sdk-go/sync-for-payables/v2/pkg/models/sdkerrors"
"github.com/codatio/client-sdk-go/sync-for-payables/v2/pkg/models/shared"
"github.com/codatio/client-sdk-go/sync-for-payables/v2/pkg/utils"
"io"
"net/http"
)
Expand Down Expand Up @@ -52,7 +52,7 @@ func (s *accounts) Create(ctx context.Context, request operations.CreateAccountR
return nil, fmt.Errorf("error generating URL: %w", err)
}

bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Account", "json")
bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, true, true, "Account", "json", `request:"mediaType=application/json"`)
if err != nil {
return nil, fmt.Errorf("error serializing request body: %w", err)
}
Expand Down Expand Up @@ -126,12 +126,12 @@ func (s *accounts) Create(ctx context.Context, request operations.CreateAccountR
case httpRes.StatusCode == 200:
switch {
case utils.MatchContentType(contentType, `application/json`):
var out *shared.CreateAccountResponse
if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil {
var out shared.CreateAccountResponse
if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
return nil, err
}

res.CreateAccountResponse = out
res.CreateAccountResponse = &out
default:
return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes)
}
Expand All @@ -144,12 +144,12 @@ func (s *accounts) Create(ctx context.Context, request operations.CreateAccountR
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)
}
Expand Down Expand Up @@ -246,12 +246,12 @@ func (s *accounts) Get(ctx context.Context, request operations.GetAccountRequest
case httpRes.StatusCode == 200:
switch {
case utils.MatchContentType(contentType, `application/json`):
var out *shared.Account
if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil {
var out shared.Account
if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
return nil, err
}

res.Account = out
res.Account = &out
default:
return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes)
}
Expand All @@ -264,12 +264,12 @@ func (s *accounts) Get(ctx context.Context, request operations.GetAccountRequest
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)
}
Expand Down Expand Up @@ -368,12 +368,12 @@ func (s *accounts) GetCreateModel(ctx context.Context, request operations.GetCre
case httpRes.StatusCode == 200:
switch {
case utils.MatchContentType(contentType, `application/json`):
var out *shared.PushOption
if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil {
var out shared.PushOption
if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
return nil, err
}

res.PushOption = out
res.PushOption = &out
default:
return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes)
}
Expand All @@ -384,12 +384,12 @@ func (s *accounts) GetCreateModel(ctx context.Context, request operations.GetCre
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)
}
Expand Down Expand Up @@ -488,12 +488,12 @@ func (s *accounts) List(ctx context.Context, request operations.ListAccountsRequ
case httpRes.StatusCode == 200:
switch {
case utils.MatchContentType(contentType, `application/json`):
var out *shared.Accounts
if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil {
var out shared.Accounts
if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
return nil, err
}

res.Accounts = out
res.Accounts = &out
default:
return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes)
}
Expand All @@ -506,12 +506,12 @@ func (s *accounts) List(ctx context.Context, request operations.ListAccountsRequ
case httpRes.StatusCode == 409:
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)
}
Expand Down
Loading

0 comments on commit a57a863

Please sign in to comment.