Skip to content

Commit 31db77a

Browse files
ci: regenerated with OpenAPI Doc prealpha, Speakeasy CLI 1.244.2 (#260)
Co-authored-by: speakeasybot <bot@speakeasyapi.dev>
1 parent 995c0b4 commit 31db77a

File tree

328 files changed

+3255
-1052
lines changed

Some content is hidden

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

328 files changed

+3255
-1052
lines changed

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

Lines changed: 285 additions & 246 deletions
Large diffs are not rendered by default.

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

66
Global

sync-for-expenses/CodatSyncExpenses/Accounts.cs renamed to sync-for-expenses/Codat/Sync/Expenses/Accounts.cs

Lines changed: 51 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010
#nullable enable
1111
namespace Codat.Sync.Expenses
1212
{
13+
using Codat.Sync.Expenses.Models.Errors;
1314
using Codat.Sync.Expenses.Models.Operations;
1415
using Codat.Sync.Expenses.Models.Shared;
1516
using Codat.Sync.Expenses.Utils;
1617
using Newtonsoft.Json;
18+
using System.Collections.Generic;
1719
using System.Net.Http.Headers;
1820
using System.Net.Http;
1921
using System.Threading.Tasks;
@@ -69,10 +71,10 @@ public class Accounts: IAccounts
6971
{
7072
public SDKConfig SDKConfiguration { get; private set; }
7173
private const string _language = "csharp";
72-
private const string _sdkVersion = "5.2.0";
73-
private const string _sdkGenVersion = "2.286.2";
74+
private const string _sdkVersion = "5.3.0";
75+
private const string _sdkGenVersion = "2.301.3";
7476
private const string _openapiDocVersion = "prealpha";
75-
private const string _userAgent = "speakeasy-sdk/csharp 5.2.0 2.286.2 prealpha Codat.Sync.Expenses";
77+
private const string _userAgent = "speakeasy-sdk/csharp 5.3.0 2.301.3 prealpha Codat.Sync.Expenses";
7678
private string _serverUrl = "";
7779
private ISpeakeasyHttpClient _defaultClient;
7880
private Func<Security>? _securitySource;
@@ -108,32 +110,46 @@ public Accounts(ISpeakeasyHttpClient defaultClient, Func<Security>? securitySour
108110
var httpResponse = await client.SendAsync(httpRequest);
109111

110112
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
111-
112113
var response = new Models.Operations.CreateAccountResponse
113114
{
114115
StatusCode = (int)httpResponse.StatusCode,
115116
ContentType = contentType,
116117
RawResponse = httpResponse
117118
};
118-
119-
if((response.StatusCode == 200))
119+
if (response.StatusCode == 200)
120120
{
121121
if(Utilities.IsContentTypeMatch("application/json",response.ContentType))
122+
{
123+
var obj = ResponseBodyDeserializer.Deserialize<Models.Shared.CreateAccountResponse>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
124+
response.CreateAccountResponseValue = obj;
125+
}
126+
else
122127
{
123-
response.CreateAccountResponseValue = JsonConvert.DeserializeObject<Models.Shared.CreateAccountResponse>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }});
128+
throw new SDKException("API error occurred", (int)httpResponse.StatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
124129
}
125130

126-
return response;
127131
}
128-
129-
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))
132+
else if (new List<int>{400, 401, 402, 403, 404, 429, 500, 503}.Contains(response.StatusCode))
130133
{
131134
if(Utilities.IsContentTypeMatch("application/json",response.ContentType))
135+
{
136+
var obj = ResponseBodyDeserializer.Deserialize<ErrorMessage>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
137+
throw obj!;
138+
}
139+
else
132140
{
133-
response.ErrorMessage = JsonConvert.DeserializeObject<ErrorMessage>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }});
141+
throw new SDKException("API error occurred", (int)httpResponse.StatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
134142
}
135143

