Skip to content

Commit 1ab7b66

Browse files
github-actions[bot]speakeasybotpj-simpson
authored
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.709.1 (#343)
Co-authored-by: speakeasybot <bot@speakeasyapi.dev> Co-authored-by: Peter Simpson <40800258+pj-simpson@users.noreply.github.com>
1 parent 3ab2996 commit 1ab7b66

File tree

189 files changed

+7320
-2430
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

189 files changed

+7320
-2430
lines changed

.speakeasy/workflow.lock

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
speakeasyVersion: 1.709.1
12
speakeasyVersion: 1.701.0
23
sources:
34
bank-feeds-source:
@@ -42,11 +43,11 @@ sources:
4243
- prealpha
4344
sync-for-payables-source:
4445
sourceNamespace: sync-for-payables-source
45-
sourceRevisionDigest: sha256:9bf594a869e0b9e326b3437e9661b5a7f2f7da420d4fb7375a4a9938a168951c
46-
sourceBlobDigest: sha256:57b656eed2c5a98f97da8f59e196bb8052ead3cc7c87673cdf5e19c6badbb570
46+
sourceRevisionDigest: sha256:9bd9e36fdb60e3d73fe7cc209c24ce0325919a523acec3edd84ee2f26420bedc
47+
sourceBlobDigest: sha256:59b5c9d3aa1a43fa4186c6ae1bf1108bf40d44d22f65ed6118b763574e0cf669
4748
tags:
4849
- latest
49-
- speakeasy-sdk-regen-1732641065
50+
- speakeasy-sdk-regen-1770645493
5051
- 3.0.0
5152
sync-for-payables-version-1-source:
5253
sourceNamespace: sync-for-payables-version-1-source
@@ -101,10 +102,10 @@ targets:
101102
sync-for-payables-library:
102103
source: sync-for-payables-source
103104
sourceNamespace: sync-for-payables-source
104-
sourceRevisionDigest: sha256:9bf594a869e0b9e326b3437e9661b5a7f2f7da420d4fb7375a4a9938a168951c
105-
sourceBlobDigest: sha256:57b656eed2c5a98f97da8f59e196bb8052ead3cc7c87673cdf5e19c6badbb570
106-
codeSamplesNamespace: sync-for-payables-source-code-samples
107-
codeSamplesRevisionDigest: sha256:956525cb89c12c0ab52334de08ce92639ff61c9c97e9a34aa55aa2e9a4177fe6
105+
sourceRevisionDigest: sha256:9bd9e36fdb60e3d73fe7cc209c24ce0325919a523acec3edd84ee2f26420bedc
106+
sourceBlobDigest: sha256:59b5c9d3aa1a43fa4186c6ae1bf1108bf40d44d22f65ed6118b763574e0cf669
107+
codeSamplesNamespace: sync-for-payables-source-csharp-code-samples
108+
codeSamplesRevisionDigest: sha256:30bcb4eb66da40861ecadbd3ff5846ab49f3c978ac1fa7a46ef43be2f525c071
108109
sync-for-payables-version-1-library:
109110
source: sync-for-payables-version-1-source
110111
sourceNamespace: sync-for-payables-version-1-source

sync-for-payables/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
.DS_Store
2+
**/.speakeasy/temp/
3+
**/.speakeasy/logs/
4+
.env
5+
.env.local
16
obj/
27
bin/
38
debug/

sync-for-payables/.speakeasy/gen.lock

Lines changed: 1661 additions & 450 deletions
Large diffs are not rendered by default.

sync-for-payables/.speakeasy/gen.yaml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,44 @@ generation:
44
maintainOpenAPIOrder: true
55
usageSnippets:
66
optionalPropertyRendering: withExample
7+
sdkInitStyle: constructor
78
useClassNamesForArrayFields: true
89
fixes:
910
nameResolutionDec2023: true
11+
nameResolutionFeb2025: false
1012
parameterOrderingFeb2024: true
1113
requestResponseComponentNamesFeb2024: true
14+
securityFeb2025: false
15+
sharedErrorComponentsApr2025: false
16+
sharedNestedComponentsJan2026: false
1217
auth:
1318
oAuth2ClientCredentialsEnabled: false
1419
oAuth2PasswordEnabled: false
20+
hoistGlobalSecurity: true
21+
schemas:
22+
allOfMergeStrategy: shallowMerge
23+
requestBodyFieldName: ""
24+
versioningStrategy: automatic
25+
persistentEdits: {}
26+
tests:
27+
generateTests: true
28+
generateNewTests: false
29+
skipResponseBodyAssertions: false
1530
csharp:
16-
version: 10.0.0
31+
version: 10.1.0
1732
additionalDependencies: []
1833
author: Codat
34+
baseErrorName: CodatSyncPayablesException
1935
clientServerStatusCodesAsErrors: true
2036
defaultErrorName: SDKException
2137
description: Streamline your customers' accounts payable workflow.
2238
disableNamespacePascalCasingApr2024: true
2339
dotnetVersion: net8.0
40+
enableCancellationToken: false
2441
enableSourceLink: false
2542
flattenGlobalSecurity: true
2643
flatteningOrder: ""
44+
httpClientPrefix: Speakeasy
2745
imports:
2846
option: openapi
2947
paths:
@@ -33,11 +51,15 @@ csharp:
3351
shared: Models/Components
3452
webhooks: Models/Webhooks
3553
includeDebugSymbols: false
54+
inferUnionDiscriminators: false
3655
inputModelSuffix: input
3756
maxMethodParams: 0
3857
methodArguments: infer-optional-args
58+
multipartArrayFormat: legacy
3959
outputModelSuffix: output
4060
packageName: Codat.Sync.Payables
4161
packageTags: ""
62+
respectTitlesForPrimitiveUnionMembers: false
4263
responseFormat: envelope
4364
sourceDirectory: ""
65+
useNodatime: true

sync-for-payables/Codat/Sync/Payables/BankAccounts.cs

Lines changed: 110 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -13,63 +13,86 @@ namespace Codat.Sync.Payables
1313
using Codat.Sync.Payables.Models.Components;
1414
using Codat.Sync.Payables.Models.Errors;
1515
using Codat.Sync.Payables.Models.Requests;
16-
using Codat.Sync.Payables.Utils.Retries;
1716
using Codat.Sync.Payables.Utils;
17+
using Codat.Sync.Payables.Utils.Retries;
1818
using Newtonsoft.Json;
19+
using System;
1920
using System.Collections.Generic;
20-
using System.Net.Http.Headers;
2121
using System.Net.Http;
22+
using System.Net.Http.Headers;
2223
using System.Threading.Tasks;
23-
using System;
2424

2525
/// <summary>
26-
/// Create a bank account for a given company&apos;s connection.
26+
/// Create a bank account for a given company's connection.
2727
/// </summary>
2828
public interface IBankAccounts
2929
{
30-
3130
/// <summary>
32-
/// Create bank account
33-
///
31+
/// Create bank account.
32+
/// </summary>
3433
/// <remarks>
35-
/// The *Create bank account* endpoint creates a new <a href="https://docs.codat.io/sync-for-payables-api#/schemas/BankAccount">bank account</a> for a given company&apos;s connection.<br/>
34+
/// The *Create bank account* endpoint creates a new <a href="https://docs.codat.io/sync-for-payables-api#/schemas/BankAccount">bank account</a> for a given company's connection.<br/>
3635
/// <br/>
3736
/// <a href="https://docs.codat.io/sync-for-payables-api#/schemas/BankAccount">Bank accounts</a> are financial accounts maintained by a bank or other financial institution.
3837
/// </remarks>
39-
/// </summary>
40-
Task<CreateBankAccountResponse> CreateAsync(CreateBankAccountRequest request, RetryConfig? retryConfig = null);
38+
/// <param name="request">A <see cref="CreateBankAccountRequest"/> parameter.</param>
39+
/// <param name="retryConfig">The retry configuration to use for this operation.</param>
40+
/// <returns>An awaitable task that returns a <see cref="CreateBankAccountResponse"/> response envelope when completed.</returns>
41+
/// <exception cref="ArgumentNullException">The required parameter <paramref name="request"/> is null.</exception>
42+
/// <exception cref="HttpRequestException">The HTTP request failed due to network issues.</exception>
43+
/// <exception cref="ResponseValidationException">The response body could not be deserialized.</exception>
44+
/// <exception cref="ErrorMessage">The request made is not valid. Thrown when the API returns a 400, 401, 402, 403, 404, 429, 500 or 503 response.</exception>
45+
/// <exception cref="SDKException">Default API Exception. Thrown when the API returns a 4XX or 5XX response.</exception>
46+
public Task<CreateBankAccountResponse> CreateAsync(
47+
CreateBankAccountRequest request,
48+
RetryConfig? retryConfig = null
49+
);
4150
}
4251

4352
/// <summary>
44-
/// Create a bank account for a given company&apos;s connection.
53+
/// Create a bank account for a given company's connection.
4554
/// </summary>
4655
public class BankAccounts: IBankAccounts
4756
{
57+
/// <summary>
58+
/// SDK Configuration.
59+
/// <see cref="SDKConfig"/>
60+
/// </summary>
4861
public SDKConfig SDKConfiguration { get; private set; }
49-
private const string _language = "csharp";
50-
private const string _sdkVersion = "10.0.0";
51-
private const string _sdkGenVersion = "2.463.0";
52-
private const string _openapiDocVersion = "3.0.0";
53-
private const string _userAgent = "speakeasy-sdk/csharp 10.0.0 2.463.0 3.0.0 Codat.Sync.Payables";
54-
private string _serverUrl = "";
55-
private ISpeakeasyHttpClient _client;
56-
private Func<Codat.Sync.Payables.Models.Components.Security>? _securitySource;
57-
58-
public BankAccounts(ISpeakeasyHttpClient client, Func<Codat.Sync.Payables.Models.Components.Security>? securitySource, string serverUrl, SDKConfig config)
62+
63+
public BankAccounts(SDKConfig config)
5964
{
60-
_client = client;
61-
_securitySource = securitySource;
62-
_serverUrl = serverUrl;
6365
SDKConfiguration = config;
6466
}
6567

66-
public async Task<CreateBankAccountResponse> CreateAsync(CreateBankAccountRequest request, RetryConfig? retryConfig = null)
68+
/// <summary>
69+
/// Create bank account.
70+
/// </summary>
71+
/// <remarks>
72+
/// The *Create bank account* endpoint creates a new <a href="https://docs.codat.io/sync-for-payables-api#/schemas/BankAccount">bank account</a> for a given company's connection.<br/>
73+
/// <br/>
74+
/// <a href="https://docs.codat.io/sync-for-payables-api#/schemas/BankAccount">Bank accounts</a> are financial accounts maintained by a bank or other financial institution.
75+
/// </remarks>
76+
/// <param name="request">A <see cref="CreateBankAccountRequest"/> parameter.</param>
77+
/// <param name="retryConfig">The retry configuration to use for this operation.</param>
78+
/// <returns>An awaitable task that returns a <see cref="CreateBankAccountResponse"/> response envelope when completed.</returns>
79+
/// <exception cref="ArgumentNullException">The required parameter <paramref name="request"/> is null.</exception>
80+
/// <exception cref="HttpRequestException">The HTTP request failed due to network issues.</exception>
81+
/// <exception cref="ResponseValidationException">The response body could not be deserialized.</exception>
82+
/// <exception cref="ErrorMessage">The request made is not valid. Thrown when the API returns a 400, 401, 402, 403, 404, 429, 500 or 503 response.</exception>
83+
/// <exception cref="SDKException">Default API Exception. Thrown when the API returns a 4XX or 5XX response.</exception>
84+
public async Task<CreateBankAccountResponse> CreateAsync(
85+
CreateBankAccountRequest request,
86+
RetryConfig? retryConfig = null
87+
)
6788
{
89+
if (request == null) throw new ArgumentNullException(nameof(request));
90+
6891
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
69-
var urlString = URLBuilder.Build(baseUrl, "/companies/{companyId}/connections/{connectionId}/payables/bankAccounts", request);
92+
var urlString = URLBuilder.Build(baseUrl, "/companies/{companyId}/connections/{connectionId}/payables/bankAccounts", request, null);
7093

7194
var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString);
72-
httpRequest.Headers.Add("user-agent", _userAgent);
95+
httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent);
7396
HeaderSerializer.PopulateHeaders(ref httpRequest, request);
7497

7598
var serializedBody = RequestBodySerializer.Serialize(request, "BankAccountPrototype", "json", false, true);
@@ -78,12 +101,12 @@ public async Task<CreateBankAccountResponse> CreateAsync(CreateBankAccountReques
78101
httpRequest.Content = serializedBody;
79102
}
80103

81-
if (_securitySource != null)
104+
if (SDKConfiguration.SecuritySource != null)
82105
{
83-
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
106+
httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest);
84107
}
85108

