Skip to content

Commit a5179bb

Browse files
ci: regenerated with OpenAPI Doc 3.0.0, Speakeasy CLI 1.277.6 (#266)
Co-authored-by: speakeasybot <bot@speakeasyapi.dev>
1 parent 25ab079 commit a5179bb

File tree

1,057 files changed

+23602
-14652
lines changed

Some content is hidden

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

1,057 files changed

+23602
-14652
lines changed

lending/.speakeasy/gen.lock

Lines changed: 742 additions & 696 deletions
Large diffs are not rendered by default.

lending/CodatLending.sln renamed to lending/Codat.Lending.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Codat.Lending", "CodatLending\CodatLending.csproj", "{F0CE92B5-F3CC-45A2-AA83-118C38724EB1}"
3+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Codat.Lending", "Codat\Lending\Codat.Lending.csproj", "{F0CE92B5-F3CC-45A2-AA83-118C38724EB1}"
44
EndProject
55

66
Global
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
2+
//------------------------------------------------------------------------------
3+
// <auto-generated>
4+
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
5+
//
6+
// Changes to this file may cause incorrect behavior and will be lost when
7+
// the code is regenerated.
8+
// </auto-generated>
9+
//------------------------------------------------------------------------------
10+
#nullable enable
11+
namespace Codat.Lending
12+
{
13+
using Codat.Lending.Hooks;
14+
using Codat.Lending.Models.Errors;
15+
using Codat.Lending.Models.Operations;
16+
using Codat.Lending.Models.Shared;
17+
using Codat.Lending.Utils;
18+
using Newtonsoft.Json;
19+
using System.Collections.Generic;
20+
using System.Net.Http.Headers;
21+
using System.Net.Http;
22+
using System.Threading.Tasks;
23+
using System;
24+
25+
public interface IAccountBalances
26+
{
27+
28+
/// <summary>
29+
/// List account balances
30+
///
31+
/// <remarks>
32+
/// The *List account balances* endpoint returns a list of <a href="https://docs.codat.io/lending-api#/schemas/AccountBalance">account balances</a> for a given company&apos;s connection.<br/>
33+
/// <br/>
34+
/// <a href="https://docs.codat.io/lending-api#/schemas/AccountBalance">Account balances</a> are balances for a bank account, including end-of-day batch balance or running balances per transaction.<br/>
35+
/// <br/>
36+
/// Before using this endpoint, you must have <a href="https://docs.codat.io/lending-api#/operations/refresh-company-data">retrieved data for the company</a>.<br/>
37+
///
38+
/// </remarks>
39+
/// </summary>
40+
Task<ListBankingAccountBalancesResponse> ListAsync(ListBankingAccountBalancesRequest request);
41+
}
42+
43+
public class AccountBalances: IAccountBalances
44+
{
45+
public SDKConfig SDKConfiguration { get; private set; }
46+
private const string _language = "csharp";
47+
private const string _sdkVersion = "5.4.0";
48+
private const string _sdkGenVersion = "2.319.7";
49+
private const string _openapiDocVersion = "3.0.0";
50+
private const string _userAgent = "speakeasy-sdk/csharp 5.4.0 2.319.7 3.0.0 Codat.Lending";
51+
private string _serverUrl = "";
52+
private ISpeakeasyHttpClient _defaultClient;
53+
private Func<Security>? _securitySource;
54+
55+
public AccountBalances(ISpeakeasyHttpClient defaultClient, Func<Security>? securitySource, string serverUrl, SDKConfig config)
56+
{
57+
_defaultClient = defaultClient;
58+
_securitySource = securitySource;
59+
_serverUrl = serverUrl;
60+
SDKConfiguration = config;
61+
}
62+
63+
public async Task<ListBankingAccountBalancesResponse> ListAsync(ListBankingAccountBalancesRequest request)
64+
{
65+
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
66+
var urlString = URLBuilder.Build(baseUrl, "/companies/{companyId}/connections/{connectionId}/data/banking-accountBalances", request);
67+
68+
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
69+
httpRequest.Headers.Add("user-agent", _userAgent);
70+
71+
if (_securitySource != null)
72+
{
73+
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
74+
}
75+
76+
var hookCtx = new HookContext("list-banking-account-balances", null, _securitySource);
77+
78+
httpRequest = await this.SDKConfiguration.hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
79+
HttpResponseMessage httpResponse;
80+
try
81+
{
82+
httpResponse = await _defaultClient.SendAsync(httpRequest);
83+
int _statusCode = (int)httpResponse.StatusCode;
84+
85+
if (_statusCode == 400 || _statusCode == 401 || _statusCode == 402 || _statusCode == 403 || _statusCode == 404 || _statusCode == 409 || _statusCode == 429 || _statusCode >= 400 && _statusCode < 500 || _statusCode == 500 || _statusCode == 503 || _statusCode >= 500 && _statusCode < 600)
86+
{
87+
var _httpResponse = await this.SDKConfiguration.hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
88+
if (_httpResponse != null)
89+
{
90+
httpResponse = _httpResponse;
91+
}
92+
}
93+
}
94+
catch (Exception error)
95+
{
96+
var _httpResponse = await this.SDKConfiguration.hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
97+
if (_httpResponse != null)
98+
{
99+
httpResponse = _httpResponse;
100+
}
101+
else
102+
{
103+
throw;
104+
}
105+
}
106+
107+
httpResponse = await this.SDKConfiguration.hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
108+
109+
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
110+
int responseStatusCode = (int)httpResponse.StatusCode;
111+
if(responseStatusCode == 200)
112+
{
113+
if(Utilities.IsContentTypeMatch("application/json", contentType))
114+
{
115+
var obj = ResponseBodyDeserializer.Deserialize<BankingAccountBalances>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
116+
var response = new ListBankingAccountBalancesResponse()
117+
{
118+
StatusCode = responseStatusCode,
119+
ContentType = contentType,
120+
RawResponse = httpResponse
121+
};
122+
response.BankingAccountBalances = obj;
123+
return response;
124+
}
125+
else
126+
{
127+
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
128+
}
129+
}
130+
else if(new List<int>{400, 401, 402, 403, 404, 409, 429, 500, 503}.Contains(responseStatusCode))
131+
{
132+
if(Utilities.IsContentTypeMatch("application/json", contentType))
133+
{
134+
var obj = ResponseBodyDeserializer.Deserialize<ErrorMessage>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
135+
throw obj!;
136+
}
137+
else
138+
{
139+
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
140+
}
141+
}
142+
else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
143+
{
144+
throw new SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
145+
}
146+
else
147+
{
148+
throw new SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
149+
}
150+
}
151+
}
152+
}

0 commit comments

Comments
 (0)