Skip to content

Commit

Permalink
Merge pull request #458 from codatio/speakeasy-sdk-regen-1700565503
Browse files Browse the repository at this point in the history
chore: 🐝 Update SDK - Generate Bank Feeds library
  • Loading branch information
dcoplowe authored Nov 21, 2023
2 parents 0ea02a3 + eea212e commit 8d25623
Show file tree
Hide file tree
Showing 215 changed files with 1,813 additions and 1,389 deletions.
Empty file modified bank-feeds/.gitattributes
100755 → 100644
Empty file.
356 changes: 341 additions & 15 deletions bank-feeds/README.md

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion bank-feeds/RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -400,4 +400,14 @@ Based on:
### Generated
- [go v3.2.0] bank-feeds
### Releases
- [Go v3.2.0] https://github.com/codatio/client-sdk-go/releases/tag/bank-feeds/v3.2.0 - bank-feeds
- [Go v3.2.0] https://github.com/codatio/client-sdk-go/releases/tag/bank-feeds/v3.2.0 - bank-feeds

## 2023-11-21 11:18:19
### Changes
Based on:
- OpenAPI Doc 3.0.0 https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Bank-Feeds.yaml
- Speakeasy CLI 1.121.3 (2.195.2) https://github.com/speakeasy-api/speakeasy
### Generated
- [go v4.0.0] bank-feeds
### Releases
- [Go v4.0.0] https://github.com/codatio/client-sdk-go/releases/tag/bank-feeds/v4.0.0 - bank-feeds
18 changes: 6 additions & 12 deletions bank-feeds/USAGE.md
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
<!-- Start SDK Example Usage -->


