-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: regenerated with OpenAPI Doc 3.0.0, Speakeasy CLI 1.126.3 (#223)
Co-authored-by: speakeasybot <bot@speakeasyapi.dev>
- Loading branch information
1 parent
fc2725e
commit fafa2b0
Showing
92 changed files
with
1,527 additions
and
256 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
|
||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. | ||
// | ||
// Changes to this file may cause incorrect behavior and will be lost when | ||
// the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
#nullable enable | ||
namespace Codat.Sync.Payables | ||
{ | ||
using Codat.Sync.Payables.Models.Operations; | ||
using Codat.Sync.Payables.Models.Shared; | ||
using Codat.Sync.Payables.Utils; | ||
using Newtonsoft.Json; | ||
using System.Net.Http.Headers; | ||
using System.Net.Http; | ||
using System.Threading.Tasks; | ||
using System; | ||
|
||
/// <summary> | ||
/// Bank accounts | ||
/// </summary> | ||
public interface IBankAccounts | ||
{ | ||
|
||
/// <summary> | ||
/// Create bank account | ||
/// | ||
/// <remarks> | ||
/// 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/> | ||
/// <br/> | ||
/// <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.<br/> | ||
/// <br/> | ||
/// **Integration-specific behaviour**<br/> | ||
/// <br/> | ||
/// Required data may vary by integration. To see what data to post, first call <a href="https://docs.codat.io/sync-for-payables-api#/operations/get-create-update-bankAccounts-model">Get create/update bank account model</a>.<br/> | ||
/// <br/> | ||
/// Check out our <a href="https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=bankAccounts">coverage explorer</a> for integrations that support creating an account. | ||
/// </remarks> | ||
/// </summary> | ||
Task<CreateBankAccountResponse> CreateAsync(CreateBankAccountRequest? request = null); | ||
|
||
/// <summary> | ||
/// Get create/update bank account model | ||
/// | ||
/// <remarks> | ||
/// The *Get create/update bank account model* endpoint returns the expected data for the request payload when creating and updating a <a href="https://docs.codat.io/sync-for-payables-api#/schemas/BankAccount">bank account</a> for a given company and integration.<br/> | ||
/// <br/> | ||
/// <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.<br/> | ||
/// <br/> | ||
/// **Integration-specific behaviour**<br/> | ||
/// <br/> | ||
/// See the *response examples* for integration-specific indicative models.<br/> | ||
/// <br/> | ||
/// Check out our <a href="https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=bankAccounts">coverage explorer</a> for integrations that support creating and updating a bank account.<br/> | ||
/// | ||
/// </remarks> | ||
/// </summary> | ||
Task<GetCreateBankAccountsModelResponse> GetCreateModelAsync(GetCreateBankAccountsModelRequest? request = null); | ||
} | ||
|
||
/// <summary> | ||
/// Bank accounts | ||
/// </summary> | ||
public class BankAccounts: IBankAccounts | ||
{ | ||
public SDKConfig SDKConfiguration { get; private set; } | ||
private const string _language = "csharp"; | ||
private const string _sdkVersion = "3.1.0"; | ||
private const string _sdkGenVersion = "2.214.3"; | ||
private const string _openapiDocVersion = "3.0.0"; | ||
private const string _userAgent = "speakeasy-sdk/csharp 3.1.0 2.214.3 3.0.0 Codat.Sync.Payables"; | ||
private string _serverUrl = ""; | ||
private ISpeakeasyHttpClient _defaultClient; | ||
private ISpeakeasyHttpClient _securityClient; | ||
|
||
public BankAccounts(ISpeakeasyHttpClient defaultClient, ISpeakeasyHttpClient securityClient, string serverUrl, SDKConfig config) | ||
{ | ||
_defaultClient = defaultClient; | ||
_securityClient = securityClient; | ||
_serverUrl = serverUrl; | ||
SDKConfiguration = config; | ||
} | ||
|
||
|
||
public async Task<CreateBankAccountResponse> CreateAsync(CreateBankAccountRequest? request = null) | ||
{ | ||
string baseUrl = this.SDKConfiguration.GetTemplatedServerDetails(); | ||
var urlString = URLBuilder.Build(baseUrl, "/companies/{companyId}/connections/{connectionId}/push/bankAccounts", request); | ||
|
||
var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); | ||
httpRequest.Headers.Add("user-agent", _userAgent); | ||
|
||
var serializedBody = RequestBodySerializer.Serialize(request, "BankAccountPrototype", "json"); | ||
if (serializedBody != null) | ||
{ | ||
httpRequest.Content = serializedBody; | ||
} | ||
|
||
var client = _securityClient; | ||
|
||
var httpResponse = await client.SendAsync(httpRequest); | ||
|
||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType; | ||
|
||
var response = new CreateBankAccountResponse | ||
{ | ||
StatusCode = (int)httpResponse.StatusCode, | ||
ContentType = contentType, | ||
RawResponse = httpResponse | ||
}; | ||
|
||
if((response.StatusCode == 200)) | ||
{ | ||
if(Utilities.IsContentTypeMatch("application/json",response.ContentType)) | ||
{ | ||
response.BankAccountCreateResponse = JsonConvert.DeserializeObject<BankAccountCreateResponse>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }}); | ||
} | ||
|
||
return response; | ||
} | ||
if((response.StatusCode == 400) || (response.StatusCode == 401) || (response.StatusCode == 402) || (response.StatusCode == 403) || (response.StatusCode == 404) || (response.StatusCode == 429) || (response.StatusCode == 500) || (response.StatusCode == 503)) | ||
{ | ||
if(Utilities.IsContentTypeMatch("application/json",response.ContentType)) | ||
{ | ||
response.ErrorMessage = JsonConvert.DeserializeObject<ErrorMessage>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }}); | ||
} | ||
|
||
return response; | ||
} | ||
return response; | ||
} | ||
|
||
|
||
public async Task<GetCreateBankAccountsModelResponse> GetCreateModelAsync(GetCreateBankAccountsModelRequest? request = null) | ||
{ | ||
string baseUrl = this.SDKConfiguration.GetTemplatedServerDetails(); | ||
var urlString = URLBuilder.Build(baseUrl, "/companies/{companyId}/connections/{connectionId}/options/bankAccounts", request); | ||
|
||
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); | ||
httpRequest.Headers.Add("user-agent", _userAgent); | ||
|
||
|
||
var client = _securityClient; | ||
|
||
var httpResponse = await client.SendAsync(httpRequest); | ||
|
||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType; | ||
|
||
var response = new GetCreateBankAccountsModelResponse | ||
{ | ||
StatusCode = (int)httpResponse.StatusCode, | ||
ContentType = contentType, | ||
RawResponse = httpResponse | ||
}; | ||
|
||
if((response.StatusCode == 200)) | ||
{ | ||
if(Utilities.IsContentTypeMatch("application/json",response.ContentType)) | ||
{ | ||
response.PushOption = JsonConvert.DeserializeObject<PushOption>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }}); | ||
} | ||
|
||
return response; | ||
} | ||
if((response.StatusCode == 401) || (response.StatusCode == 402) || (response.StatusCode == 403) || (response.StatusCode == 404) || (response.StatusCode == 429) || (response.StatusCode == 500) || (response.StatusCode == 503)) | ||
{ | ||
if(Utilities.IsContentTypeMatch("application/json",response.ContentType)) | ||
{ | ||
response.ErrorMessage = JsonConvert.DeserializeObject<ErrorMessage>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }}); | ||
} | ||
|
||
return response; | ||
} | ||
return response; | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.