Skip to content

Commit

Permalink
chore: speakeasy run
Browse files Browse the repository at this point in the history
  manual tweak- remove outLocation
  • Loading branch information
ma575081 committed Jun 7, 2024
1 parent 260c202 commit 4aa63b8
Show file tree
Hide file tree
Showing 210 changed files with 1,134 additions and 4,421 deletions.
450 changes: 158 additions & 292 deletions .speakeasy/gen.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ generation:
auth:
oAuth2ClientCredentialsEnabled: true
csharp:
version: 0.0.1
version: 0.1.0
additionalDependencies: []
author: Shippo
clientServerStatusCodesAsErrors: true
Expand Down
11 changes: 6 additions & 5 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
speakeasyVersion: 1.295.1
speakeasyVersion: 1.299.6
sources:
openapi:
sourceNamespace: openapi
sourceRevisionDigest: sha256:9920da8577d9bb20b80b89cc17bd4ba1fec5570bb3106af1d05556f60349a998
sourceBlobDigest: sha256:587db21ce418171f1cae00b4490cdd5af1a3b7117debe10ba19f4ba678920d62
sourceRevisionDigest: sha256:4dfaf65fb7bd151cd888f9b929beebf0b1b82ffd54310141a0dc71cc51184e0b
sourceBlobDigest: sha256:d5bab9648473be21eb7d2d79b5495a7646d759666fa4556aeb4ca885c7b41afb
tags:
- latest
targets:
csharp:
source: openapi
sourceNamespace: openapi
sourceRevisionDigest: sha256:9920da8577d9bb20b80b89cc17bd4ba1fec5570bb3106af1d05556f60349a998
sourceBlobDigest: sha256:587db21ce418171f1cae00b4490cdd5af1a3b7117debe10ba19f4ba678920d62
sourceRevisionDigest: sha256:4dfaf65fb7bd151cd888f9b929beebf0b1b82ffd54310141a0dc71cc51184e0b
sourceBlobDigest: sha256:d5bab9648473be21eb7d2d79b5495a7646d759666fa4556aeb4ca885c7b41afb
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest
sources:
openapi:
inputs:
Expand Down
1 change: 1 addition & 0 deletions .speakeasy/workflow.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
workflowVersion: 1.0.0
speakeasyVersion: latest
sources:
openapi:
inputs:
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,14 @@ var sdk = new ShippoSDK(
apiKeyHeader: "<YOUR_API_KEY_HERE>",
shippoApiVersion: "2018-02-08");

InitiateOauth2SigninRequest req = new InitiateOauth2SigninRequest() {
CarrierAccountObjectId = "<value>",
RedirectUri = "http://fine-cummerbund.biz",
};

try
{
var res = await sdk.CarrierAccounts.InitiateOauth2SigninAsync(
carrierAccountObjectId: "<value>",
redirectUri: "http://fine-cummerbund.biz",
state: "<value>",
shippoApiVersion: "2018-02-08");
var res = await sdk.CarrierAccounts.InitiateOauth2SigninAsync(req);
// handle response
}
catch (Exception ex)
Expand Down
116 changes: 34 additions & 82 deletions Shippo/Addresses.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public interface IAddresses
/// Returns a list of all address objects that have been created in this account.
/// </remarks>
/// </summary>
Task<ListAddressesResponse> ListAsync(long? page = null, long? results = null, string? shippoApiVersion = null);
Task<AddressPaginatedList> ListAsync(long? page = null, long? results = null, string? shippoApiVersion = null);

/// <summary>
/// Create a new address
Expand All @@ -48,7 +48,7 @@ public interface IAddresses
/// Creates a new address object. You can use address objects to create new shipments, calculate rates, and to create orders.
/// </remarks>
/// </summary>
Task<CreateAddressResponse> CreateAsync(AddressCreateRequest addressCreateRequest, string? shippoApiVersion = null);
Task<Address> CreateAsync(AddressCreateRequest addressCreateRequest, string? shippoApiVersion = null);

