Skip to content

Commit

Permalink
(feat): progagate error information in exceptions + OneOf serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] authored May 30, 2024
1 parent a126e29 commit 217bb47
Show file tree
Hide file tree
Showing 39 changed files with 350 additions and 197 deletions.
20 changes: 10 additions & 10 deletions src/SchematicHQ.Client.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchematicHQ.Client", "SchematicHQ.Client\SchematicHQ.Client.csproj", "{9D960752-6A6C-4615-B2EE-EBC8CC65BBDB}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchematicHQ.Client", "SchematicHQ.Client\SchematicHQ.Client.csproj", "{BD437CF4-C32D-45DA-A37D-B1BC0CA7D8E8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchematicHQ.Client.Test", "SchematicHQ.Client.Test\SchematicHQ.Client.Test.csproj", "{D1530504-2088-4600-842D-6215C52820DC}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchematicHQ.Client.Test", "SchematicHQ.Client.Test\SchematicHQ.Client.Test.csproj", "{EA356414-8080-48AE-9B9E-30A369A27D33}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -16,13 +16,13 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9D960752-6A6C-4615-B2EE-EBC8CC65BBDB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9D960752-6A6C-4615-B2EE-EBC8CC65BBDB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9D960752-6A6C-4615-B2EE-EBC8CC65BBDB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9D960752-6A6C-4615-B2EE-EBC8CC65BBDB}.Release|Any CPU.Build.0 = Release|Any CPU
{D1530504-2088-4600-842D-6215C52820DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D1530504-2088-4600-842D-6215C52820DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D1530504-2088-4600-842D-6215C52820DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D1530504-2088-4600-842D-6215C52820DC}.Release|Any CPU.Build.0 = Release|Any CPU
{BD437CF4-C32D-45DA-A37D-B1BC0CA7D8E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BD437CF4-C32D-45DA-A37D-B1BC0CA7D8E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BD437CF4-C32D-45DA-A37D-B1BC0CA7D8E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BD437CF4-C32D-45DA-A37D-B1BC0CA7D8E8}.Release|Any CPU.Build.0 = Release|Any CPU
{EA356414-8080-48AE-9B9E-30A369A27D33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EA356414-8080-48AE-9B9E-30A369A27D33}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EA356414-8080-48AE-9B9E-30A369A27D33}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EA356414-8080-48AE-9B9E-30A369A27D33}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
28 changes: 14 additions & 14 deletions src/SchematicHQ.Client/Accounts/AccountsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public async Task<ListApiKeysResponse> ListApiKeysAsync(ListApiKeysRequest reque
{
return JsonSerializer.Deserialize<ListApiKeysResponse>(responseBody);
}
throw new Exception();
throw new Exception(responseBody);
}

public async Task<CreateApiKeyResponse> CreateApiKeyAsync(CreateApiKeyRequestBody request)
Expand All @@ -63,7 +63,7 @@ public async Task<CreateApiKeyResponse> CreateApiKeyAsync(CreateApiKeyRequestBod
{
return JsonSerializer.Deserialize<CreateApiKeyResponse>(responseBody);
}
throw new Exception();
throw new Exception(responseBody);
}

public async Task<GetApiKeyResponse> GetApiKeyAsync(string apiKeyId)
Expand All @@ -76,7 +76,7 @@ public async Task<GetApiKeyResponse> GetApiKeyAsync(string apiKeyId)
{
return JsonSerializer.Deserialize<GetApiKeyResponse>(responseBody);
}
throw new Exception();
throw new Exception(responseBody);
}

public async Task<UpdateApiKeyResponse> UpdateApiKeyAsync(
Expand All @@ -97,7 +97,7 @@ UpdateApiKeyRequestBody request
{
return JsonSerializer.Deserialize<UpdateApiKeyResponse>(responseBody);
}
throw new Exception();
throw new Exception(responseBody);
}

public async Task<DeleteApiKeyResponse> DeleteApiKeyAsync(string apiKeyId)
Expand All @@ -110,7 +110,7 @@ public async Task<DeleteApiKeyResponse> DeleteApiKeyAsync(string apiKeyId)
{
return JsonSerializer.Deserialize<DeleteApiKeyResponse>(responseBody);
}
throw new Exception();
throw new Exception(responseBody);
}

public async Task<CountApiKeysResponse> CountApiKeysAsync(CountApiKeysRequest request)
Expand Down Expand Up @@ -144,7 +144,7 @@ public async Task<CountApiKeysResponse> CountApiKeysAsync(CountApiKeysRequest re
{
return JsonSerializer.Deserialize<CountApiKeysResponse>(responseBody);
}
throw new Exception();
throw new Exception(responseBody);
}

