-
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.
chore: speakeasy sdk regeneration - Generate Lending library (#52)
* ci: regenerated with OpenAPI Doc 3.0.0, Speakeay CLI 1.83.0 * ci: regenerated with OpenAPI Doc 3.0.0, Speakeay CLI 1.83.2 --------- Co-authored-by: speakeasybot <bot@speakeasyapi.dev>
- Loading branch information
1 parent
6bda6d2
commit bac3411
Showing
730 changed files
with
14,716 additions
and
12,017 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,170 @@ | ||
|
||
//------------------------------------------------------------------------------ | ||
// <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 CodatLending | ||
{ | ||
using CodatLending.Models.Operations; | ||
using CodatLending.Models.Shared; | ||
using CodatLending.Utils; | ||
using Newtonsoft.Json; | ||
using System.Net.Http.Headers; | ||
using System.Net.Http; | ||
using System.Threading.Tasks; | ||
using System; | ||
|
||
public interface IAccountingBankDataAccountsSDK | ||
{ | ||
Task<GetAccountingBankAccountResponse> GetAsync(GetAccountingBankAccountRequest? request = null); | ||
Task<ListAccountingBankAccountsResponse> ListAsync(ListAccountingBankAccountsRequest? request = null); | ||
} | ||
|
||
public class AccountingBankDataAccountsSDK: IAccountingBankDataAccountsSDK | ||
{ | ||
public SDKConfig Config { get; private set; } | ||
private const string _language = "csharp"; | ||
private const string _sdkVersion = "1.2.0"; | ||
private const string _sdkGenVersion = "2.109.3"; | ||
private const string _openapiDocVersion = "3.0.0"; | ||
private string _serverUrl = ""; | ||
private ISpeakeasyHttpClient _defaultClient; | ||
private ISpeakeasyHttpClient _securityClient; | ||
|
||
public AccountingBankDataAccountsSDK(ISpeakeasyHttpClient defaultClient, ISpeakeasyHttpClient securityClient, string serverUrl, SDKConfig config) | ||
{ | ||
_defaultClient = defaultClient; | ||
_securityClient = securityClient; | ||
_serverUrl = serverUrl; | ||
Config = config; | ||
} | ||
|
||
|
||
/// <summary> | ||
/// Get bank account | ||
/// | ||
/// <remarks> | ||
/// The *Get bank account* endpoint returns a single account for a given accountId. | ||
/// | ||
/// [Bank accounts](https://docs.codat.io/accounting-api#/schemas/BankAccount) are financial accounts maintained by a bank or other financial institution. | ||
/// | ||
/// Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=bankAccounts) for integrations that support getting a specific bank account. | ||
/// | ||
/// Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). | ||
/// | ||
/// </remarks> | ||
/// </summary> | ||
public async Task<GetAccountingBankAccountResponse> GetAsync(GetAccountingBankAccountRequest? request = null) | ||
{ | ||
string baseUrl = _serverUrl; | ||
if (baseUrl.EndsWith("/")) | ||
{ | ||
baseUrl = baseUrl.Substring(0, baseUrl.Length - 1); | ||
} | ||
var urlString = URLBuilder.Build(baseUrl, "/companies/{companyId}/connections/{connectionId}/data/bankAccounts/{accountId}", request); | ||
|
||
|
||
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); | ||
httpRequest.Headers.Add("user-agent", $"speakeasy-sdk/{_language} {_sdkVersion} {_sdkGenVersion} {_openapiDocVersion}"); | ||
|
||
|
||
var client = _securityClient; | ||
|
||
var httpResponse = await client.SendAsync(httpRequest); | ||
|
||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType; | ||
|
||
var response = new GetAccountingBankAccountResponse | ||
{ | ||
StatusCode = (int)httpResponse.StatusCode, | ||
ContentType = contentType, | ||
RawResponse = httpResponse | ||
}; | ||
if((response.StatusCode == 200)) | ||
{ | ||
if(Utilities.IsContentTypeMatch("application/json", response.ContentType)) | ||
{ | ||
response.AccountingBankAccount = JsonConvert.DeserializeObject<AccountingBankAccount>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer() }}); | ||
} | ||
|
||
return response; | ||
} | ||
if((response.StatusCode == 401) || (response.StatusCode == 404) || (response.StatusCode == 409) || (response.StatusCode == 429)) | ||
{ | ||
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() }}); | ||
} | ||
|
||
return response; | ||
} | ||
return response; | ||
} | ||
|
||
|
||
/// <summary> | ||
/// List bank accounts | ||
/// | ||
/// <remarks> | ||
/// The *List bank accounts* endpoint returns a list of [bank accounts](https://docs.codat.io/accounting-api#/schemas/BankAccount) for a given company's connection. | ||
/// | ||
/// [Bank accounts](https://docs.codat.io/accounting-api#/schemas/BankAccount) are financial accounts maintained by a bank or other financial institution. | ||
/// | ||
/// Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). | ||
/// | ||
/// </remarks> | ||
/// </summary> | ||
public async Task<ListAccountingBankAccountsResponse> ListAsync(ListAccountingBankAccountsRequest? request = null) | ||
{ | ||
string baseUrl = _serverUrl; | ||
if (baseUrl.EndsWith("/")) | ||
{ | ||
baseUrl = baseUrl.Substring(0, baseUrl.Length - 1); | ||
} | ||
var urlString = URLBuilder.Build(baseUrl, "/companies/{companyId}/connections/{connectionId}/data/bankAccounts", request); | ||
|
||
|
||
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); | ||
httpRequest.Headers.Add("user-agent", $"speakeasy-sdk/{_language} {_sdkVersion} {_sdkGenVersion} {_openapiDocVersion}"); | ||
|
||
|
||
var client = _securityClient; | ||
|
||
var httpResponse = await client.SendAsync(httpRequest); | ||
|
||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType; | ||
|
||
var response = new ListAccountingBankAccountsResponse | ||
{ | ||
StatusCode = (int)httpResponse.StatusCode, | ||
ContentType = contentType, | ||
RawResponse = httpResponse | ||
}; | ||
if((response.StatusCode == 200)) | ||
{ | ||
if(Utilities.IsContentTypeMatch("application/json", response.ContentType)) | ||
{ | ||
response.AccountingBankAccounts = JsonConvert.DeserializeObject<AccountingBankAccounts>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer() }}); | ||
} | ||
|
||
return response; | ||
} | ||
if((response.StatusCode == 400) || (response.StatusCode == 401) || (response.StatusCode == 404) || (response.StatusCode == 409)) | ||
{ | ||
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() }}); | ||
} | ||
|
||
return response; | ||
} | ||
return response; | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.