Skip to content

Commit 39cf4d3

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

File tree

232 files changed

+5358
-2834
lines changed

Some content is hidden

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

232 files changed

+5358
-2834
lines changed

bank-feeds/.speakeasy/gen.lock

Lines changed: 183 additions & 155 deletions
Large diffs are not rendered by default.

bank-feeds/CodatBankFeeds.sln renamed to bank-feeds/Codat.BankFeeds.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.BankFeeds", "CodatBankFeeds\CodatBankFeeds.csproj", "{F0CE92B5-F3CC-45A2-AA83-118C38724EB1}"
3+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Codat.BankFeeds", "Codat\BankFeeds\Codat.BankFeeds.csproj", "{F0CE92B5-F3CC-45A2-AA83-118C38724EB1}"
44
EndProject
55

66
Global
Lines changed: 267 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,267 @@
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.BankFeeds
12+
{
13+
using Codat.BankFeeds.Hooks;
14+
using Codat.BankFeeds.Models.Errors;
15+
using Codat.BankFeeds.Models.Operations;
16+
using Codat.BankFeeds.Models.Shared;
17+
using Codat.BankFeeds.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+
/// <summary>
26+
/// Extra functionality for building an account management UI.
27+
/// </summary>
28+
public interface IAccountMapping
29+
{
30+
31+
/// <summary>
32+
/// Create bank feed account mapping
33+
///
34+
/// <remarks>
35+
/// The *Create bank account mapping* endpoint creates a new mapping between a source bank account and a potential account in the accounting platform (target account).<br/>
36+
/// <br/>
37+
/// 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).<br/>
38+
/// <br/>
39+
/// To find valid target account options, first call list bank feed account mappings.<br/>
40+
/// <br/>
41+
/// This endpoint is only needed if building an account management UI.
42+
/// </remarks>
43+
/// </summary>
44+
Task<CreateBankAccountMappingResponse> CreateAsync(CreateBankAccountMappingRequest request);
45+
46+
/// <summary>
47+
/// List bank feed account mappings
48+
///
49+
/// <remarks>
50+
/// The *List bank account mappings* endpoint returns information about a source bank account and any current or potential target mapping accounts.<br/>
51+
/// <br/>
52+
/// 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).<br/>
53+
/// <br/>
54+
/// This endpoint is only needed if building an account management UI.
55+
/// </remarks>
56+
/// </summary>
57+
Task<GetBankAccountMappingResponse> GetAsync(GetBankAccountMappingRequest request);
58+
}
59+
60+
/// <summary>
61+
/// Extra functionality for building an account management UI.
62+
/// </summary>
63+
public class AccountMapping: IAccountMapping
64+
{
65+
public SDKConfig SDKConfiguration { get; private set; }
66+
private const string _language = "csharp";
67+
private const string _sdkVersion = "4.3.0";
68+
private const string _sdkGenVersion = "2.319.7";
69+
private const string _openapiDocVersion = "3.0.0";
70+
private const string _userAgent = "speakeasy-sdk/csharp 4.3.0 2.319.7 3.0.0 Codat.BankFeeds";
71+
private string _serverUrl = "";
72+
private ISpeakeasyHttpClient _defaultClient;
73+
private Func<Security>? _securitySource;
74+
75+
public AccountMapping(ISpeakeasyHttpClient defaultClient, Func<Security>? securitySource, string serverUrl, SDKConfig config)
76+
{
77+
_defaultClient = defaultClient;
78+
_securitySource = securitySource;
79+
_serverUrl = serverUrl;
80+
SDKConfiguration = config;
81+
}
82+
83+
public async Task<CreateBankAccountMappingResponse> CreateAsync(CreateBankAccountMappingRequest request)
84+
{
85+
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
86+
var urlString = URLBuilder.Build(baseUrl, "/companies/{companyId}/connections/{connectionId}/bankFeedAccounts/mapping", request);
87+
88+
var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString);
89+
httpRequest.Headers.Add("user-agent", _userAgent);
90+
91+
var serializedBody = RequestBodySerializer.Serialize(request, "Zero", "json", false, true);
92+
if (serializedBody != null)
93+
{
94+
httpRequest.Content = serializedBody;
95+
}
96+
97+
if (_securitySource != null)
98+
{
99+
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
100+
}
101+
102+
var hookCtx = new HookContext("create-bank-account-mapping", null, _securitySource);
103+
104+
httpRequest = await this.SDKConfiguration.hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
105+
HttpResponseMessage httpResponse;
106+
try
107+
{
108+
httpResponse = await _defaultClient.SendAsync(httpRequest);
109+
int _statusCode = (int)httpResponse.StatusCode;
110+
111+
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)
112+
{
113+
var _httpResponse = await this.SDKConfiguration.hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
114+
if (_httpResponse != null)
115+
{
116+
httpResponse = _httpResponse;
117+
}
118+
}
119+
}
120+
catch (Exception error)
121+
{
122+
var _httpResponse = await this.SDKConfiguration.hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
123+
if (_httpResponse != null)
124+
{
125+
httpResponse = _httpResponse;
126+
}
127+
else
128+
{
129+
throw;
130+
}
131+
}
132+
133+
httpResponse = await this.SDKConfiguration.hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
134+
135+
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
136+
int responseStatusCode = (int)httpResponse.StatusCode;
137+
if(responseStatusCode == 200)
138+
{
139+
if(Utilities.IsContentTypeMatch("application/json", contentType))
140+
{
141+
var obj = ResponseBodyDeserializer.Deserialize<BankFeedAccountMappingResponse>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
142+
var response = new CreateBankAccountMappingResponse()
143+
{
144+
StatusCode = responseStatusCode,
145+
ContentType = contentType,
146+
RawResponse = httpResponse
147+
};
148+
response.BankFeedAccountMappingResponse = obj;
149+
return response;
150+
}
151+
else
152+
{
153+
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
154+
}
155+
}
156+
else if(new List<int>{400, 401, 402, 403, 404, 429, 500, 503}.Contains(responseStatusCode))
157+
{
158+
if(Utilities.IsContentTypeMatch("application/json", contentType))
159+
{
160+
var obj = ResponseBodyDeserializer.Deserialize<ErrorMessage>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
161+
throw obj!;
162+
}
163+
else
164+
{
165+
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
166+
}
167+
}
168+
else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
169+
{
170+
throw new SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
171+
}
172+
else
173+
{
174+
throw new SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
175+
}
176+
}
177+
178+
public async Task<GetBankAccountMappingResponse> GetAsync(GetBankAccountMappingRequest request)
179+
{
180+
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
181+
var urlString = URLBuilder.Build(baseUrl, "/companies/{companyId}/connections/{connectionId}/bankFeedAccounts/mapping", request);
182+
183+
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
184+
httpRequest.Headers.Add("user-agent", _userAgent);
185+
186+
if (_securitySource != null)
187+
{
188+
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
189+
}
190+
191+
var hookCtx = new HookContext("get-bank-account-mapping", null, _securitySource);
192+
193+
httpRequest = await this.SDKConfiguration.hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
194+
HttpResponseMessage httpResponse;
195+
try
196+
{
197+
httpResponse = await _defaultClient.SendAsync(httpRequest);
198+
int _statusCode = (int)httpResponse.StatusCode;
199+
200+
if (_statusCode == 401 || _statusCode == 402 || _statusCode == 403 || _statusCode == 404 || _statusCode == 429 || _statusCode >= 400 && _statusCode < 500 || _statusCode == 500 || _statusCode == 503 || _statusCode >= 500 && _statusCode < 600)
201+
{
202+
var _httpResponse = await this.SDKConfiguration.hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
203+
if (_httpResponse != null)
204+
{
205+
httpResponse = _httpResponse;
206+
}
207+
}
208+
}
209+
catch (Exception error)
210+
{
211+
var _httpResponse = await this.SDKConfiguration.hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
212+
if (_httpResponse != null)
213+
{
214+
httpResponse = _httpResponse;
215+
}
216+
else
217+
{
218+
throw;
219+
}
220+
}
221+
222+
httpResponse = await this.SDKConfiguration.hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
223+
224+
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
225+
int responseStatusCode = (int)httpResponse.StatusCode;
226+
if(responseStatusCode == 200)
227+
{
228+
if(Utilities.IsContentTypeMatch("application/json", contentType))
229+
{
230+
var obj = ResponseBodyDeserializer.Deserialize<BankFeedMapping>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
231+
var response = new GetBankAccountMappingResponse()
232+
{
233+
StatusCode = responseStatusCode,
234+
ContentType = contentType,
235+
RawResponse = httpResponse
236+
};
237+
response.BankFeedMapping = obj;
238+
return response;
239+
}
240+
else
241+
{
242+
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
243+
}
244+
}
245+
else if(new List<int>{401, 402, 403, 404, 429, 500, 503}.Contains(responseStatusCode))
246+
{
247+
if(Utilities.IsContentTypeMatch("application/json", contentType))
248+
{
249+
var obj = ResponseBodyDeserializer.Deserialize<ErrorMessage>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
250+
throw obj!;
251+
}
252+
else
253+
{
254+
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
255+
}
256+
}
257+
else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
258+
{
259+
throw new SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
260+
}
261+
else
262+
{
263+
throw new SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
264+
}
265+
}
266+
}
267+
}

0 commit comments

Comments
 (0)