public async Task<ListApiRequestsResponse> ListApiRequestsAsync(ListApiRequestsRequest request)
Expand Down Expand Up @@ -183,7 +183,7 @@ public async Task<ListApiRequestsResponse> ListApiRequestsAsync(ListApiRequestsR
{
return JsonSerializer.Deserialize<ListApiRequestsResponse>(responseBody);
}
throw new Exception();
throw new Exception(responseBody);
}

public async Task<GetApiRequestResponse> GetApiRequestAsync(string apiRequestId)
Expand All @@ -200,7 +200,7 @@ public async Task<GetApiRequestResponse> GetApiRequestAsync(string apiRequestId)
{
return JsonSerializer.Deserialize<GetApiRequestResponse>(responseBody);
}
throw new Exception();
throw new Exception(responseBody);
}

public async Task<CountApiRequestsResponse> CountApiRequestsAsync(
Expand Down Expand Up @@ -241,7 +241,7 @@ CountApiRequestsRequest request
{
return JsonSerializer.Deserialize<CountApiRequestsResponse>(responseBody);
}
throw new Exception();
throw new Exception(responseBody);
}

public async Task<ListEnvironmentsResponse> ListEnvironmentsAsync(
Expand Down Expand Up @@ -274,7 +274,7 @@ ListEnvironmentsRequest request
{
return JsonSerializer.Deserialize<ListEnvironmentsResponse>(responseBody);
}
throw new Exception();
throw new Exception(responseBody);
}

public async Task<CreateEnvironmentResponse> CreateEnvironmentAsync(
Expand All @@ -294,7 +294,7 @@ CreateEnvironmentRequestBody request
{
return JsonSerializer.Deserialize<CreateEnvironmentResponse>(responseBody);
}
throw new Exception();
throw new Exception(responseBody);
}

public async Task<GetEnvironmentResponse> GetEnvironmentAsync(string environmentId)
Expand All @@ -311,7 +311,7 @@ public async Task<GetEnvironmentResponse> GetEnvironmentAsync(string environment
{
return JsonSerializer.Deserialize<GetEnvironmentResponse>(responseBody);
}
throw new Exception();
throw new Exception(responseBody);
}

public async Task<UpdateEnvironmentResponse> UpdateEnvironmentAsync(
Expand All @@ -332,7 +332,7 @@ UpdateEnvironmentRequestBody request
{
return JsonSerializer.Deserialize<UpdateEnvironmentResponse>(responseBody);
}
throw new Exception();
throw new Exception(responseBody);
}

public async Task<DeleteEnvironmentResponse> DeleteEnvironmentAsync(string environmentId)
Expand All @@ -349,6 +349,6 @@ public async Task<DeleteEnvironmentResponse> DeleteEnvironmentAsync(string envir
{
return JsonSerializer.Deserialize<DeleteEnvironmentResponse>(responseBody);
}
throw new Exception();
throw new Exception(responseBody);
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
using System.Runtime.Serialization;
using System.Text.Json.Serialization;
using SchematicHQ.Client;
using SchematicHQ.Client.Core;

#nullable enable

namespace SchematicHQ.Client;

[JsonConverter(typeof(StringEnumSerializer<CreateEnvironmentRequestBodyEnvironmentType>))]
public enum CreateEnvironmentRequestBodyEnvironmentType
{
[EnumMember(Value = "development")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
using System.Runtime.Serialization;
using System.Text.Json.Serialization;
using SchematicHQ.Client;
using SchematicHQ.Client.Core;

#nullable enable

namespace SchematicHQ.Client;

[JsonConverter(typeof(StringEnumSerializer<UpdateEnvironmentRequestBodyEnvironmentType>))]
public enum UpdateEnvironmentRequestBodyEnvironmentType
{
[EnumMember(Value = "development")]
Expand Down
6 changes: 3 additions & 3 deletions src/SchematicHQ.Client/Billing/BillingClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ CreateBillingProductRequestBody request
{
return JsonSerializer.Deserialize<UpsertBillingProductResponse>(responseBody);
}
throw new Exception();
throw new Exception(responseBody);
}

public async Task<ListProductsResponse> ListProductsAsync(ListProductsRequest request)
Expand Down Expand Up @@ -66,7 +66,7 @@ public async Task<ListProductsResponse> ListProductsAsync(ListProductsRequest re
{
return JsonSerializer.Deserialize<ListProductsResponse>(responseBody);
}
throw new Exception();
throw new Exception(responseBody);
}

public async Task<UpsertBillingSubscriptionResponse> UpsertBillingSubscriptionAsync(
Expand All @@ -86,6 +86,6 @@ CreateBillingSubscriptionsRequestBody request
{
return JsonSerializer.Deserialize<UpsertBillingSubscriptionResponse>(responseBody);
}
throw new Exception();
throw new Exception(responseBody);
}
}
Loading

0 comments on commit 217bb47

Please sign in to comment.