136-
return response;
144+
}
145+
else if (response.StatusCode >= 400 && response.StatusCode < 500 || response.StatusCode >= 500 && response.StatusCode < 600)
146+
{
147+
throw new SDKException("API error occurred", (int)httpResponse.StatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
148+
149+
}
150+
else
151+
{
152+
throw new SDKException("unknown status code received", (int)httpResponse.StatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
137153
}
138154
return response;
139155
}
@@ -156,32 +172,46 @@ public async Task<GetCreateChartOfAccountsModelResponse> GetCreateModelAsync(Get
156172
var httpResponse = await client.SendAsync(httpRequest);
157173

158174
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
159-
160175
var response = new GetCreateChartOfAccountsModelResponse
161176
{
162177
StatusCode = (int)httpResponse.StatusCode,
163178
ContentType = contentType,
164179
RawResponse = httpResponse
165180
};
166-
167-
if((response.StatusCode == 200))
181+
if (response.StatusCode == 200)
168182
{
169183
if(Utilities.IsContentTypeMatch("application/json",response.ContentType))
184+
{
185+
var obj = ResponseBodyDeserializer.Deserialize<PushOption>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
186+
response.PushOption = obj;
187+
}
188+
else
170189
{
171-
response.PushOption = JsonConvert.DeserializeObject<PushOption>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }});
190+
throw new SDKException("API error occurred", (int)httpResponse.StatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
172191
}
173192

174-
return response;
175193
}
176-
177-
if((response.StatusCode == 401) || (response.StatusCode == 402) || (response.StatusCode == 403) || (response.StatusCode == 404) || (response.StatusCode == 429) || (response.StatusCode == 500) || (response.StatusCode == 503))
194+
else if (new List<int>{401, 402, 403, 404, 429, 500, 503}.Contains(response.StatusCode))
178195
{
179196
if(Utilities.IsContentTypeMatch("application/json",response.ContentType))
197+
{
198+
var obj = ResponseBodyDeserializer.Deserialize<ErrorMessage>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
199+
throw obj!;
200+
}
201+
else
180202
{
181-
response.ErrorMessage = JsonConvert.DeserializeObject<ErrorMessage>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }});
203+
throw new SDKException("API error occurred", (int)httpResponse.StatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
182204
}
183205

