From 8141f51c326d0be93a7b6b253ac73ca4076ebecd Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Mon, 27 Jul 2026 17:49:48 +0000 Subject: [PATCH 1/2] [fern-generated] Update SDK Generated by Fern CLI Version: unknown Generators: - fernapi/fern-csharp-sdk: 2.71.1 --- .fern/metadata.json | 6 +- WASM_VERSION | 1 - reference.md | 286 ++++++++++ .../Accounts/AccountsClient.cs | 8 +- .../Requests/CountAccountMembersRequest.cs | 6 + .../Requests/ListAccountMembersRequest.cs | 6 + .../Types/CountAccountMembersParams.cs | 6 + .../Types/ListAccountMembersParams.cs | 6 + .../Checkout/CheckoutClient.cs | 345 ++++++++++++ .../Checkout/ICheckoutClient.cs | 13 + .../UpdateCompanyBillingDetailsRequestBody.cs | 26 + .../Types/GetCompanyBillingDetailsResponse.cs | 34 ++ .../UpdateCompanyBillingDetailsResponse.cs | 34 ++ src/SchematicHQ.Client/Core/Public/Version.cs | 2 +- src/SchematicHQ.Client/ISchematicApi.cs | 1 + .../Licenses/ILicensesClient.cs | 22 + .../Licenses/LicensesClient.cs | 528 ++++++++++++++++++ .../Licenses/Requests/CountLicensesRequest.cs | 35 ++ .../Licenses/Requests/ListLicensesRequest.cs | 35 ++ .../Licenses/Types/CountLicensesParams.cs | 49 ++ .../Licenses/Types/CountLicensesResponse.cs | 34 ++ .../Types/GetSingleLicenseResponse.cs | 34 ++ .../Licenses/Types/ListLicensesParams.cs | 49 ++ .../Licenses/Types/ListLicensesResponse.cs | 34 ++ .../Planmigrations/IPlanmigrationsClient.cs | 6 + .../Planmigrations/PlanmigrationsClient.cs | 175 ++++++ .../Requests/PreviewMigrationRequestBody.cs | 26 + .../Types/PreviewMigrationResponse.cs | 34 ++ src/SchematicHQ.Client/SchematicApi.cs | 5 +- .../SchematicHQ.Client.csproj | 2 +- .../BillingCreditGrantZeroedOutReason.cs | 6 + .../Types/CompanyBillingAddressView.cs | 43 ++ .../Types/CompanyBillingCheckoutSettings.cs | 34 ++ .../CompanyBillingDetailsResponseData.cs | 41 ++ .../Types/CompanyBillingDetailsView.cs | 41 ++ .../CreateEntitlementInBundleRequestBody.cs | 3 + .../Types/CreditsAutoTopupSuccess.cs | 37 ++ .../Types/CreditsCreditPurchaseSuccess.cs | 43 ++ .../Types/CreditsWebhookCompanySummary.cs | 31 + .../Types/CreditsWebhookCreditSummary.cs | 31 + .../Types/CustomerBillingAddress.cs | 43 ++ .../Types/FeatureDetailResponseData.cs | 18 + .../Types/FeatureInPlanResponseData.cs | 12 + .../Types/FeatureResponseData.cs | 12 + src/SchematicHQ.Client/Types/FeatureType.cs | 4 + src/SchematicHQ.Client/Types/FeatureView.cs | 6 + .../Types/LicenseResponseData.cs | 37 ++ ...sionMigrationPreviewCompanyResponseData.cs | 43 ++ ...PlanVersionMigrationPreviewResponseData.cs | 29 + .../Types/WebhookRequestType.cs | 10 + 50 files changed, 2363 insertions(+), 9 deletions(-) delete mode 100644 WASM_VERSION create mode 100644 src/SchematicHQ.Client/Checkout/Requests/UpdateCompanyBillingDetailsRequestBody.cs create mode 100644 src/SchematicHQ.Client/Checkout/Types/GetCompanyBillingDetailsResponse.cs create mode 100644 src/SchematicHQ.Client/Checkout/Types/UpdateCompanyBillingDetailsResponse.cs create mode 100644 src/SchematicHQ.Client/Licenses/ILicensesClient.cs create mode 100644 src/SchematicHQ.Client/Licenses/LicensesClient.cs create mode 100644 src/SchematicHQ.Client/Licenses/Requests/CountLicensesRequest.cs create mode 100644 src/SchematicHQ.Client/Licenses/Requests/ListLicensesRequest.cs create mode 100644 src/SchematicHQ.Client/Licenses/Types/CountLicensesParams.cs create mode 100644 src/SchematicHQ.Client/Licenses/Types/CountLicensesResponse.cs create mode 100644 src/SchematicHQ.Client/Licenses/Types/GetSingleLicenseResponse.cs create mode 100644 src/SchematicHQ.Client/Licenses/Types/ListLicensesParams.cs create mode 100644 src/SchematicHQ.Client/Licenses/Types/ListLicensesResponse.cs create mode 100644 src/SchematicHQ.Client/Planmigrations/Requests/PreviewMigrationRequestBody.cs create mode 100644 src/SchematicHQ.Client/Planmigrations/Types/PreviewMigrationResponse.cs create mode 100644 src/SchematicHQ.Client/Types/CompanyBillingAddressView.cs create mode 100644 src/SchematicHQ.Client/Types/CompanyBillingCheckoutSettings.cs create mode 100644 src/SchematicHQ.Client/Types/CompanyBillingDetailsResponseData.cs create mode 100644 src/SchematicHQ.Client/Types/CompanyBillingDetailsView.cs create mode 100644 src/SchematicHQ.Client/Types/CreditsAutoTopupSuccess.cs create mode 100644 src/SchematicHQ.Client/Types/CreditsCreditPurchaseSuccess.cs create mode 100644 src/SchematicHQ.Client/Types/CreditsWebhookCompanySummary.cs create mode 100644 src/SchematicHQ.Client/Types/CreditsWebhookCreditSummary.cs create mode 100644 src/SchematicHQ.Client/Types/CustomerBillingAddress.cs create mode 100644 src/SchematicHQ.Client/Types/LicenseResponseData.cs create mode 100644 src/SchematicHQ.Client/Types/PlanVersionMigrationPreviewCompanyResponseData.cs create mode 100644 src/SchematicHQ.Client/Types/PlanVersionMigrationPreviewResponseData.cs diff --git a/.fern/metadata.json b/.fern/metadata.json index 367f19f5..3d71f592 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -8,10 +8,10 @@ "exported-client-class-name": "Schematic", "generate-mock-server-tests": false }, - "originGitCommit": "86a4c45d14847babf70751d87de4da7764ecd894", + "originGitCommit": "340529eacf4f1dcc5522e771872c1dd94b9c4891", "originGitCommitIsDirty": false, "invokedBy": "ci", - "requestedVersion": "1.5.2", + "requestedVersion": "1.5.3", "ciProvider": "github", - "sdkVersion": "1.5.2" + "sdkVersion": "1.5.3" } \ No newline at end of file diff --git a/WASM_VERSION b/WASM_VERSION deleted file mode 100644 index 1d0ba9ea..00000000 --- a/WASM_VERSION +++ /dev/null @@ -1 +0,0 @@ -0.4.0 diff --git a/reference.md b/reference.md index 830c18e5..c3b71ff5 100644 --- a/reference.md +++ b/reference.md @@ -43,6 +43,7 @@ await client.Accounts.ListAccountMembersAsync( { Ids = new List() { "ids" }, Q = "q", + Role = AccountMemberRole.Admin, Limit = 1000000, Offset = 1000000, } @@ -131,6 +132,7 @@ await client.Accounts.CountAccountMembersAsync( { Ids = new List() { "ids" }, Q = "q", + Role = AccountMemberRole.Admin, Limit = 1000000, Offset = 1000000, } @@ -4260,6 +4262,103 @@ await client.Checkout.PreviewCheckoutInternalAsync( + + + + +
client.Checkout.GetCompanyBillingDetailsAsync(companyId) -> WithRawResponseTask<GetCompanyBillingDetailsResponse> +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Checkout.GetCompanyBillingDetailsAsync("company_id"); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**companyId:** `string` — company_id + +
+
+
+
+ + +
+
+
+ +
client.Checkout.UpdateCompanyBillingDetailsAsync(companyId, UpdateCompanyBillingDetailsRequestBody { ... }) -> WithRawResponseTask<UpdateCompanyBillingDetailsResponse> +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Checkout.UpdateCompanyBillingDetailsAsync( + "company_id", + new UpdateCompanyBillingDetailsRequestBody + { + Values = new List() + { + new CheckoutFieldValue { Id = "id", Value = "value" }, + }, + } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**companyId:** `string` — company_id + +
+
+ +
+
+ +**request:** `UpdateCompanyBillingDetailsRequestBody` + +
+
+
+
+ +
@@ -10600,6 +10699,145 @@ await client.Integrationsapi.UninstallIntegrationAsync("integration_id"); + + + + +## licenses +
client.Licenses.ListLicensesAsync(ListLicensesRequest { ... }) -> WithRawResponseTask<ListLicensesResponse> +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Licenses.ListLicensesAsync( + new ListLicensesRequest + { + FeatureIds = new List() { "feature_ids" }, + Ids = new List() { "ids" }, + Name = "name", + Limit = 1000000, + Offset = 1000000, + } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `ListLicensesRequest` + +
+
+
+
+ + +
+
+
+ +
client.Licenses.GetSingleLicenseAsync(licenseId) -> WithRawResponseTask<GetSingleLicenseResponse> +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Licenses.GetSingleLicenseAsync("license_id"); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**licenseId:** `string` — license_id + +
+
+
+
+ + +
+
+
+ +
client.Licenses.CountLicensesAsync(CountLicensesRequest { ... }) -> WithRawResponseTask<CountLicensesResponse> +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Licenses.CountLicensesAsync( + new CountLicensesRequest + { + FeatureIds = new List() { "feature_ids" }, + Ids = new List() { "ids" }, + Name = "name", + Limit = 1000000, + Offset = 1000000, + } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `CountLicensesRequest` + +
+
+
+
+ +
@@ -11177,6 +11415,54 @@ await client.Planmigrations.CountMigrationsAsync( + + + + +
client.Planmigrations.PreviewMigrationAsync(PreviewMigrationRequestBody { ... }) -> WithRawResponseTask<PreviewMigrationResponse> +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Planmigrations.PreviewMigrationAsync( + new PreviewMigrationRequestBody + { + CompanyIds = new List() { "company_ids" }, + PlanId = "plan_id", + PlanVersionIdTo = "plan_version_id_to", + TargetPlanType = PlanType.Plan, + } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `PreviewMigrationRequestBody` + +
+
+
+
+ +
diff --git a/src/SchematicHQ.Client/Accounts/AccountsClient.cs b/src/SchematicHQ.Client/Accounts/AccountsClient.cs index eb0b76fe..4fd64dd8 100644 --- a/src/SchematicHQ.Client/Accounts/AccountsClient.cs +++ b/src/SchematicHQ.Client/Accounts/AccountsClient.cs @@ -18,9 +18,10 @@ private async Task> ListAccountMembe CancellationToken cancellationToken = default ) { - var _queryString = new SchematicHQ.Client.Core.QueryStringBuilder.Builder(capacity: 4) + var _queryString = new SchematicHQ.Client.Core.QueryStringBuilder.Builder(capacity: 5) .Add("ids", request.Ids) .Add("q", request.Q) + .Add("role", request.Role) .Add("limit", request.Limit) .Add("offset", request.Offset) .MergeAdditional(options?.AdditionalQueryParameters) @@ -315,9 +316,10 @@ private async Task> CountAccountMem CancellationToken cancellationToken = default ) { - var _queryString = new SchematicHQ.Client.Core.QueryStringBuilder.Builder(capacity: 4) + var _queryString = new SchematicHQ.Client.Core.QueryStringBuilder.Builder(capacity: 5) .Add("ids", request.Ids) .Add("q", request.Q) + .Add("role", request.Role) .Add("limit", request.Limit) .Add("offset", request.Offset) .MergeAdditional(options?.AdditionalQueryParameters) @@ -2894,6 +2896,7 @@ private async Task> GetWhoAmIAsyncCore( /// { /// Ids = new List<string>() { "ids" }, /// Q = "q", + /// Role = AccountMemberRole.Admin, /// Limit = 1000000, /// Offset = 1000000, /// } @@ -2930,6 +2933,7 @@ public WithRawResponseTask GetAccountMemberAsync( /// { /// Ids = new List<string>() { "ids" }, /// Q = "q", + /// Role = AccountMemberRole.Admin, /// Limit = 1000000, /// Offset = 1000000, /// } diff --git a/src/SchematicHQ.Client/Accounts/Requests/CountAccountMembersRequest.cs b/src/SchematicHQ.Client/Accounts/Requests/CountAccountMembersRequest.cs index bb5eb1aa..50783c6d 100644 --- a/src/SchematicHQ.Client/Accounts/Requests/CountAccountMembersRequest.cs +++ b/src/SchematicHQ.Client/Accounts/Requests/CountAccountMembersRequest.cs @@ -15,6 +15,12 @@ public record CountAccountMembersRequest [JsonIgnore] public string? Q { get; set; } + /// + /// Filter by member role + /// + [JsonIgnore] + public AccountMemberRole? Role { get; set; } + /// /// Page limit (default 100) /// diff --git a/src/SchematicHQ.Client/Accounts/Requests/ListAccountMembersRequest.cs b/src/SchematicHQ.Client/Accounts/Requests/ListAccountMembersRequest.cs index a4a3d141..bc75d1de 100644 --- a/src/SchematicHQ.Client/Accounts/Requests/ListAccountMembersRequest.cs +++ b/src/SchematicHQ.Client/Accounts/Requests/ListAccountMembersRequest.cs @@ -15,6 +15,12 @@ public record ListAccountMembersRequest [JsonIgnore] public string? Q { get; set; } + /// + /// Filter by member role + /// + [JsonIgnore] + public AccountMemberRole? Role { get; set; } + /// /// Page limit (default 100) /// diff --git a/src/SchematicHQ.Client/Accounts/Types/CountAccountMembersParams.cs b/src/SchematicHQ.Client/Accounts/Types/CountAccountMembersParams.cs index 0f9bed8d..cc5b2e07 100644 --- a/src/SchematicHQ.Client/Accounts/Types/CountAccountMembersParams.cs +++ b/src/SchematicHQ.Client/Accounts/Types/CountAccountMembersParams.cs @@ -35,6 +35,12 @@ public record CountAccountMembersParams : IJsonOnDeserialized [JsonPropertyName("q")] public string? Q { get; set; } + /// + /// Filter by member role + /// + [JsonPropertyName("role")] + public AccountMemberRole? Role { get; set; } + [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/SchematicHQ.Client/Accounts/Types/ListAccountMembersParams.cs b/src/SchematicHQ.Client/Accounts/Types/ListAccountMembersParams.cs index eacfda07..4f7b5b1c 100644 --- a/src/SchematicHQ.Client/Accounts/Types/ListAccountMembersParams.cs +++ b/src/SchematicHQ.Client/Accounts/Types/ListAccountMembersParams.cs @@ -35,6 +35,12 @@ public record ListAccountMembersParams : IJsonOnDeserialized [JsonPropertyName("q")] public string? Q { get; set; } + /// + /// Filter by member role + /// + [JsonPropertyName("role")] + public AccountMemberRole? Role { get; set; } + [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/SchematicHQ.Client/Checkout/CheckoutClient.cs b/src/SchematicHQ.Client/Checkout/CheckoutClient.cs index 14ca5ff8..795f147b 100644 --- a/src/SchematicHQ.Client/Checkout/CheckoutClient.cs +++ b/src/SchematicHQ.Client/Checkout/CheckoutClient.cs @@ -475,6 +475,313 @@ private async Task< } } + private async Task< + WithRawResponse + > GetCompanyBillingDetailsAsyncCore( + string companyId, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _queryString = new SchematicHQ.Client.Core.QueryStringBuilder.Builder(capacity: 0) + .MergeAdditional(options?.AdditionalQueryParameters) + .Build(); + var _headers = await new SchematicHQ.Client.Core.HeadersBuilder.Builder() + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Get, + Path = string.Format( + "companies/{0}/billing-details", + ValueConvert.ToPathParameterString(companyId) + ), + QueryString = _queryString, + Headers = _headers, + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + var responseData = JsonUtils.Deserialize( + responseBody + )!; + return new WithRawResponse() + { + Data = responseData, + RawResponse = new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }, + }; + } + catch (JsonException e) + { + throw new SchematicApiException( + "Failed to deserialize response", + response.StatusCode, + responseBody, + e, + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 401: + throw new UnauthorizedError( + JsonUtils.Deserialize(responseBody), + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 403: + throw new ForbiddenError( + JsonUtils.Deserialize(responseBody), + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 404: + throw new NotFoundError( + JsonUtils.Deserialize(responseBody), + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 500: + throw new InternalServerError( + JsonUtils.Deserialize(responseBody), + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new SchematicApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody, + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + + private async Task< + WithRawResponse + > UpdateCompanyBillingDetailsAsyncCore( + string companyId, + UpdateCompanyBillingDetailsRequestBody request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _queryString = new SchematicHQ.Client.Core.QueryStringBuilder.Builder(capacity: 0) + .MergeAdditional(options?.AdditionalQueryParameters) + .Build(); + var _headers = await new SchematicHQ.Client.Core.HeadersBuilder.Builder() + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Put, + Path = string.Format( + "companies/{0}/billing-details", + ValueConvert.ToPathParameterString(companyId) + ), + Body = request, + QueryString = _queryString, + Headers = _headers, + ContentType = "application/json", + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + var responseData = JsonUtils.Deserialize( + responseBody + )!; + return new WithRawResponse() + { + Data = responseData, + RawResponse = new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }, + }; + } + catch (JsonException e) + { + throw new SchematicApiException( + "Failed to deserialize response", + response.StatusCode, + responseBody, + e, + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 400: + throw new BadRequestError( + JsonUtils.Deserialize(responseBody), + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 401: + throw new UnauthorizedError( + JsonUtils.Deserialize(responseBody), + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 403: + throw new ForbiddenError( + JsonUtils.Deserialize(responseBody), + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 404: + throw new NotFoundError( + JsonUtils.Deserialize(responseBody), + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 500: + throw new InternalServerError( + JsonUtils.Deserialize(responseBody), + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new SchematicApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody, + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + private async Task> ManagePlanAsyncCore( ManagePlanRequest request, RequestOptions? options = null, @@ -1196,6 +1503,44 @@ public WithRawResponseTask PreviewCheckoutInter ); } + /// + /// await client.Checkout.GetCompanyBillingDetailsAsync("company_id"); + /// + public WithRawResponseTask GetCompanyBillingDetailsAsync( + string companyId, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + GetCompanyBillingDetailsAsyncCore(companyId, options, cancellationToken) + ); + } + + /// + /// await client.Checkout.UpdateCompanyBillingDetailsAsync( + /// "company_id", + /// new UpdateCompanyBillingDetailsRequestBody + /// { + /// Values = new List<CheckoutFieldValue>() + /// { + /// new CheckoutFieldValue { Id = "id", Value = "value" }, + /// }, + /// } + /// ); + /// + public WithRawResponseTask UpdateCompanyBillingDetailsAsync( + string companyId, + UpdateCompanyBillingDetailsRequestBody request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + UpdateCompanyBillingDetailsAsyncCore(companyId, request, options, cancellationToken) + ); + } + /// /// await client.Checkout.ManagePlanAsync( /// new ManagePlanRequest diff --git a/src/SchematicHQ.Client/Checkout/ICheckoutClient.cs b/src/SchematicHQ.Client/Checkout/ICheckoutClient.cs index 796a5235..3ef2b2e1 100644 --- a/src/SchematicHQ.Client/Checkout/ICheckoutClient.cs +++ b/src/SchematicHQ.Client/Checkout/ICheckoutClient.cs @@ -20,6 +20,19 @@ WithRawResponseTask PreviewCheckoutInternalAsyn CancellationToken cancellationToken = default ); + WithRawResponseTask GetCompanyBillingDetailsAsync( + string companyId, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + + WithRawResponseTask UpdateCompanyBillingDetailsAsync( + string companyId, + UpdateCompanyBillingDetailsRequestBody request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + WithRawResponseTask ManagePlanAsync( ManagePlanRequest request, RequestOptions? options = null, diff --git a/src/SchematicHQ.Client/Checkout/Requests/UpdateCompanyBillingDetailsRequestBody.cs b/src/SchematicHQ.Client/Checkout/Requests/UpdateCompanyBillingDetailsRequestBody.cs new file mode 100644 index 00000000..ea8043e7 --- /dev/null +++ b/src/SchematicHQ.Client/Checkout/Requests/UpdateCompanyBillingDetailsRequestBody.cs @@ -0,0 +1,26 @@ +using global::System.Text.Json.Serialization; +using SchematicHQ.Client.Core; + +namespace SchematicHQ.Client; + +[Serializable] +public record UpdateCompanyBillingDetailsRequestBody +{ + [JsonPropertyName("address")] + public CustomerBillingAddress? Address { get; set; } + + [JsonPropertyName("email")] + public string? Email { get; set; } + + [JsonPropertyName("phone")] + public string? Phone { get; set; } + + [JsonPropertyName("values")] + public IEnumerable Values { get; set; } = new List(); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/SchematicHQ.Client/Checkout/Types/GetCompanyBillingDetailsResponse.cs b/src/SchematicHQ.Client/Checkout/Types/GetCompanyBillingDetailsResponse.cs new file mode 100644 index 00000000..d35815b9 --- /dev/null +++ b/src/SchematicHQ.Client/Checkout/Types/GetCompanyBillingDetailsResponse.cs @@ -0,0 +1,34 @@ +using global::System.Text.Json; +using global::System.Text.Json.Serialization; +using SchematicHQ.Client.Core; + +namespace SchematicHQ.Client; + +[Serializable] +public record GetCompanyBillingDetailsResponse : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("data")] + public required CompanyBillingDetailsResponseData Data { get; set; } + + /// + /// Input parameters + /// + [JsonPropertyName("params")] + public Dictionary Params { get; set; } = new Dictionary(); + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/SchematicHQ.Client/Checkout/Types/UpdateCompanyBillingDetailsResponse.cs b/src/SchematicHQ.Client/Checkout/Types/UpdateCompanyBillingDetailsResponse.cs new file mode 100644 index 00000000..c118a47c --- /dev/null +++ b/src/SchematicHQ.Client/Checkout/Types/UpdateCompanyBillingDetailsResponse.cs @@ -0,0 +1,34 @@ +using global::System.Text.Json; +using global::System.Text.Json.Serialization; +using SchematicHQ.Client.Core; + +namespace SchematicHQ.Client; + +[Serializable] +public record UpdateCompanyBillingDetailsResponse : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("data")] + public required CompanyBillingDetailsResponseData Data { get; set; } + + /// + /// Input parameters + /// + [JsonPropertyName("params")] + public Dictionary Params { get; set; } = new Dictionary(); + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/SchematicHQ.Client/Core/Public/Version.cs b/src/SchematicHQ.Client/Core/Public/Version.cs index 1fb2f5c9..d9bafe45 100644 --- a/src/SchematicHQ.Client/Core/Public/Version.cs +++ b/src/SchematicHQ.Client/Core/Public/Version.cs @@ -3,5 +3,5 @@ namespace SchematicHQ.Client; [Serializable] internal class Version { - public const string Current = "1.5.2"; + public const string Current = "1.5.3"; } diff --git a/src/SchematicHQ.Client/ISchematicApi.cs b/src/SchematicHQ.Client/ISchematicApi.cs index c7281e63..fa6660bd 100644 --- a/src/SchematicHQ.Client/ISchematicApi.cs +++ b/src/SchematicHQ.Client/ISchematicApi.cs @@ -17,6 +17,7 @@ public partial interface ISchematicApi public IFeaturesClient Features { get; } public IInsightsClient Insights { get; } public IIntegrationsapiClient Integrationsapi { get; } + public ILicensesClient Licenses { get; } public IPlangroupsClient Plangroups { get; } public IPlanmigrationsClient Planmigrations { get; } public IComponentspublicClient Componentspublic { get; } diff --git a/src/SchematicHQ.Client/Licenses/ILicensesClient.cs b/src/SchematicHQ.Client/Licenses/ILicensesClient.cs new file mode 100644 index 00000000..6935e6aa --- /dev/null +++ b/src/SchematicHQ.Client/Licenses/ILicensesClient.cs @@ -0,0 +1,22 @@ +namespace SchematicHQ.Client; + +public partial interface ILicensesClient +{ + WithRawResponseTask ListLicensesAsync( + ListLicensesRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + + WithRawResponseTask GetSingleLicenseAsync( + string licenseId, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + + WithRawResponseTask CountLicensesAsync( + CountLicensesRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); +} diff --git a/src/SchematicHQ.Client/Licenses/LicensesClient.cs b/src/SchematicHQ.Client/Licenses/LicensesClient.cs new file mode 100644 index 00000000..ceba9349 --- /dev/null +++ b/src/SchematicHQ.Client/Licenses/LicensesClient.cs @@ -0,0 +1,528 @@ +using global::System.Text.Json; +using SchematicHQ.Client.Core; + +namespace SchematicHQ.Client; + +public partial class LicensesClient : ILicensesClient +{ + private readonly RawClient _client; + + internal LicensesClient(RawClient client) + { + _client = client; + } + + private async Task> ListLicensesAsyncCore( + ListLicensesRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _queryString = new SchematicHQ.Client.Core.QueryStringBuilder.Builder(capacity: 5) + .Add("feature_ids", request.FeatureIds) + .Add("ids", request.Ids) + .Add("name", request.Name) + .Add("limit", request.Limit) + .Add("offset", request.Offset) + .MergeAdditional(options?.AdditionalQueryParameters) + .Build(); + var _headers = await new SchematicHQ.Client.Core.HeadersBuilder.Builder() + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Get, + Path = "licenses", + QueryString = _queryString, + Headers = _headers, + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + var responseData = JsonUtils.Deserialize(responseBody)!; + return new WithRawResponse() + { + Data = responseData, + RawResponse = new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }, + }; + } + catch (JsonException e) + { + throw new SchematicApiException( + "Failed to deserialize response", + response.StatusCode, + responseBody, + e, + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 400: + throw new BadRequestError( + JsonUtils.Deserialize(responseBody), + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 401: + throw new UnauthorizedError( + JsonUtils.Deserialize(responseBody), + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 403: + throw new ForbiddenError( + JsonUtils.Deserialize(responseBody), + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 404: + throw new NotFoundError( + JsonUtils.Deserialize(responseBody), + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 500: + throw new InternalServerError( + JsonUtils.Deserialize(responseBody), + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new SchematicApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody, + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + + private async Task> GetSingleLicenseAsyncCore( + string licenseId, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _queryString = new SchematicHQ.Client.Core.QueryStringBuilder.Builder(capacity: 0) + .MergeAdditional(options?.AdditionalQueryParameters) + .Build(); + var _headers = await new SchematicHQ.Client.Core.HeadersBuilder.Builder() + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Get, + Path = string.Format( + "licenses/{0}", + ValueConvert.ToPathParameterString(licenseId) + ), + QueryString = _queryString, + Headers = _headers, + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + var responseData = JsonUtils.Deserialize(responseBody)!; + return new WithRawResponse() + { + Data = responseData, + RawResponse = new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }, + }; + } + catch (JsonException e) + { + throw new SchematicApiException( + "Failed to deserialize response", + response.StatusCode, + responseBody, + e, + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 401: + throw new UnauthorizedError( + JsonUtils.Deserialize(responseBody), + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 403: + throw new ForbiddenError( + JsonUtils.Deserialize(responseBody), + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 404: + throw new NotFoundError( + JsonUtils.Deserialize(responseBody), + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 500: + throw new InternalServerError( + JsonUtils.Deserialize(responseBody), + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new SchematicApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody, + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + + private async Task> CountLicensesAsyncCore( + CountLicensesRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _queryString = new SchematicHQ.Client.Core.QueryStringBuilder.Builder(capacity: 5) + .Add("feature_ids", request.FeatureIds) + .Add("ids", request.Ids) + .Add("name", request.Name) + .Add("limit", request.Limit) + .Add("offset", request.Offset) + .MergeAdditional(options?.AdditionalQueryParameters) + .Build(); + var _headers = await new SchematicHQ.Client.Core.HeadersBuilder.Builder() + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Get, + Path = "licenses/count", + QueryString = _queryString, + Headers = _headers, + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + var responseData = JsonUtils.Deserialize(responseBody)!; + return new WithRawResponse() + { + Data = responseData, + RawResponse = new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }, + }; + } + catch (JsonException e) + { + throw new SchematicApiException( + "Failed to deserialize response", + response.StatusCode, + responseBody, + e, + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 400: + throw new BadRequestError( + JsonUtils.Deserialize(responseBody), + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 401: + throw new UnauthorizedError( + JsonUtils.Deserialize(responseBody), + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 403: + throw new ForbiddenError( + JsonUtils.Deserialize(responseBody), + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 404: + throw new NotFoundError( + JsonUtils.Deserialize(responseBody), + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 500: + throw new InternalServerError( + JsonUtils.Deserialize(responseBody), + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new SchematicApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody, + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + + /// + /// await client.Licenses.ListLicensesAsync( + /// new ListLicensesRequest + /// { + /// FeatureIds = new List<string>() { "feature_ids" }, + /// Ids = new List<string>() { "ids" }, + /// Name = "name", + /// Limit = 1000000, + /// Offset = 1000000, + /// } + /// ); + /// + public WithRawResponseTask ListLicensesAsync( + ListLicensesRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + ListLicensesAsyncCore(request, options, cancellationToken) + ); + } + + /// + /// await client.Licenses.GetSingleLicenseAsync("license_id"); + /// + public WithRawResponseTask GetSingleLicenseAsync( + string licenseId, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + GetSingleLicenseAsyncCore(licenseId, options, cancellationToken) + ); + } + + /// + /// await client.Licenses.CountLicensesAsync( + /// new CountLicensesRequest + /// { + /// FeatureIds = new List<string>() { "feature_ids" }, + /// Ids = new List<string>() { "ids" }, + /// Name = "name", + /// Limit = 1000000, + /// Offset = 1000000, + /// } + /// ); + /// + public WithRawResponseTask CountLicensesAsync( + CountLicensesRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + CountLicensesAsyncCore(request, options, cancellationToken) + ); + } +} diff --git a/src/SchematicHQ.Client/Licenses/Requests/CountLicensesRequest.cs b/src/SchematicHQ.Client/Licenses/Requests/CountLicensesRequest.cs new file mode 100644 index 00000000..bb4584f3 --- /dev/null +++ b/src/SchematicHQ.Client/Licenses/Requests/CountLicensesRequest.cs @@ -0,0 +1,35 @@ +using global::System.Text.Json.Serialization; +using SchematicHQ.Client.Core; + +namespace SchematicHQ.Client; + +[Serializable] +public record CountLicensesRequest +{ + [JsonIgnore] + public IEnumerable FeatureIds { get; set; } = new List(); + + [JsonIgnore] + public IEnumerable Ids { get; set; } = new List(); + + [JsonIgnore] + public string? Name { get; set; } + + /// + /// Page limit (default 100) + /// + [JsonIgnore] + public long? Limit { get; set; } + + /// + /// Page offset (default 0) + /// + [JsonIgnore] + public long? Offset { get; set; } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/SchematicHQ.Client/Licenses/Requests/ListLicensesRequest.cs b/src/SchematicHQ.Client/Licenses/Requests/ListLicensesRequest.cs new file mode 100644 index 00000000..1882919b --- /dev/null +++ b/src/SchematicHQ.Client/Licenses/Requests/ListLicensesRequest.cs @@ -0,0 +1,35 @@ +using global::System.Text.Json.Serialization; +using SchematicHQ.Client.Core; + +namespace SchematicHQ.Client; + +[Serializable] +public record ListLicensesRequest +{ + [JsonIgnore] + public IEnumerable FeatureIds { get; set; } = new List(); + + [JsonIgnore] + public IEnumerable Ids { get; set; } = new List(); + + [JsonIgnore] + public string? Name { get; set; } + + /// + /// Page limit (default 100) + /// + [JsonIgnore] + public long? Limit { get; set; } + + /// + /// Page offset (default 0) + /// + [JsonIgnore] + public long? Offset { get; set; } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/SchematicHQ.Client/Licenses/Types/CountLicensesParams.cs b/src/SchematicHQ.Client/Licenses/Types/CountLicensesParams.cs new file mode 100644 index 00000000..ca53a6ac --- /dev/null +++ b/src/SchematicHQ.Client/Licenses/Types/CountLicensesParams.cs @@ -0,0 +1,49 @@ +using global::System.Text.Json; +using global::System.Text.Json.Serialization; +using SchematicHQ.Client.Core; + +namespace SchematicHQ.Client; + +/// +/// Input parameters +/// +[Serializable] +public record CountLicensesParams : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("feature_ids")] + public IEnumerable? FeatureIds { get; set; } + + [JsonPropertyName("ids")] + public IEnumerable? Ids { get; set; } + + /// + /// Page limit (default 100) + /// + [JsonPropertyName("limit")] + public long? Limit { get; set; } + + [JsonPropertyName("name")] + public string? Name { get; set; } + + /// + /// Page offset (default 0) + /// + [JsonPropertyName("offset")] + public long? Offset { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/SchematicHQ.Client/Licenses/Types/CountLicensesResponse.cs b/src/SchematicHQ.Client/Licenses/Types/CountLicensesResponse.cs new file mode 100644 index 00000000..9705b82c --- /dev/null +++ b/src/SchematicHQ.Client/Licenses/Types/CountLicensesResponse.cs @@ -0,0 +1,34 @@ +using global::System.Text.Json; +using global::System.Text.Json.Serialization; +using SchematicHQ.Client.Core; + +namespace SchematicHQ.Client; + +[Serializable] +public record CountLicensesResponse : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("data")] + public required CountResponse Data { get; set; } + + /// + /// Input parameters + /// + [JsonPropertyName("params")] + public required CountLicensesParams Params { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/SchematicHQ.Client/Licenses/Types/GetSingleLicenseResponse.cs b/src/SchematicHQ.Client/Licenses/Types/GetSingleLicenseResponse.cs new file mode 100644 index 00000000..4f11d9e7 --- /dev/null +++ b/src/SchematicHQ.Client/Licenses/Types/GetSingleLicenseResponse.cs @@ -0,0 +1,34 @@ +using global::System.Text.Json; +using global::System.Text.Json.Serialization; +using SchematicHQ.Client.Core; + +namespace SchematicHQ.Client; + +[Serializable] +public record GetSingleLicenseResponse : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("data")] + public required LicenseResponseData Data { get; set; } + + /// + /// Input parameters + /// + [JsonPropertyName("params")] + public Dictionary Params { get; set; } = new Dictionary(); + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/SchematicHQ.Client/Licenses/Types/ListLicensesParams.cs b/src/SchematicHQ.Client/Licenses/Types/ListLicensesParams.cs new file mode 100644 index 00000000..44babfac --- /dev/null +++ b/src/SchematicHQ.Client/Licenses/Types/ListLicensesParams.cs @@ -0,0 +1,49 @@ +using global::System.Text.Json; +using global::System.Text.Json.Serialization; +using SchematicHQ.Client.Core; + +namespace SchematicHQ.Client; + +/// +/// Input parameters +/// +[Serializable] +public record ListLicensesParams : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("feature_ids")] + public IEnumerable? FeatureIds { get; set; } + + [JsonPropertyName("ids")] + public IEnumerable? Ids { get; set; } + + /// + /// Page limit (default 100) + /// + [JsonPropertyName("limit")] + public long? Limit { get; set; } + + [JsonPropertyName("name")] + public string? Name { get; set; } + + /// + /// Page offset (default 0) + /// + [JsonPropertyName("offset")] + public long? Offset { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/SchematicHQ.Client/Licenses/Types/ListLicensesResponse.cs b/src/SchematicHQ.Client/Licenses/Types/ListLicensesResponse.cs new file mode 100644 index 00000000..8fa038d8 --- /dev/null +++ b/src/SchematicHQ.Client/Licenses/Types/ListLicensesResponse.cs @@ -0,0 +1,34 @@ +using global::System.Text.Json; +using global::System.Text.Json.Serialization; +using SchematicHQ.Client.Core; + +namespace SchematicHQ.Client; + +[Serializable] +public record ListLicensesResponse : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("data")] + public IEnumerable Data { get; set; } = new List(); + + /// + /// Input parameters + /// + [JsonPropertyName("params")] + public required ListLicensesParams Params { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/SchematicHQ.Client/Planmigrations/IPlanmigrationsClient.cs b/src/SchematicHQ.Client/Planmigrations/IPlanmigrationsClient.cs index 497ab363..0e510033 100644 --- a/src/SchematicHQ.Client/Planmigrations/IPlanmigrationsClient.cs +++ b/src/SchematicHQ.Client/Planmigrations/IPlanmigrationsClient.cs @@ -50,4 +50,10 @@ WithRawResponseTask CountMigrationsAsync( RequestOptions? options = null, CancellationToken cancellationToken = default ); + + WithRawResponseTask PreviewMigrationAsync( + PreviewMigrationRequestBody request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); } diff --git a/src/SchematicHQ.Client/Planmigrations/PlanmigrationsClient.cs b/src/SchematicHQ.Client/Planmigrations/PlanmigrationsClient.cs index 3a95b6a8..1d48363c 100644 --- a/src/SchematicHQ.Client/Planmigrations/PlanmigrationsClient.cs +++ b/src/SchematicHQ.Client/Planmigrations/PlanmigrationsClient.cs @@ -1252,6 +1252,159 @@ private async Task> CountMigrationsAsyn } } + private async Task> PreviewMigrationAsyncCore( + PreviewMigrationRequestBody request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _queryString = new SchematicHQ.Client.Core.QueryStringBuilder.Builder(capacity: 0) + .MergeAdditional(options?.AdditionalQueryParameters) + .Build(); + var _headers = await new SchematicHQ.Client.Core.HeadersBuilder.Builder() + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Post, + Path = "plan-version-migrations/preview", + Body = request, + QueryString = _queryString, + Headers = _headers, + ContentType = "application/json", + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + var responseData = JsonUtils.Deserialize(responseBody)!; + return new WithRawResponse() + { + Data = responseData, + RawResponse = new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }, + }; + } + catch (JsonException e) + { + throw new SchematicApiException( + "Failed to deserialize response", + response.StatusCode, + responseBody, + e, + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 400: + throw new BadRequestError( + JsonUtils.Deserialize(responseBody), + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 401: + throw new UnauthorizedError( + JsonUtils.Deserialize(responseBody), + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 403: + throw new ForbiddenError( + JsonUtils.Deserialize(responseBody), + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 404: + throw new NotFoundError( + JsonUtils.Deserialize(responseBody), + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 500: + throw new InternalServerError( + JsonUtils.Deserialize(responseBody), + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new SchematicApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody, + rawResponse: new SchematicHQ.Client.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + /// /// await client.Planmigrations.ListCompanyMigrationsAsync( /// new ListCompanyMigrationsRequest @@ -1422,4 +1575,26 @@ public WithRawResponseTask CountMigrationsAsync( CountMigrationsAsyncCore(request, options, cancellationToken) ); } + + /// + /// await client.Planmigrations.PreviewMigrationAsync( + /// new PreviewMigrationRequestBody + /// { + /// CompanyIds = new List<string>() { "company_ids" }, + /// PlanId = "plan_id", + /// PlanVersionIdTo = "plan_version_id_to", + /// TargetPlanType = PlanType.Plan, + /// } + /// ); + /// + public WithRawResponseTask PreviewMigrationAsync( + PreviewMigrationRequestBody request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + PreviewMigrationAsyncCore(request, options, cancellationToken) + ); + } } diff --git a/src/SchematicHQ.Client/Planmigrations/Requests/PreviewMigrationRequestBody.cs b/src/SchematicHQ.Client/Planmigrations/Requests/PreviewMigrationRequestBody.cs new file mode 100644 index 00000000..96065e62 --- /dev/null +++ b/src/SchematicHQ.Client/Planmigrations/Requests/PreviewMigrationRequestBody.cs @@ -0,0 +1,26 @@ +using global::System.Text.Json.Serialization; +using SchematicHQ.Client.Core; + +namespace SchematicHQ.Client; + +[Serializable] +public record PreviewMigrationRequestBody +{ + [JsonPropertyName("company_ids")] + public IEnumerable CompanyIds { get; set; } = new List(); + + [JsonPropertyName("plan_id")] + public required string PlanId { get; set; } + + [JsonPropertyName("plan_version_id_to")] + public required string PlanVersionIdTo { get; set; } + + [JsonPropertyName("target_plan_type")] + public required PlanType TargetPlanType { get; set; } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/SchematicHQ.Client/Planmigrations/Types/PreviewMigrationResponse.cs b/src/SchematicHQ.Client/Planmigrations/Types/PreviewMigrationResponse.cs new file mode 100644 index 00000000..82b6c42d --- /dev/null +++ b/src/SchematicHQ.Client/Planmigrations/Types/PreviewMigrationResponse.cs @@ -0,0 +1,34 @@ +using global::System.Text.Json; +using global::System.Text.Json.Serialization; +using SchematicHQ.Client.Core; + +namespace SchematicHQ.Client; + +[Serializable] +public record PreviewMigrationResponse : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("data")] + public required PlanVersionMigrationPreviewResponseData Data { get; set; } + + /// + /// Input parameters + /// + [JsonPropertyName("params")] + public Dictionary Params { get; set; } = new Dictionary(); + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/SchematicHQ.Client/SchematicApi.cs b/src/SchematicHQ.Client/SchematicApi.cs index fa3073a2..91d972d7 100644 --- a/src/SchematicHQ.Client/SchematicApi.cs +++ b/src/SchematicHQ.Client/SchematicApi.cs @@ -15,7 +15,7 @@ public SchematicApi(string? apiKey = null, ClientOptions? clientOptions = null) { "X-Fern-Language", "C#" }, { "X-Fern-SDK-Name", "SchematicHQ.Client" }, { "X-Fern-SDK-Version", Version.Current }, - { "User-Agent", "SchematicHQ.Client/1.5.2" }, + { "User-Agent", "SchematicHQ.Client/1.5.3" }, } ); foreach (var header in platformHeaders) @@ -49,6 +49,7 @@ public SchematicApi(string? apiKey = null, ClientOptions? clientOptions = null) Features = new FeaturesClient(_client); Insights = new InsightsClient(_client); Integrationsapi = new IntegrationsapiClient(_client); + Licenses = new LicensesClient(_client); Plangroups = new PlangroupsClient(_client); Planmigrations = new PlanmigrationsClient(_client); Componentspublic = new ComponentspublicClient(_client); @@ -87,6 +88,8 @@ public SchematicApi(string? apiKey = null, ClientOptions? clientOptions = null) public IIntegrationsapiClient Integrationsapi { get; } + public ILicensesClient Licenses { get; } + public IPlangroupsClient Plangroups { get; } public IPlanmigrationsClient Planmigrations { get; } diff --git a/src/SchematicHQ.Client/SchematicHQ.Client.csproj b/src/SchematicHQ.Client/SchematicHQ.Client.csproj index e7d2f024..368ce5a0 100644 --- a/src/SchematicHQ.Client/SchematicHQ.Client.csproj +++ b/src/SchematicHQ.Client/SchematicHQ.Client.csproj @@ -4,7 +4,7 @@ enable 12 enable - 1.5.2 + 1.5.3 $(Version) $(Version) README.md diff --git a/src/SchematicHQ.Client/Types/BillingCreditGrantZeroedOutReason.cs b/src/SchematicHQ.Client/Types/BillingCreditGrantZeroedOutReason.cs index 922ee99a..5f47aa51 100644 --- a/src/SchematicHQ.Client/Types/BillingCreditGrantZeroedOutReason.cs +++ b/src/SchematicHQ.Client/Types/BillingCreditGrantZeroedOutReason.cs @@ -20,6 +20,10 @@ namespace SchematicHQ.Client; Values.IntegrationUninstalled ); + public static readonly BillingCreditGrantZeroedOutReason LicenseRetired = new( + Values.LicenseRetired + ); + public static readonly BillingCreditGrantZeroedOutReason Manual = new(Values.Manual); public static readonly BillingCreditGrantZeroedOutReason PlanChange = new(Values.PlanChange); @@ -133,6 +137,8 @@ public static class Values public const string IntegrationUninstalled = "integration_uninstalled"; + public const string LicenseRetired = "license_retired"; + public const string Manual = "manual"; public const string PlanChange = "plan_change"; diff --git a/src/SchematicHQ.Client/Types/CompanyBillingAddressView.cs b/src/SchematicHQ.Client/Types/CompanyBillingAddressView.cs new file mode 100644 index 00000000..324187cf --- /dev/null +++ b/src/SchematicHQ.Client/Types/CompanyBillingAddressView.cs @@ -0,0 +1,43 @@ +using global::System.Text.Json; +using global::System.Text.Json.Serialization; +using SchematicHQ.Client.Core; + +namespace SchematicHQ.Client; + +[Serializable] +public record CompanyBillingAddressView : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("city")] + public required string City { get; set; } + + [JsonPropertyName("country")] + public required string Country { get; set; } + + [JsonPropertyName("line1")] + public required string Line1 { get; set; } + + [JsonPropertyName("line2")] + public required string Line2 { get; set; } + + [JsonPropertyName("postal_code")] + public required string PostalCode { get; set; } + + [JsonPropertyName("state")] + public required string State { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/SchematicHQ.Client/Types/CompanyBillingCheckoutSettings.cs b/src/SchematicHQ.Client/Types/CompanyBillingCheckoutSettings.cs new file mode 100644 index 00000000..51dd0721 --- /dev/null +++ b/src/SchematicHQ.Client/Types/CompanyBillingCheckoutSettings.cs @@ -0,0 +1,34 @@ +using global::System.Text.Json; +using global::System.Text.Json.Serialization; +using SchematicHQ.Client.Core; + +namespace SchematicHQ.Client; + +[Serializable] +public record CompanyBillingCheckoutSettings : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("collect_address")] + public required bool CollectAddress { get; set; } + + [JsonPropertyName("collect_email")] + public required bool CollectEmail { get; set; } + + [JsonPropertyName("collect_phone")] + public required bool CollectPhone { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/SchematicHQ.Client/Types/CompanyBillingDetailsResponseData.cs b/src/SchematicHQ.Client/Types/CompanyBillingDetailsResponseData.cs new file mode 100644 index 00000000..a2dfbab8 --- /dev/null +++ b/src/SchematicHQ.Client/Types/CompanyBillingDetailsResponseData.cs @@ -0,0 +1,41 @@ +using global::System.Text.Json; +using global::System.Text.Json.Serialization; +using SchematicHQ.Client.Core; + +namespace SchematicHQ.Client; + +[Serializable] +public record CompanyBillingDetailsResponseData : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("address")] + public CompanyBillingAddressView? Address { get; set; } + + [JsonPropertyName("checkout_settings")] + public required CompanyBillingCheckoutSettings CheckoutSettings { get; set; } + + [JsonPropertyName("custom_fields")] + public IEnumerable CustomFields { get; set; } = + new List(); + + [JsonPropertyName("email")] + public string? Email { get; set; } + + [JsonPropertyName("phone")] + public string? Phone { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/SchematicHQ.Client/Types/CompanyBillingDetailsView.cs b/src/SchematicHQ.Client/Types/CompanyBillingDetailsView.cs new file mode 100644 index 00000000..d06cae2e --- /dev/null +++ b/src/SchematicHQ.Client/Types/CompanyBillingDetailsView.cs @@ -0,0 +1,41 @@ +using global::System.Text.Json; +using global::System.Text.Json.Serialization; +using SchematicHQ.Client.Core; + +namespace SchematicHQ.Client; + +[Serializable] +public record CompanyBillingDetailsView : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("address")] + public CompanyBillingAddressView? Address { get; set; } + + [JsonPropertyName("checkout_settings")] + public required CompanyBillingCheckoutSettings CheckoutSettings { get; set; } + + [JsonPropertyName("custom_fields")] + public IEnumerable CustomFields { get; set; } = + new List(); + + [JsonPropertyName("email")] + public string? Email { get; set; } + + [JsonPropertyName("phone")] + public string? Phone { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/SchematicHQ.Client/Types/CreateEntitlementInBundleRequestBody.cs b/src/SchematicHQ.Client/Types/CreateEntitlementInBundleRequestBody.cs index 4ef6cde0..bee3cf82 100644 --- a/src/SchematicHQ.Client/Types/CreateEntitlementInBundleRequestBody.cs +++ b/src/SchematicHQ.Client/Types/CreateEntitlementInBundleRequestBody.cs @@ -104,6 +104,9 @@ public record CreateEntitlementInBundleRequestBody : IJsonOnDeserialized [JsonPropertyName("value_type")] public required EntitlementValueType ValueType { get; set; } + [JsonPropertyName("warning_tiers")] + public IEnumerable? WarningTiers { get; set; } + [JsonPropertyName("yearly_metered_price_id")] public string? YearlyMeteredPriceId { get; set; } diff --git a/src/SchematicHQ.Client/Types/CreditsAutoTopupSuccess.cs b/src/SchematicHQ.Client/Types/CreditsAutoTopupSuccess.cs new file mode 100644 index 00000000..afdcc85d --- /dev/null +++ b/src/SchematicHQ.Client/Types/CreditsAutoTopupSuccess.cs @@ -0,0 +1,37 @@ +using global::System.Text.Json; +using global::System.Text.Json.Serialization; +using SchematicHQ.Client.Core; + +namespace SchematicHQ.Client; + +[Serializable] +public record CreditsAutoTopupSuccess : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("company")] + public CreditsAutoTopupCompanySummary? Company { get; set; } + + [JsonPropertyName("credit")] + public CreditsAutoTopupCreditSummary? Credit { get; set; } + + [JsonPropertyName("grant_id")] + public required string GrantId { get; set; } + + [JsonPropertyName("quantity")] + public required long Quantity { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/SchematicHQ.Client/Types/CreditsCreditPurchaseSuccess.cs b/src/SchematicHQ.Client/Types/CreditsCreditPurchaseSuccess.cs new file mode 100644 index 00000000..29eef90c --- /dev/null +++ b/src/SchematicHQ.Client/Types/CreditsCreditPurchaseSuccess.cs @@ -0,0 +1,43 @@ +using global::System.Text.Json; +using global::System.Text.Json.Serialization; +using SchematicHQ.Client.Core; + +namespace SchematicHQ.Client; + +[Serializable] +public record CreditsCreditPurchaseSuccess : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("bundle_id")] + public required string BundleId { get; set; } + + [JsonPropertyName("bundle_name")] + public required string BundleName { get; set; } + + [JsonPropertyName("company")] + public CreditsWebhookCompanySummary? Company { get; set; } + + [JsonPropertyName("credit")] + public CreditsWebhookCreditSummary? Credit { get; set; } + + [JsonPropertyName("grant_ids")] + public IEnumerable GrantIds { get; set; } = new List(); + + [JsonPropertyName("quantity")] + public required long Quantity { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/SchematicHQ.Client/Types/CreditsWebhookCompanySummary.cs b/src/SchematicHQ.Client/Types/CreditsWebhookCompanySummary.cs new file mode 100644 index 00000000..827995fd --- /dev/null +++ b/src/SchematicHQ.Client/Types/CreditsWebhookCompanySummary.cs @@ -0,0 +1,31 @@ +using global::System.Text.Json; +using global::System.Text.Json.Serialization; +using SchematicHQ.Client.Core; + +namespace SchematicHQ.Client; + +[Serializable] +public record CreditsWebhookCompanySummary : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("id")] + public required string Id { get; set; } + + [JsonPropertyName("name")] + public required string Name { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/SchematicHQ.Client/Types/CreditsWebhookCreditSummary.cs b/src/SchematicHQ.Client/Types/CreditsWebhookCreditSummary.cs new file mode 100644 index 00000000..2ebb9da8 --- /dev/null +++ b/src/SchematicHQ.Client/Types/CreditsWebhookCreditSummary.cs @@ -0,0 +1,31 @@ +using global::System.Text.Json; +using global::System.Text.Json.Serialization; +using SchematicHQ.Client.Core; + +namespace SchematicHQ.Client; + +[Serializable] +public record CreditsWebhookCreditSummary : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("id")] + public required string Id { get; set; } + + [JsonPropertyName("name")] + public required string Name { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/SchematicHQ.Client/Types/CustomerBillingAddress.cs b/src/SchematicHQ.Client/Types/CustomerBillingAddress.cs new file mode 100644 index 00000000..ab15cdb9 --- /dev/null +++ b/src/SchematicHQ.Client/Types/CustomerBillingAddress.cs @@ -0,0 +1,43 @@ +using global::System.Text.Json; +using global::System.Text.Json.Serialization; +using SchematicHQ.Client.Core; + +namespace SchematicHQ.Client; + +[Serializable] +public record CustomerBillingAddress : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("city")] + public required string City { get; set; } + + [JsonPropertyName("country")] + public required string Country { get; set; } + + [JsonPropertyName("line1")] + public required string Line1 { get; set; } + + [JsonPropertyName("line2")] + public required string Line2 { get; set; } + + [JsonPropertyName("postal_code")] + public required string PostalCode { get; set; } + + [JsonPropertyName("state")] + public required string State { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/SchematicHQ.Client/Types/FeatureDetailResponseData.cs b/src/SchematicHQ.Client/Types/FeatureDetailResponseData.cs index 9fb795b0..7b2cb310 100644 --- a/src/SchematicHQ.Client/Types/FeatureDetailResponseData.cs +++ b/src/SchematicHQ.Client/Types/FeatureDetailResponseData.cs @@ -14,6 +14,12 @@ public record FeatureDetailResponseData : IJsonOnDeserialized [JsonPropertyName("billing_linked_resource")] public BillingLinkedResourceResponseData? BillingLinkedResource { get; set; } + /// + /// The billing provider product that sells this feature in the current environment. Set for license features once they have been priced in a plan; a feature priced in several environments has a different product in each. + /// + [JsonPropertyName("billing_product")] + public BillingProductResponseData? BillingProduct { get; set; } + [JsonPropertyName("created_at")] public required DateTime CreatedAt { get; set; } @@ -39,6 +45,12 @@ public record FeatureDetailResponseData : IJsonOnDeserialized [JsonPropertyName("id")] public required string Id { get; set; } + /// + /// The license sold through this feature. Set only on features of type license, and created automatically with them. + /// + [JsonPropertyName("license_id")] + public string? LicenseId { get; set; } + [JsonPropertyName("lifecycle_phase")] public FeatureLifecyclePhase? LifecyclePhase { get; set; } @@ -69,6 +81,12 @@ public record FeatureDetailResponseData : IJsonOnDeserialized [JsonPropertyName("updated_at")] public required DateTime UpdatedAt { get; set; } + /// + /// Set when the feature carries a pay-in-advance quantity. Provisioned lazily for other feature types, and at creation for license features. + /// + [JsonPropertyName("usage_limit_trait_id")] + public string? UsageLimitTraitId { get; set; } + [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/SchematicHQ.Client/Types/FeatureInPlanResponseData.cs b/src/SchematicHQ.Client/Types/FeatureInPlanResponseData.cs index d8e06b09..7c2ae95f 100644 --- a/src/SchematicHQ.Client/Types/FeatureInPlanResponseData.cs +++ b/src/SchematicHQ.Client/Types/FeatureInPlanResponseData.cs @@ -39,6 +39,12 @@ public record FeatureInPlanResponseData : IJsonOnDeserialized [JsonPropertyName("id")] public required string Id { get; set; } + /// + /// The license sold through this feature. Set only on features of type license, and created automatically with them. + /// + [JsonPropertyName("license_id")] + public string? LicenseId { get; set; } + [JsonPropertyName("lifecycle_phase")] public FeatureLifecyclePhase? LifecyclePhase { get; set; } @@ -66,6 +72,12 @@ public record FeatureInPlanResponseData : IJsonOnDeserialized [JsonPropertyName("updated_at")] public required DateTime UpdatedAt { get; set; } + /// + /// Set when the feature carries a pay-in-advance quantity. Provisioned lazily for other feature types, and at creation for license features. + /// + [JsonPropertyName("usage_limit_trait_id")] + public string? UsageLimitTraitId { get; set; } + [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/SchematicHQ.Client/Types/FeatureResponseData.cs b/src/SchematicHQ.Client/Types/FeatureResponseData.cs index 36f971c6..83c69a23 100644 --- a/src/SchematicHQ.Client/Types/FeatureResponseData.cs +++ b/src/SchematicHQ.Client/Types/FeatureResponseData.cs @@ -29,6 +29,12 @@ public record FeatureResponseData : IJsonOnDeserialized [JsonPropertyName("id")] public required string Id { get; set; } + /// + /// The license sold through this feature. Set only on features of type license, and created automatically with them. + /// + [JsonPropertyName("license_id")] + public string? LicenseId { get; set; } + [JsonPropertyName("lifecycle_phase")] public FeatureLifecyclePhase? LifecyclePhase { get; set; } @@ -50,6 +56,12 @@ public record FeatureResponseData : IJsonOnDeserialized [JsonPropertyName("updated_at")] public required DateTime UpdatedAt { get; set; } + /// + /// Set when the feature carries a pay-in-advance quantity. Provisioned lazily for other feature types, and at creation for license features. + /// + [JsonPropertyName("usage_limit_trait_id")] + public string? UsageLimitTraitId { get; set; } + [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/SchematicHQ.Client/Types/FeatureType.cs b/src/SchematicHQ.Client/Types/FeatureType.cs index b1dace4e..8a922b70 100644 --- a/src/SchematicHQ.Client/Types/FeatureType.cs +++ b/src/SchematicHQ.Client/Types/FeatureType.cs @@ -12,6 +12,8 @@ namespace SchematicHQ.Client; public static readonly FeatureType Event = new(Values.Event); + public static readonly FeatureType License = new(Values.License); + public static readonly FeatureType Trait = new(Values.Trait); public FeatureType(string value) @@ -114,6 +116,8 @@ public static class Values public const string Event = "event"; + public const string License = "license"; + public const string Trait = "trait"; } } diff --git a/src/SchematicHQ.Client/Types/FeatureView.cs b/src/SchematicHQ.Client/Types/FeatureView.cs index 750c5532..0e551fa7 100644 --- a/src/SchematicHQ.Client/Types/FeatureView.cs +++ b/src/SchematicHQ.Client/Types/FeatureView.cs @@ -17,6 +17,9 @@ public record FeatureView : IJsonOnDeserialized [JsonPropertyName("billing_linked_resource")] public BillingLinkedResourceResponseData? BillingLinkedResource { get; set; } + [JsonPropertyName("billing_product")] + public BillingProductResponseData? BillingProduct { get; set; } + [JsonPropertyName("created_at")] public required DateTime CreatedAt { get; set; } @@ -41,6 +44,9 @@ public record FeatureView : IJsonOnDeserialized [JsonPropertyName("id")] public required string Id { get; set; } + [JsonPropertyName("license_id")] + public string? LicenseId { get; set; } + [JsonPropertyName("lifecycle_phase")] public FeatureLifecyclePhase? LifecyclePhase { get; set; } diff --git a/src/SchematicHQ.Client/Types/LicenseResponseData.cs b/src/SchematicHQ.Client/Types/LicenseResponseData.cs new file mode 100644 index 00000000..e40ad19c --- /dev/null +++ b/src/SchematicHQ.Client/Types/LicenseResponseData.cs @@ -0,0 +1,37 @@ +using global::System.Text.Json; +using global::System.Text.Json.Serialization; +using SchematicHQ.Client.Core; + +namespace SchematicHQ.Client; + +[Serializable] +public record LicenseResponseData : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("created_at")] + public required DateTime CreatedAt { get; set; } + + [JsonPropertyName("id")] + public required string Id { get; set; } + + [JsonPropertyName("name")] + public required string Name { get; set; } + + [JsonPropertyName("updated_at")] + public required DateTime UpdatedAt { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/SchematicHQ.Client/Types/PlanVersionMigrationPreviewCompanyResponseData.cs b/src/SchematicHQ.Client/Types/PlanVersionMigrationPreviewCompanyResponseData.cs new file mode 100644 index 00000000..4a57f832 --- /dev/null +++ b/src/SchematicHQ.Client/Types/PlanVersionMigrationPreviewCompanyResponseData.cs @@ -0,0 +1,43 @@ +using global::System.Text.Json; +using global::System.Text.Json.Serialization; +using SchematicHQ.Client.Core; + +namespace SchematicHQ.Client; + +[Serializable] +public record PlanVersionMigrationPreviewCompanyResponseData : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("company_id")] + public required string CompanyId { get; set; } + + [JsonPropertyName("has_billing_changes")] + public required bool HasBillingChanges { get; set; } + + [JsonPropertyName("has_custom_pricing")] + public required bool HasCustomPricing { get; set; } + + [JsonPropertyName("note")] + public string? Note { get; set; } + + [JsonPropertyName("plan_version_id_from")] + public string? PlanVersionIdFrom { get; set; } + + [JsonPropertyName("will_update_subscription")] + public required bool WillUpdateSubscription { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/SchematicHQ.Client/Types/PlanVersionMigrationPreviewResponseData.cs b/src/SchematicHQ.Client/Types/PlanVersionMigrationPreviewResponseData.cs new file mode 100644 index 00000000..1b87731e --- /dev/null +++ b/src/SchematicHQ.Client/Types/PlanVersionMigrationPreviewResponseData.cs @@ -0,0 +1,29 @@ +using global::System.Text.Json; +using global::System.Text.Json.Serialization; +using SchematicHQ.Client.Core; + +namespace SchematicHQ.Client; + +[Serializable] +public record PlanVersionMigrationPreviewResponseData : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("companies")] + public IEnumerable Companies { get; set; } = + new List(); + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/SchematicHQ.Client/Types/WebhookRequestType.cs b/src/SchematicHQ.Client/Types/WebhookRequestType.cs index c1732209..ef73c4cf 100644 --- a/src/SchematicHQ.Client/Types/WebhookRequestType.cs +++ b/src/SchematicHQ.Client/Types/WebhookRequestType.cs @@ -44,6 +44,10 @@ namespace SchematicHQ.Client; public static readonly WebhookRequestType CreditLimitWarning = new(Values.CreditLimitWarning); + public static readonly WebhookRequestType CreditPurchaseSuccess = new( + Values.CreditPurchaseSuccess + ); + public static readonly WebhookRequestType EntitlementLimitReached = new( Values.EntitlementLimitReached ); @@ -120,6 +124,8 @@ namespace SchematicHQ.Client; Values.AutoTopupRetryExceeded ); + public static readonly WebhookRequestType AutoTopupSuccess = new(Values.AutoTopupSuccess); + public WebhookRequestType(string value) { Value = value; @@ -240,6 +246,8 @@ public static class Values public const string CreditLimitWarning = "credit.limit.warning"; + public const string CreditPurchaseSuccess = "credit.purchase.success"; + public const string EntitlementLimitReached = "entitlement.limit.reached"; public const string EntitlementLimitWarning = "entitlement.limit.warning"; @@ -293,5 +301,7 @@ public static class Values public const string AutoTopupHardFailure = "auto.topup.hard.failure"; public const string AutoTopupRetryExceeded = "auto.topup.retry.exceeded"; + + public const string AutoTopupSuccess = "auto.topup.success"; } } From 889531b89cee933402099458514ca5475734d7d4 Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Mon, 27 Jul 2026 17:49:48 +0000 Subject: [PATCH 2/2] [fern-replay] Applied customizations Patches applied (1): - patch-0816e16a: chore: update rules engine WASM to v0.4.0 (#158) --- .fern/replay.lock | 10 ++++++++-- WASM_VERSION | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 WASM_VERSION diff --git a/.fern/replay.lock b/.fern/replay.lock index 881deda6..d9b05157 100644 --- a/.fern/replay.lock +++ b/.fern/replay.lock @@ -36,14 +36,20 @@ generations: cli_version: unknown generator_versions: fernapi/fern-csharp-sdk: 2.71.1 -current_generation: b0fb07315fcf768f4b1170209dbe0c5f48ecccbf + - commit_sha: 0f7988ceb60220a53564b46185930df675384f54 + tree_hash: 62074d1ea40d12766174195b8fba01742e53be5b + timestamp: 2026-07-27T17:49:45.795Z + cli_version: unknown + generator_versions: + fernapi/fern-csharp-sdk: 2.71.1 +current_generation: 0f7988ceb60220a53564b46185930df675384f54 patches: - id: patch-0816e16a content_hash: sha256:17a9a52d7557e941a9879ef072a5b51bb135098a4021df914f5c6a344964a947 original_commit: 0816e16ac6deea213675e5288d1b96ade208183b original_message: "chore: update rules engine WASM to v0.4.0 (#158)" original_author: Schematic Bot - base_generation: b0fb07315fcf768f4b1170209dbe0c5f48ecccbf + base_generation: 0f7988ceb60220a53564b46185930df675384f54 files: - WASM_VERSION patch_content: | diff --git a/WASM_VERSION b/WASM_VERSION new file mode 100644 index 00000000..1d0ba9ea --- /dev/null +++ b/WASM_VERSION @@ -0,0 +1 @@ +0.4.0