```go
package main

import (
"context"
bankfeeds "github.com/codatio/client-sdk-go/bank-feeds/v3"
"github.com/codatio/client-sdk-go/bank-feeds/v3/pkg/models/operations"
"github.com/codatio/client-sdk-go/bank-feeds/v3/pkg/models/shared"
bankfeeds "github.com/codatio/client-sdk-go/bank-feeds/v4"
"github.com/codatio/client-sdk-go/bank-feeds/v4/pkg/models/shared"
"log"
)

Expand All @@ -20,18 +17,15 @@ func main() {
)

ctx := context.Background()
res, err := s.AccountMapping.Create(ctx, operations.CreateBankAccountMappingRequest{
RequestBody: &operations.CreateBankAccountMappingBankFeedAccountMapping{
FeedStartDate: bankfeeds.String("2022-10-23T00:00:00.000Z"),
},
CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002",
ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171",
res, err := s.Companies.Create(ctx, &shared.CompanyRequestBody{
Description: bankfeeds.String("Requested early access to the new financing scheme."),
Name: "Bank of Dave",
})
if err != nil {
log.Fatal(err)
}

if res.BankFeedAccountMappingResponse != nil {
if res.Company != nil {
// handle response
}
}
Expand Down
58 changes: 41 additions & 17 deletions bank-feeds/accountmapping.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ import (
"bytes"
"context"
"fmt"
"github.com/codatio/client-sdk-go/bank-feeds/v3/pkg/models/operations"
"github.com/codatio/client-sdk-go/bank-feeds/v3/pkg/models/sdkerrors"
"github.com/codatio/client-sdk-go/bank-feeds/v3/pkg/models/shared"
"github.com/codatio/client-sdk-go/bank-feeds/v3/pkg/utils"
"github.com/codatio/client-sdk-go/bank-feeds/v4/pkg/models/operations"
"github.com/codatio/client-sdk-go/bank-feeds/v4/pkg/models/sdkerrors"
"github.com/codatio/client-sdk-go/bank-feeds/v4/pkg/models/shared"
"github.com/codatio/client-sdk-go/bank-feeds/v4/pkg/utils"
"io"
"net/http"
)

// accountMapping - Bank feed bank account mapping.
type accountMapping struct {
// AccountMapping - Bank feed bank account mapping.
type AccountMapping struct {
sdkConfiguration sdkConfiguration
}

func newAccountMapping(sdkConfig sdkConfiguration) *accountMapping {
return &accountMapping{
func newAccountMapping(sdkConfig sdkConfiguration) *AccountMapping {
return &AccountMapping{
sdkConfiguration: sdkConfig,
}
}
Expand All @@ -33,7 +33,7 @@ func newAccountMapping(sdkConfig sdkConfiguration) *accountMapping {
// To find valid target account options, first call list bank feed account mappings.
//
// This endpoint is only needed if building an account management UI.
func (s *accountMapping) Create(ctx context.Context, request operations.CreateBankAccountMappingRequest, opts ...operations.Option) (*operations.CreateBankAccountMappingResponse, error) {
func (s *AccountMapping) Create(ctx context.Context, request operations.CreateBankAccountMappingRequest, opts ...operations.Option) (*operations.CreateBankAccountMappingResponse, error) {
o := operations.Options{}
supportedOptions := []string{
operations.SupportedOptionRetries,
Expand All @@ -50,7 +50,7 @@ func (s *accountMapping) Create(ctx context.Context, request operations.CreateBa
return nil, fmt.Errorf("error generating URL: %w", err)
}

bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "RequestBody", "json", `request:"mediaType=application/json"`)
bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Zero", "json", `request:"mediaType=application/json"`)
if err != nil {
return nil, fmt.Errorf("error serializing request body: %w", err)
}
Expand Down Expand Up @@ -133,20 +133,31 @@ func (s *accountMapping) Create(ctx context.Context, request operations.CreateBa
fallthrough
case httpRes.StatusCode == 401:
fallthrough
case httpRes.StatusCode == 402:
fallthrough
case httpRes.StatusCode == 403:
fallthrough
case httpRes.StatusCode == 404:
fallthrough
case httpRes.StatusCode == 429:
fallthrough
case httpRes.StatusCode == 500:
fallthrough
case httpRes.StatusCode == 503:
switch {
case utils.MatchContentType(contentType, `application/json`):
var out shared.ErrorMessage
var out sdkerrors.ErrorMessage
if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
return nil, err
}

res.ErrorMessage = &out
return nil, &out
default:
return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes)
}
case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500:
fallthrough
case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600:
return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes)
}

return res, nil
Expand All @@ -158,7 +169,7 @@ func (s *accountMapping) Create(ctx context.Context, request operations.CreateBa
// A bank feed account mapping is a specified link between the source account (provided by the Codat user) and the target account (the end users account in the underlying platform).
//
// This endpoint is only needed if building an account management UI.
func (s *accountMapping) Get(ctx context.Context, request operations.GetBankAccountMappingRequest, opts ...operations.Option) (*operations.GetBankAccountMappingResponse, error) {
func (s *AccountMapping) Get(ctx context.Context, request operations.GetBankAccountMappingRequest, opts ...operations.Option) (*operations.GetBankAccountMappingResponse, error) {
o := operations.Options{}
supportedOptions := []string{
operations.SupportedOptionRetries,
Expand Down Expand Up @@ -249,18 +260,31 @@ func (s *accountMapping) Get(ctx context.Context, request operations.GetBankAcco
}
case httpRes.StatusCode == 401:
fallthrough
case httpRes.StatusCode == 402:
fallthrough
case httpRes.StatusCode == 403:
fallthrough
case httpRes.StatusCode == 404:
fallthrough
case httpRes.StatusCode == 429:
fallthrough
case httpRes.StatusCode == 500:
fallthrough
case httpRes.StatusCode == 503:
switch {
case utils.MatchContentType(contentType, `application/json`):
var out shared.ErrorMessage
var out sdkerrors.ErrorMessage
if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
return nil, err
}

res.ErrorMessage = &out
return nil, &out
default:
return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes)
}
case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500:
fallthrough
case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600:
return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes)
}

return res, nil
Expand Down
26 changes: 13 additions & 13 deletions bank-feeds/codatbankfeeds.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ package bankfeeds
import (
"context"
"fmt"
"github.com/codatio/client-sdk-go/bank-feeds/v3/pkg/models/shared"
"github.com/codatio/client-sdk-go/bank-feeds/v3/pkg/utils"
"github.com/codatio/client-sdk-go/bank-feeds/v4/pkg/models/shared"
"github.com/codatio/client-sdk-go/bank-feeds/v4/pkg/utils"
"net/http"
"time"
)
Expand Down Expand Up @@ -80,16 +80,16 @@ func (c *sdkConfiguration) GetServerDetails() (string, map[string]string) {
// | Transactions | Create new bank account transactions for a company's connections, and see previous operations. |
// | Account mapping | Extra functionality for building an account management UI |
type CodatBankFeeds struct {
// Bank feed bank account mapping.
AccountMapping *accountMapping
// Create and manage your Codat companies.
Companies *companies
Companies *Companies
// Manage your companies' data connections.
Connections *connections
Connections *Connections
// Bank feed bank account mapping.
AccountMapping *AccountMapping
// Source accounts act as a bridge to bank accounts in accounting software.
SourceAccounts *sourceAccounts
SourceAccounts *SourceAccounts
// Transactions represent debits and credits from a source account.
Transactions *transactions
Transactions *Transactions

sdkConfiguration sdkConfiguration
}
Expand Down Expand Up @@ -167,9 +167,9 @@ func New(opts ...SDKOption) *CodatBankFeeds {
sdkConfiguration: sdkConfiguration{
Language: "go",
OpenAPIDocVersion: "3.0.0",
SDKVersion: "3.2.0",
GenVersion: "2.159.2",
UserAgent: "speakeasy-sdk/go 3.2.0 2.159.2 3.0.0 github.com/codatio/client-sdk-go/bank-feeds",
SDKVersion: "4.0.0",
GenVersion: "2.195.2",
UserAgent: "speakeasy-sdk/go 4.0.0 2.195.2 3.0.0 github.com/codatio/client-sdk-go/bank-feeds",
},
}
for _, opt := range opts {
Expand All @@ -188,12 +188,12 @@ func New(opts ...SDKOption) *CodatBankFeeds {
}
}

sdk.AccountMapping = newAccountMapping(sdk.sdkConfiguration)

sdk.Companies = newCompanies(sdk.sdkConfiguration)

sdk.Connections = newConnections(sdk.sdkConfiguration)

sdk.AccountMapping = newAccountMapping(sdk.sdkConfiguration)

sdk.SourceAccounts = newSourceAccounts(sdk.sdkConfiguration)

sdk.Transactions = newTransactions(sdk.sdkConfiguration)
Expand Down
Loading

0 comments on commit 8d25623

Please sign in to comment.