184-
return response;
206+
}
207+
else if (response.StatusCode >= 400 && response.StatusCode < 500 || response.StatusCode >= 500 && response.StatusCode < 600)
208+
{
209+
throw new SDKException("API error occurred", (int)httpResponse.StatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
210+
211+
}
212+
else
213+
{
214+
throw new SDKException("unknown status code received", (int)httpResponse.StatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
185215
}
186216
return response;
187217
}
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
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.Sync.Expenses
12+
{
13+
using Codat.Sync.Expenses.Models.Errors;
14+
using Codat.Sync.Expenses.Models.Operations;
15+
using Codat.Sync.Expenses.Models.Shared;
16+
using Codat.Sync.Expenses.Utils;
17+
using Newtonsoft.Json;
18+
using System.Collections.Generic;
19+
using System.Net.Http.Headers;
20+
using System.Net.Http;
21+
using System.Threading.Tasks;
22+
using System;
23+
24+
/// <summary>
25+
/// Upload attachmens to expenses, transfers and reimbursable expense transactions.
26+
/// </summary>
27+
public interface IAttachments
28+
{
29+
30+
/// <summary>
31+
/// Upload attachment
32+
///
33+
/// <remarks>
34+
/// The *Upload attachment* endpoint uploads an attachment in the accounting software against the given transactionId. <br/>
35+
/// <br/>
36+
/// <a href="https://docs.codat.io/sync-for-expenses-api#/schemas/ExpenseTransaction">Expense transactions</a> represent transactions made with a company debit or credit card. <br/>
37+
/// <br/>
38+
/// **Integration-specific behaviour**<br/>
39+
/// <br/>
40+
/// Each accounting software supports different file formats and sizes.<br/>
41+
/// <br/>
42+
/// | Integration | File Size | File Extension | <br/>
43+
/// |-------------|-------------|--------------------------------------------------------------------------------------------------------------|<br/>
44+
/// | Xero | 4MB | 7Z, BMP, CSV, DOC, DOCX, EML, GIF, JPEG, JPG, KEYNOTE, MSG, NUMBERS, ODF, ODS, ODT, PAGES, PDF, PNG, PPT, PPTX, RAR, RTF, TIF, TIFF, TXT, XLS, XLSX, ZIP |<br/>
45+
/// | QuickBooks Online | 100MB | AI, CSV, DOC, DOCX, EPS, GIF, JPEG, JPG, ODS, PAGES, PDF, PNG, RTF, TIF, TXT, XLS, XLSX, XML |<br/>
46+
/// | NetSuite | 100MB | BMP, CSV, XLS, XLSX, JSON, PDF, PJPG, PJPEG, PNG, TXT, SVG, TIF, TIFF, DOC, DOCX, ZIP |<br/>
47+
/// | Dynamics 365 Business Central | 350 MB | Dynamics do not explicitly outline which file types are supported but they do state &lt;a className=&quot;external&quot; href=&quot;https://learn.microsoft.com/en-gb/dynamics365/business-central/ui-how-add-link-to-record#to-attach-a-file-to-a-purchase-invoice&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt; that &quot;You can attach any type of file, such as text, image, or video files&quot;. |
48+
/// </remarks>
49+
/// </summary>
50+
Task<UploadExpenseAttachmentResponse> UploadAsync(UploadExpenseAttachmentRequest request);
51+
}
52+
53+
/// <summary>
54+
/// Upload attachmens to expenses, transfers and reimbursable expense transactions.
55+
/// </summary>
56+
public class Attachments: IAttachments
57+
{
58+
public SDKConfig SDKConfiguration { get; private set; }
59+
private const string _language = "csharp";
60+
private const string _sdkVersion = "5.3.0";
61+
private const string _sdkGenVersion = "2.301.3";
62+
private const string _openapiDocVersion = "prealpha";
63+
private const string _userAgent = "speakeasy-sdk/csharp 5.3.0 2.301.3 prealpha Codat.Sync.Expenses";
64+
private string _serverUrl = "";
65+
private ISpeakeasyHttpClient _defaultClient;
66+
private Func<Security>? _securitySource;
67+
68+
public Attachments(ISpeakeasyHttpClient defaultClient, Func<Security>? securitySource, string serverUrl, SDKConfig config)
69+
{
70+
_defaultClient = defaultClient;
71+
_securitySource = securitySource;
72+
_serverUrl = serverUrl;
73+
SDKConfiguration = config;
74+
}
75+
76+
public async Task<UploadExpenseAttachmentResponse> UploadAsync(UploadExpenseAttachmentRequest request)
77+
{
78+
string baseUrl = this.SDKConfiguration.GetTemplatedServerDetails();
79+
var urlString = URLBuilder.Build(baseUrl, "/companies/{companyId}/sync/expenses/syncs/{syncId}/transactions/{transactionId}/attachments", request);
80+
81+
var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString);
82+
httpRequest.Headers.Add("user-agent", _userAgent);
83+
84+
var serializedBody = RequestBodySerializer.Serialize(request, "AttachmentUpload", "multipart", false, true);
85+
if (serializedBody != null)
86+
{
87+
httpRequest.Content = serializedBody;
88+
}
89+
90+
var client = _defaultClient;
91+
if (_securitySource != null)
92+
{
93+
client = SecuritySerializer.Apply(_defaultClient, _securitySource);
94+
}
95+
96+
var httpResponse = await client.SendAsync(httpRequest);
97+
98+
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
99+
var response = new UploadExpenseAttachmentResponse
100+
{
101+
StatusCode = (int)httpResponse.StatusCode,
102+
ContentType = contentType,
103+
RawResponse = httpResponse
104+
};
105+
if (response.StatusCode == 200)
106+
{
107+
if(Utilities.IsContentTypeMatch("application/json",response.ContentType))
108+
{
109+
var obj = ResponseBodyDeserializer.Deserialize<Attachment>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
110+
response.Attachment = obj;
111+
}
112+
else
113+
{
114+
throw new SDKException("API error occurred", (int)httpResponse.StatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
115+
}
116+
117+
}
118+
else if (new List<int>{400, 401, 402, 403, 404, 429, 500, 503}.Contains(response.StatusCode))
119+
{
120+
if(Utilities.IsContentTypeMatch("application/json",response.ContentType))
121+
{
122+
var obj = ResponseBodyDeserializer.Deserialize<ErrorMessage>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
123+
throw obj!;
124+
}
125+
else
126+
{
127+
throw new SDKException("API error occurred", (int)httpResponse.StatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
128+
}
129+
130+
}
131+
else if (response.StatusCode >= 400 && response.StatusCode < 500 || response.StatusCode >= 500 && response.StatusCode < 600)
132+
{
133+
throw new SDKException("API error occurred", (int)httpResponse.StatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
134+
135+
}
136+
else
137+
{
138+
throw new SDKException("unknown status code received", (int)httpResponse.StatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
139+
}
140+
return response;
141+
}
142+
143+
}
144+
}

sync-for-expenses/CodatSyncExpenses/CodatSyncExpenses.csproj renamed to sync-for-expenses/Codat/Sync/Expenses/Codat.Sync.Expenses.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<IsPackable>true</IsPackable>
44
<PackageId>Codat.Sync.Expenses</PackageId>
5-
<Version>5.2.0</Version>
5+
<Version>5.3.0</Version>
66
<Authors>Codat</Authors>
77
<TargetFramework>net6.0</TargetFramework>
88
<Nullable>enable</Nullable>

sync-for-expenses/CodatSyncExpenses/CodatSyncExpenses.cs renamed to sync-for-expenses/Codat/Sync/Expenses/CodatSyncExpenses.cs

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#nullable enable
1111
namespace Codat.Sync.Expenses
1212
{
13+
using Codat.Sync.Expenses.Models.Errors;
1314
using Codat.Sync.Expenses.Models.Shared;
1415
using Codat.Sync.Expenses.Utils;
1516
using Newtonsoft.Json;
@@ -78,10 +79,15 @@ public interface ICodatSyncExpenses
7879
public IConfiguration Configuration { get; }
7980

8081
/// <summary>
81-
/// Create expense datasets and upload receipts.
82+
/// Create expense transactions.
8283
/// </summary>
8384
public IExpenses Expenses { get; }
8485

86+
/// <summary>
87+
/// Create reimbursable expense transactions.
88+
/// </summary>
89+
public IReimbursements Reimbursements { get; }
90+
8591
/// <summary>
8692
/// Trigger and monitor expense syncs to accounting software.
8793
/// </summary>
@@ -91,6 +97,16 @@ public interface ICodatSyncExpenses
9197
/// Retrieve the status of transactions within a sync.
9298
/// </summary>
9399
public ITransactionStatus TransactionStatus { get; }
100+
101+
/// <summary>
102+
/// Upload attachmens to expenses, transfers and reimbursable expense transactions.
103+
/// </summary>
104+
public IAttachments Attachments { get; }
105+
106+
/// <summary>
107+
/// Create transfer transactions.
108+
/// </summary>
109+
public ITransfers Transfers { get; }
94110
}
95111

96112
public class SDKConfig
@@ -136,10 +152,10 @@ public class CodatSyncExpenses: ICodatSyncExpenses
136152
public SDKConfig SDKConfiguration { get; private set; }
137153

138154
private const string _language = "csharp";
139-
private const string _sdkVersion = "5.2.0";
140-
private const string _sdkGenVersion = "2.286.2";
155+
private const string _sdkVersion = "5.3.0";
156+
private const string _sdkGenVersion = "2.301.3";
141157
private const string _openapiDocVersion = "prealpha";
142-
private const string _userAgent = "speakeasy-sdk/csharp 5.2.0 2.286.2 prealpha Codat.Sync.Expenses";
158+
private const string _userAgent = "speakeasy-sdk/csharp 5.3.0 2.301.3 prealpha Codat.Sync.Expenses";
143159
private string _serverUrl = "";
144160
private int _serverIndex = 0;
145161
private ISpeakeasyHttpClient _defaultClient;
@@ -153,8 +169,11 @@ public class CodatSyncExpenses: ICodatSyncExpenses
153169
public IPushOperations PushOperations { get; private set; }
154170
public IConfiguration Configuration { get; private set; }
155171
public IExpenses Expenses { get; private set; }
172+
public IReimbursements Reimbursements { get; private set; }
156173
public ISync Sync { get; private set; }
157174
public ITransactionStatus TransactionStatus { get; private set; }
175+
public IAttachments Attachments { get; private set; }
176+
public ITransfers Transfers { get; private set; }
158177

159178
public CodatSyncExpenses(Security? security = null, Func<Security>? securitySource = null, int? serverIndex = null, string? serverUrl = null, Dictionary<string, string>? urlParams = null, ISpeakeasyHttpClient? client = null)
160179
{
@@ -206,8 +225,11 @@ public CodatSyncExpenses(Security? security = null, Func<Security>? securitySour
206225
PushOperations = new PushOperations(_defaultClient, _securitySource, _serverUrl, SDKConfiguration);
207226
Configuration = new Configuration(_defaultClient, _securitySource, _serverUrl, SDKConfiguration);
208227
Expenses = new Expenses(_defaultClient, _securitySource, _serverUrl, SDKConfiguration);
228+
Reimbursements = new Reimbursements(_defaultClient, _securitySource, _serverUrl, SDKConfiguration);
209229
Sync = new Sync(_defaultClient, _securitySource, _serverUrl, SDKConfiguration);
210230
TransactionStatus = new TransactionStatus(_defaultClient, _securitySource, _serverUrl, SDKConfiguration);
231+
Attachments = new Attachments(_defaultClient, _securitySource, _serverUrl, SDKConfiguration);
232+
Transfers = new Transfers(_defaultClient, _securitySource, _serverUrl, SDKConfiguration);
211233
}
212234
}
213235
}

0 commit comments

Comments
 (0)