Skip to content

Commit 148b329

Browse files
committed
chore: Reintroduce SDK with right casing
1 parent 72dec7d commit 148b329

File tree

422 files changed

+59648
-6
lines changed

Some content is hidden

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

422 files changed

+59648
-6
lines changed

.speakeasy/gen.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ management:
55
docVersion: 1.0.0
66
speakeasyVersion: 1.543.6
77
generationVersion: 2.598.22
8-
releaseVersion: 0.0.8
9-
configChecksum: 4ac8483f3df639f91333757853a7129c
8+
releaseVersion: 0.0.9
9+
configChecksum: dc253715a53146b4353ee0d8ad68a788
1010
published: true
1111
features:
1212
csharp:

.speakeasy/gen.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ generation:
1616
oAuth2ClientCredentialsEnabled: false
1717
oAuth2PasswordEnabled: false
1818
csharp:
19-
version: 0.0.8
19+
version: 0.0.9
2020
additionalDependencies: []
2121
author: Gr4vy
2222
clientServerStatusCodesAsErrors: true

.speakeasy/workflow.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ sources:
88
- latest
99
openapi:
1010
sourceNamespace: openapi
11-
sourceRevisionDigest: sha256:d9c27e67216b2bb5b2a48cbb1bca26ce5757d612cbacdc9265dbc2d2c01b7969
11+
sourceRevisionDigest: sha256:14bc1abc876beaef68e42814c0a3b609f605c8fe72f4fb7afdec4b5f9089e875
1212
sourceBlobDigest: sha256:401058100c062781b727963b34eca9058a912382df5931b40d824efb3a76e4f8
1313
tags:
1414
- latest
@@ -17,10 +17,10 @@ targets:
1717
csharp:
1818
source: openapi
1919
sourceNamespace: openapi
20-
sourceRevisionDigest: sha256:d9c27e67216b2bb5b2a48cbb1bca26ce5757d612cbacdc9265dbc2d2c01b7969
20+
sourceRevisionDigest: sha256:14bc1abc876beaef68e42814c0a3b609f605c8fe72f4fb7afdec4b5f9089e875
2121
sourceBlobDigest: sha256:401058100c062781b727963b34eca9058a912382df5931b40d824efb3a76e4f8
2222
codeSamplesNamespace: openapi-csharp-code-samples
23-
codeSamplesRevisionDigest: sha256:24b1f93c31096eec102340b21f86f0c803672f155dbac8674da7ac24a24bfa87
23+
codeSamplesRevisionDigest: sha256:239afada2ed0b76a0d226cf610c65f26ceb9e95dae029732ed1079d688c052ba
2424
workflow:
2525
workflowVersion: 1.0.0
2626
speakeasyVersion: latest

src/Gr4vy/AccountUpdater.cs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
//------------------------------------------------------------------------------
2+
// <auto-generated>
3+
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
4+
//
5+
// Changes to this file may cause incorrect behavior and will be lost when
6+
// the code is regenerated.
7+
// </auto-generated>
8+
//------------------------------------------------------------------------------
9+
#nullable enable
10+
namespace Gr4vy
11+
{
12+
using Gr4vy.Models.Components;
13+
using Gr4vy.Models.Errors;
14+
using Gr4vy.Utils;
15+
using System;
16+
17+
public interface IAccountUpdater
18+
{
19+
public IJobs Jobs { get; }
20+
}
21+
22+
public class AccountUpdater: IAccountUpdater
23+
{
24+
public SDKConfig SDKConfiguration { get; private set; }
25+
private const string _language = "csharp";
26+
private const string _sdkVersion = "0.0.9";
27+
private const string _sdkGenVersion = "2.598.22";
28+
private const string _openapiDocVersion = "1.0.0";
29+
private const string _userAgent = "speakeasy-sdk/csharp 0.0.9 2.598.22 1.0.0 Gr4vy";
30+
private string _serverUrl = "";
31+
private ISpeakeasyHttpClient _client;
32+
private Func<Gr4vy.Models.Components.Security>? _securitySource;
33+
public IJobs Jobs { get; private set; }
34+
35+
public AccountUpdater(ISpeakeasyHttpClient client, Func<Gr4vy.Models.Components.Security>? securitySource, string serverUrl, SDKConfig config)
36+
{
37+
_client = client;
38+
_securitySource = securitySource;
39+
_serverUrl = serverUrl;
40+
SDKConfiguration = config;
41+
Jobs = new Jobs(_client, _securitySource, _serverUrl, SDKConfiguration);
42+
}
43+
}
44+
}

src/Gr4vy/All.cs