86-
var hookCtx = new HookContext("create-bank-account", null, _securitySource);
109+
var hookCtx = new HookContext(SDKConfiguration, baseUrl, "create-bank-account", null, SDKConfiguration.SecuritySource);
87110

88111
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
89112
if (retryConfig == null)
@@ -117,8 +140,8 @@ public async Task<CreateBankAccountResponse> CreateAsync(CreateBankAccountReques
117140

118141
Func<Task<HttpResponseMessage>> retrySend = async () =>
119142
{
120-
var _httpRequest = await _client.CloneAsync(httpRequest);
121-
return await _client.SendAsync(_httpRequest);
143+
var _httpRequest = await SDKConfiguration.Client.CloneAsync(httpRequest);
144+
return await SDKConfiguration.Client.SendAsync(_httpRequest);
122145
};
123146
var retries = new Codat.Sync.Payables.Utils.Retries.Retries(retrySend, retryConfig, statusCodes);
124147

@@ -128,7 +151,7 @@ public async Task<CreateBankAccountResponse> CreateAsync(CreateBankAccountReques
128151
httpResponse = await retries.Run();
129152
int _statusCode = (int)httpResponse.StatusCode;
130153

131-
if (_statusCode == 400 || _statusCode == 401 || _statusCode == 402 || _statusCode == 403 || _statusCode == 404 || _statusCode == 429 || _statusCode >= 400 && _statusCode < 500 || _statusCode == 500 || _statusCode == 503 || _statusCode >= 500 && _statusCode < 600)
154+
if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
132155
{
133156
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
134157
if (_httpResponse != null)
@@ -158,7 +181,17 @@ public async Task<CreateBankAccountResponse> CreateAsync(CreateBankAccountReques
158181
{
159182
if(Utilities.IsContentTypeMatch("application/json", contentType))
160183
{
161-
var obj = ResponseBodyDeserializer.Deserialize<BankAccount>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
184+
var httpResponseBody = await httpResponse.Content.ReadAsStringAsync();
185+
BankAccount obj;
186+
try
187+
{
188+
obj = ResponseBodyDeserializer.DeserializeNotNull<BankAccount>(httpResponseBody, NullValueHandling.Ignore);
189+
}
190+
catch (Exception ex)
191+
{
192+
throw new ResponseValidationException("Failed to deserialize response body into BankAccount.", httpResponse, httpResponseBody, ex);
193+
}
194+
162195
var response = new CreateBankAccountResponse()
163196
{
164197
StatusCode = responseStatusCode,
@@ -169,24 +202,59 @@ public async Task<CreateBankAccountResponse> CreateAsync(CreateBankAccountReques
169202
return response;
170203
}
171204

172-
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
205+
throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
173206
}
174-
else if(new List<int>{400, 401, 402, 403, 404, 429, 500, 503}.Contains(responseStatusCode))
207+
else if(new List<int>{400, 401, 402, 403, 404, 429}.Contains(responseStatusCode))
175208
{
176209
if(Utilities.IsContentTypeMatch("application/json", contentType))
177210
{
178-
var obj = ResponseBodyDeserializer.Deserialize<ErrorMessage>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
179-
throw obj!;
211+
var httpResponseBody = await httpResponse.Content.ReadAsStringAsync();
212+
ErrorMessagePayload payload;
213+
try
214+
{
215+
payload = ResponseBodyDeserializer.DeserializeNotNull<ErrorMessagePayload>(httpResponseBody, NullValueHandling.Ignore);
216+
}
217+
catch (Exception ex)
218+
{
219+
throw new ResponseValidationException("Failed to deserialize response body into ErrorMessagePayload.", httpResponse, httpResponseBody, ex);
220+
}
221+
222+
throw new ErrorMessage(payload, httpResponse, httpResponseBody);
180223
}
181224

182-
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
225+
throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
183226
}
184-
else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
227+
else if(new List<int>{500, 503}.Contains(responseStatusCode))
185228
{
186-
throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
229+
if(Utilities.IsContentTypeMatch("application/json", contentType))
230+
{
231+
var httpResponseBody = await httpResponse.Content.ReadAsStringAsync();
232+
ErrorMessagePayload payload;
233+
try
234+
{
235+
payload = ResponseBodyDeserializer.DeserializeNotNull<ErrorMessagePayload>(httpResponseBody, NullValueHandling.Ignore);
236+
}
237+
catch (Exception ex)
238+
{
239+
throw new ResponseValidationException("Failed to deserialize response body into ErrorMessagePayload.", httpResponse, httpResponseBody, ex);
240+
}
241+
242+
throw new ErrorMessage(payload, httpResponse, httpResponseBody);
243+
}
244+
245+
throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
246+
}
247+
else if(responseStatusCode >= 400 && responseStatusCode < 500)
248+
{
249+
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
250+
}
251+
else if(responseStatusCode >= 500 && responseStatusCode < 600)
252+
{
253+
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
187254
}
188255

189-
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
256+
throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
190257
}
258+
191259
}
192260
}

0 commit comments

Comments
 (0)