/// <summary>
/// Retrieve an address
Expand All @@ -57,7 +57,7 @@ public interface IAddresses
/// Returns an existing address using an object ID.
/// </remarks>
/// </summary>
Task<GetAddressResponse> GetAsync(string addressId, string? shippoApiVersion = null);
Task<Address> GetAsync(string addressId, string? shippoApiVersion = null);

/// <summary>
/// Validate an address
Expand All @@ -66,7 +66,7 @@ public interface IAddresses
/// Validates an existing address using an object ID
/// </remarks>
/// </summary>
Task<ValidateAddressResponse> ValidateAsync(string addressId, string? shippoApiVersion = null);
Task<Address> ValidateAsync(string addressId, string? shippoApiVersion = null);
}

/// <summary>
Expand All @@ -80,23 +80,23 @@ public class Addresses: IAddresses
{
public SDKConfig SDKConfiguration { get; private set; }
private const string _language = "csharp";
private const string _sdkVersion = "0.0.1";
private const string _sdkGenVersion = "2.335.5";
private const string _sdkVersion = "0.1.0";
private const string _sdkGenVersion = "2.338.12";
private const string _openapiDocVersion = "2018-02-08";
private const string _userAgent = "speakeasy-sdk/csharp 0.0.1 2.335.5 2018-02-08 Shippo";
private const string _userAgent = "speakeasy-sdk/csharp 0.1.0 2.338.12 2018-02-08 Shippo";
private string _serverUrl = "";
private ISpeakeasyHttpClient _defaultClient;
private ISpeakeasyHttpClient _client;
private Func<Security>? _securitySource;

public Addresses(ISpeakeasyHttpClient defaultClient, Func<Security>? securitySource, string serverUrl, SDKConfig config)
public Addresses(ISpeakeasyHttpClient client, Func<Security>? securitySource, string serverUrl, SDKConfig config)
{
_defaultClient = defaultClient;
_client = client;
_securitySource = securitySource;
_serverUrl = serverUrl;
SDKConfiguration = config;
}

public async Task<ListAddressesResponse> ListAsync(long? page = null, long? results = null, string? shippoApiVersion = null)
public async Task<AddressPaginatedList> ListAsync(long? page = null, long? results = null, string? shippoApiVersion = null)
{
var request = new ListAddressesRequest()
{
Expand Down Expand Up @@ -125,7 +125,7 @@ public async Task<ListAddressesResponse> ListAsync(long? page = null, long? resu
HttpResponseMessage httpResponse;
try
{
httpResponse = await _defaultClient.SendAsync(httpRequest);
httpResponse = await _client.SendAsync(httpRequest);
int _statusCode = (int)httpResponse.StatusCode;

if (_statusCode == 400 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
Expand Down Expand Up @@ -159,33 +159,21 @@ public async Task<ListAddressesResponse> ListAsync(long? page = null, long? resu
if(Utilities.IsContentTypeMatch("application/json", contentType))
{
var obj = ResponseBodyDeserializer.Deserialize<AddressPaginatedList>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
var response = new ListAddressesResponse()
{
HttpMeta = new Models.Components.HTTPMetadata()
{
Response = httpResponse,
Request = httpRequest
}
};
response.AddressPaginatedList = obj;
return response;
}
else
{
throw new SDKException("Unknown content type received", httpRequest, httpResponse);
return obj!;
}
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
else if(responseStatusCode == 400 || responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
{
throw new SDKException("API error occurred", httpRequest, httpResponse);
throw new SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
else
{
throw new SDKException("Unknown status code received", httpRequest, httpResponse);
throw new SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
}

public async Task<CreateAddressResponse> CreateAsync(AddressCreateRequest addressCreateRequest, string? shippoApiVersion = null)
public async Task<Address> CreateAsync(AddressCreateRequest addressCreateRequest, string? shippoApiVersion = null)
{
var request = new CreateAddressRequest()
{
Expand Down Expand Up @@ -220,7 +208,7 @@ public async Task<CreateAddressResponse> CreateAsync(AddressCreateRequest addres
HttpResponseMessage httpResponse;
try
{
httpResponse = await _defaultClient.SendAsync(httpRequest);
httpResponse = await _client.SendAsync(httpRequest);
int _statusCode = (int)httpResponse.StatusCode;

if (_statusCode == 400 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
Expand Down Expand Up @@ -254,33 +242,21 @@ public async Task<CreateAddressResponse> CreateAsync(AddressCreateRequest addres
if(Utilities.IsContentTypeMatch("application/json", contentType))
{
var obj = ResponseBodyDeserializer.Deserialize<Address>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
var response = new CreateAddressResponse()
{
HttpMeta = new Models.Components.HTTPMetadata()
{
Response = httpResponse,
Request = httpRequest
}
};
response.Address = obj;
return response;
}
else
{
throw new SDKException("Unknown content type received", httpRequest, httpResponse);
return obj!;
}
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
else if(responseStatusCode == 400 || responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
{
throw new SDKException("API error occurred", httpRequest, httpResponse);
throw new SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
else
{
throw new SDKException("Unknown status code received", httpRequest, httpResponse);
throw new SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
}

public async Task<GetAddressResponse> GetAsync(string addressId, string? shippoApiVersion = null)
public async Task<Address> GetAsync(string addressId, string? shippoApiVersion = null)
{
var request = new GetAddressRequest()
{
Expand Down Expand Up @@ -308,7 +284,7 @@ public async Task<GetAddressResponse> GetAsync(string addressId, string? shippoA
HttpResponseMessage httpResponse;
try
{
httpResponse = await _defaultClient.SendAsync(httpRequest);
httpResponse = await _client.SendAsync(httpRequest);
int _statusCode = (int)httpResponse.StatusCode;

if (_statusCode == 400 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
Expand Down Expand Up @@ -342,33 +318,21 @@ public async Task<GetAddressResponse> GetAsync(string addressId, string? shippoA
if(Utilities.IsContentTypeMatch("application/json", contentType))
{
var obj = ResponseBodyDeserializer.Deserialize<Address>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
var response = new GetAddressResponse()
{
HttpMeta = new Models.Components.HTTPMetadata()
{
Response = httpResponse,
Request = httpRequest
}
};
response.Address = obj;
return response;
}
else
{
throw new SDKException("Unknown content type received", httpRequest, httpResponse);
return obj!;
}
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
else if(responseStatusCode == 400 || responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
{
throw new SDKException("API error occurred", httpRequest, httpResponse);
throw new SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
else
{
throw new SDKException("Unknown status code received", httpRequest, httpResponse);
throw new SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
}

public async Task<ValidateAddressResponse> ValidateAsync(string addressId, string? shippoApiVersion = null)
public async Task<Address> ValidateAsync(string addressId, string? shippoApiVersion = null)
{
var request = new ValidateAddressRequest()
{
Expand Down Expand Up @@ -396,7 +360,7 @@ public async Task<ValidateAddressResponse> ValidateAsync(string addressId, strin
HttpResponseMessage httpResponse;
try
{
httpResponse = await _defaultClient.SendAsync(httpRequest);
httpResponse = await _client.SendAsync(httpRequest);
int _statusCode = (int)httpResponse.StatusCode;

if (_statusCode == 400 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
Expand Down Expand Up @@ -430,29 +394,17 @@ public async Task<ValidateAddressResponse> ValidateAsync(string addressId, strin
if(Utilities.IsContentTypeMatch("application/json", contentType))
{
var obj = ResponseBodyDeserializer.Deserialize<Address>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
var response = new ValidateAddressResponse()
{
HttpMeta = new Models.Components.HTTPMetadata()
{
Response = httpResponse,
Request = httpRequest
}
};
response.Address = obj;
return response;
}
else
{
throw new SDKException("Unknown content type received", httpRequest, httpResponse);
return obj!;
}
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
else if(responseStatusCode == 400 || responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
{
throw new SDKException("API error occurred", httpRequest, httpResponse);
throw new SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
else
{
throw new SDKException("Unknown status code received", httpRequest, httpResponse);
throw new SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
}
}
Expand Down
Loading

0 comments on commit 4aa63b8

Please sign in to comment.