Lines changed: 274 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,274 @@
1+
//------------------------------------------------------------------------------
2+
// <auto-generated>
3+
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
4+
//
5+
// Changes to this file may cause incorrect behavior and will be lost when
6+
// the code is regenerated.
7+
// </auto-generated>
8+
//------------------------------------------------------------------------------
9+
#nullable enable
10+
namespace Gr4vy
11+
{
12+
using Gr4vy.Hooks;
13+
using Gr4vy.Models.Components;
14+
using Gr4vy.Models.Errors;
15+
using Gr4vy.Models.Requests;
16+
using Gr4vy.Utils;
17+
using Gr4vy.Utils.Retries;
18+
using Newtonsoft.Json;
19+
using System;
20+
using System.Collections.Generic;
21+
using System.Net.Http;
22+
using System.Net.Http.Headers;
23+
using System.Threading.Tasks;
24+
25+
public interface IAll
26+
{
27+
28+
/// <summary>
29+
/// Create batch transaction refund
30+
///
31+
/// <remarks>
32+
/// Create a refund for all instruments on a transaction.
33+
/// </remarks>
34+
/// </summary>
35+
Task<CollectionNoCursorRefund> CreateAsync(string transactionId, double? timeoutInSeconds = 1D, string? merchantAccountId = null, TransactionRefundAllCreate? transactionRefundAllCreate = null);
36+
}
37+
38+
public class All: IAll
39+
{
40+
public SDKConfig SDKConfiguration { get; private set; }
41+
private const string _language = "csharp";
42+
private const string _sdkVersion = "0.0.9";
43+
private const string _sdkGenVersion = "2.598.22";
44+
private const string _openapiDocVersion = "1.0.0";
45+
private const string _userAgent = "speakeasy-sdk/csharp 0.0.9 2.598.22 1.0.0 Gr4vy";
46+
private string _serverUrl = "";
47+
private ISpeakeasyHttpClient _client;
48+
private Func<Gr4vy.Models.Components.Security>? _securitySource;
49+
50+
public All(ISpeakeasyHttpClient client, Func<Gr4vy.Models.Components.Security>? securitySource, string serverUrl, SDKConfig config)
51+
{
52+
_client = client;
53+
_securitySource = securitySource;
54+
_serverUrl = serverUrl;
55+
SDKConfiguration = config;
56+
}
57+
58+
public async Task<CollectionNoCursorRefund> CreateAsync(string transactionId, double? timeoutInSeconds = 1D, string? merchantAccountId = null, TransactionRefundAllCreate? transactionRefundAllCreate = null)
59+
{
60+
var request = new CreateFullTransactionRefundRequest()
61+
{
62+
TransactionId = transactionId,
63+
TimeoutInSeconds = timeoutInSeconds,
64+
MerchantAccountId = merchantAccountId,
65+
TransactionRefundAllCreate = transactionRefundAllCreate,
66+
};
67+
request.MerchantAccountId ??= SDKConfiguration.MerchantAccountId;
68+
69+
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
70+
var urlString = URLBuilder.Build(baseUrl, "/transactions/{transaction_id}/refunds/all", request);
71+
72+
var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString);
73+
httpRequest.Headers.Add("user-agent", _userAgent);
74+
HeaderSerializer.PopulateHeaders(ref httpRequest, request);
75+
76+
var serializedBody = RequestBodySerializer.Serialize(request, "TransactionRefundAllCreate", "json", true, true);
77+
if (serializedBody != null)
78+
{
79+
httpRequest.Content = serializedBody;
80+
}
81+
82+
if (_securitySource != null)
83+
{
84+
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
85+
}
86+
87+
var hookCtx = new HookContext(baseUrl, "create_full_transaction_refund", new List<string> { }, _securitySource);
88+
89+
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
90+
91+
HttpResponseMessage httpResponse;
92+
try
93+
{
94+
httpResponse = await _client.SendAsync(httpRequest);
95+
int _statusCode = (int)httpResponse.StatusCode;
96+
97+
if (_statusCode == 400 || _statusCode == 401 || _statusCode == 403 || _statusCode == 404 || _statusCode == 405 || _statusCode == 409 || _statusCode == 422 || _statusCode == 425 || _statusCode == 429 || _statusCode >= 400 && _statusCode < 500 || _statusCode == 500 || _statusCode == 502 || _statusCode == 504 || _statusCode >= 500 && _statusCode < 600)
98+
{
99+
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
100+
if (_httpResponse != null)
101+
{
102+
httpResponse = _httpResponse;
103+
}
104+
}
105+
}
106+
catch (Exception error)
107+
{
108+
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
109+
if (_httpResponse != null)
110+
{
111+
httpResponse = _httpResponse;
112+
}
113+
else
114+
{
115+
throw;
116+
}
117+
}
118+
119+
httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
120+
121+
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
122+
int responseStatusCode = (int)httpResponse.StatusCode;
123+
if(responseStatusCode == 201)
124+
{
125+
if(Utilities.IsContentTypeMatch("application/json", contentType))
126+
{
127+
var obj = ResponseBodyDeserializer.Deserialize<CollectionNoCursorRefund>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
128+
return obj!;
129+
}
130+
131+
throw new Models.Errors.APIException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
132+
}
133+
else if(responseStatusCode == 400)
134+
{
135+
if(Utilities.IsContentTypeMatch("application/json", contentType))
136+
{
137+
var obj = ResponseBodyDeserializer.Deserialize<Error400>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
138+
throw obj!;
139+
}
140+
141+
throw new Models.Errors.APIException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
142+
}
143+
else if(responseStatusCode == 401)
144+
{
145+
if(Utilities.IsContentTypeMatch("application/json", contentType))
146+
{
147+
var obj = ResponseBodyDeserializer.Deserialize<Error401>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
148+
throw obj!;
149+
}
150+
151+
throw new Models.Errors.APIException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
152+
}
153+
else if(responseStatusCode == 403)
154+
{
155+
if(Utilities.IsContentTypeMatch("application/json", contentType))
156+
{
157+
var obj = ResponseBodyDeserializer.Deserialize<Response403CreateFullTransactionRefund>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
158+
switch (obj!.Type.ToString()) {
159+
case "Error403":
160+
throw obj!.Error403!;
161+
case "Error403Forbidden":
162+
throw obj!.Error403Forbidden!;
163+
case "Error403Active":
164+
throw obj!.Error403Active!;
165+
default:
166+
throw new InvalidOperationException("Unknown error type.");
167+
};
168+
}
169+
170+
throw new Models.Errors.APIException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
171+
}
172+
else if(responseStatusCode == 404)
173+
{
174+
if(Utilities.IsContentTypeMatch("application/json", contentType))
175+
{
176+
var obj = ResponseBodyDeserializer.Deserialize<Error404>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
177+
throw obj!;
178+
}
179+
180+
throw new Models.Errors.APIException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
181+
}
182+
else if(responseStatusCode == 405)
183+
{
184+
if(Utilities.IsContentTypeMatch("application/json", contentType))
185+
{
186+
var obj = ResponseBodyDeserializer.Deserialize<Error405>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
187+
throw obj!;
188+
}
189+
190+
throw new Models.Errors.APIException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
191+
}
192+
else if(responseStatusCode == 409)
193+
{
194+
if(Utilities.IsContentTypeMatch("application/json", contentType))
195+
{
196+
var obj = ResponseBodyDeserializer.Deserialize<Error409>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
197+
throw obj!;
198+
}
199+
200+
throw new Models.Errors.APIException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
201+
}
202+
else if(responseStatusCode == 422)
203+
{
204+
if(Utilities.IsContentTypeMatch("application/json", contentType))
205+
{
206+
var obj = ResponseBodyDeserializer.Deserialize<HTTPValidationError>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
207+
throw obj!;
208+
}
209+
210+
throw new Models.Errors.APIException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
211+
}
212+
else if(responseStatusCode == 425)
213+
{
214+
if(Utilities.IsContentTypeMatch("application/json", contentType))
215+
{
216+
var obj = ResponseBodyDeserializer.Deserialize<Error425>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
217+
throw obj!;
218+
}
219+
220+
throw new Models.Errors.APIException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
221+
}
222+
else if(responseStatusCode == 429)
223+
{
224+
if(Utilities.IsContentTypeMatch("application/json", contentType))
225+
{
226+
var obj = ResponseBodyDeserializer.Deserialize<Error429>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
227+
throw obj!;
228+
}
229+
230+
throw new Models.Errors.APIException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
231+
}
232+
else if(responseStatusCode == 500)
233+
{
234+
if(Utilities.IsContentTypeMatch("application/json", contentType))
235+
{
236+
var obj = ResponseBodyDeserializer.Deserialize<Error500>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
237+
throw obj!;
238+
}
239+
240+
throw new Models.Errors.APIException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
241+
}
242+
else if(responseStatusCode == 502)
243+
{
244+
if(Utilities.IsContentTypeMatch("application/json", contentType))
245+
{
246+
var obj = ResponseBodyDeserializer.Deserialize<Error502>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
247+
throw obj!;
248+
}
249+
250+
throw new Models.Errors.APIException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
251+
}
252+
else if(responseStatusCode == 504)
253+
{
254+
if(Utilities.IsContentTypeMatch("application/json", contentType))
255+
{
256+
var obj = ResponseBodyDeserializer.Deserialize<Error504>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
257+
throw obj!;
258+
}
259+
260+
throw new Models.Errors.APIException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
261+
}
262+
else if(responseStatusCode >= 400 && responseStatusCode < 500)
263+
{
264+
throw new Models.Errors.APIException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
265+
}
266+
else if(responseStatusCode >= 500 && responseStatusCode < 600)
267+
{
268+
throw new Models.Errors.APIException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
269+
}
270+
271+
throw new Models.Errors.APIException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
272+
}
273+
}
274+
}

0 commit comments

Comments
 (0)