From cfa4a36c6d7ceef523e69d8f29814671041cc65d Mon Sep 17 00:00:00 2001
From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com>
Date: Mon, 20 Jul 2026 18:59:35 +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 | 763 +++++-
.../Catalogs/CatalogsClient.cs | 2241 +++++++++++++++++
.../Catalogs/ICatalogsClient.cs | 94 +
.../Requests/CreateCatalogRequestBody.cs | 23 +
.../Catalogs/Requests/ListCatalogsRequest.cs | 35 +
.../UpdateCatalogConfigurationRequestBody.cs | 41 +
.../Requests/UpdateCatalogRequestBody.cs | 23 +
.../Catalogs/Types/CreateCatalogResponse.cs | 34 +
.../Catalogs/Types/DeleteCatalogResponse.cs | 34 +
.../Catalogs/Types/GetCatalogResponse.cs | 34 +
.../Types/GetConfigurationResponse.cs | 34 +
.../GetCreditBundlesInCatalogResponse.cs | 34 +
.../Types/GetDerivedFeaturesResponse.cs | 34 +
.../Types/GetPlansInCatalogResponse.cs | 34 +
.../Catalogs/Types/ListCatalogsParams.cs | 49 +
.../Catalogs/Types/ListCatalogsResponse.cs | 34 +
.../Catalogs/Types/UpdateCatalogResponse.cs | 34 +
.../Types/UpdateConfigurationResponse.cs | 34 +
.../Components/ComponentsClient.cs | 172 ++
.../Components/IComponentsClient.cs | 7 +
.../Requests/BindCatalogRequestBody.cs | 17 +
.../Components/Types/BindCatalogResponse.cs | 34 +
src/SchematicHQ.Client/Core/Public/Version.cs | 2 +-
.../Dataexports/DataexportsClient.cs | 338 ++-
.../Dataexports/IDataexportsClient.cs | 12 +
.../Requests/CreateDataExportRequestBody.cs | 6 +-
.../Requests/ListDataExportsRequest.cs | 32 +
.../Types/GetDataExportResponse.cs | 34 +
.../Types/ListDataExportsParams.cs | 46 +
.../Types/ListDataExportsResponse.cs | 35 +
src/SchematicHQ.Client/ISchematicApi.cs | 1 +
.../CreateCustomPlanBundleRequestBody.cs | 3 +
src/SchematicHQ.Client/SchematicApi.cs | 5 +-
.../SchematicHQ.Client.csproj | 2 +-
.../Types/AuditLogExportMetadata.cs | 55 +
.../Types/CatalogConfigOrderedBundle.cs | 28 +
.../CatalogConfigOrderedBundleResponseData.cs | 28 +
.../Types/CatalogConfigOrderedEntitlement.cs | 31 +
...logConfigOrderedEntitlementResponseData.cs | 31 +
.../Types/CatalogConfigOrderedPlan.cs | 31 +
.../CatalogConfigOrderedPlanResponseData.cs | 32 +
.../Types/CatalogConfigurationResponseData.cs | 63 +
.../CatalogCreditBundleIDsResponseData.cs | 28 +
.../CatalogDerivedFeatureResponseData.cs | 34 +
.../CatalogDerivedFeaturesResponseData.cs | 29 +
.../Types/CatalogPlanIDsResponseData.cs | 28 +
.../Types/CatalogResponseData.cs | 67 +
.../CompanyFeatureUsageExportMetadata.cs | 127 +
.../Types/CompanyPlanDetailResponseData.cs | 3 +
.../Types/ComponentResponseData.cs | 3 +
.../Types/DataExportMetadata.cs | 293 +++
.../Types/DataExportOutputFileType.cs | 115 +
.../Types/DataExportResponseData.cs | 6 +-
.../Types/DataExportType.cs | 115 +
.../Types/FeatureEntitlement.cs | 6 +
.../PlanCatalogMembershipResponseData.cs | 31 +
.../Types/PlanDetailResponseData.cs | 3 +
.../Types/PlanGroupPlanDetailResponseData.cs | 3 +
.../Types/PlanViewPublicResponseData.cs | 3 +
...PreviewSubscriptionDiscountResponseData.cs | 58 +
.../PreviewSubscriptionFinanceResponseData.cs | 7 +
.../Types/RulesengineFeatureEntitlement.cs | 6 +
.../Types/RulesengineWarningTier.cs | 37 +
.../Types/UpsertCompanyRequestBody.cs | 12 +
src/SchematicHQ.Client/Types/WarningTier.cs | 37 +
67 files changed, 5693 insertions(+), 19 deletions(-)
delete mode 100644 WASM_VERSION
create mode 100644 src/SchematicHQ.Client/Catalogs/CatalogsClient.cs
create mode 100644 src/SchematicHQ.Client/Catalogs/ICatalogsClient.cs
create mode 100644 src/SchematicHQ.Client/Catalogs/Requests/CreateCatalogRequestBody.cs
create mode 100644 src/SchematicHQ.Client/Catalogs/Requests/ListCatalogsRequest.cs
create mode 100644 src/SchematicHQ.Client/Catalogs/Requests/UpdateCatalogConfigurationRequestBody.cs
create mode 100644 src/SchematicHQ.Client/Catalogs/Requests/UpdateCatalogRequestBody.cs
create mode 100644 src/SchematicHQ.Client/Catalogs/Types/CreateCatalogResponse.cs
create mode 100644 src/SchematicHQ.Client/Catalogs/Types/DeleteCatalogResponse.cs
create mode 100644 src/SchematicHQ.Client/Catalogs/Types/GetCatalogResponse.cs
create mode 100644 src/SchematicHQ.Client/Catalogs/Types/GetConfigurationResponse.cs
create mode 100644 src/SchematicHQ.Client/Catalogs/Types/GetCreditBundlesInCatalogResponse.cs
create mode 100644 src/SchematicHQ.Client/Catalogs/Types/GetDerivedFeaturesResponse.cs
create mode 100644 src/SchematicHQ.Client/Catalogs/Types/GetPlansInCatalogResponse.cs
create mode 100644 src/SchematicHQ.Client/Catalogs/Types/ListCatalogsParams.cs
create mode 100644 src/SchematicHQ.Client/Catalogs/Types/ListCatalogsResponse.cs
create mode 100644 src/SchematicHQ.Client/Catalogs/Types/UpdateCatalogResponse.cs
create mode 100644 src/SchematicHQ.Client/Catalogs/Types/UpdateConfigurationResponse.cs
create mode 100644 src/SchematicHQ.Client/Components/Requests/BindCatalogRequestBody.cs
create mode 100644 src/SchematicHQ.Client/Components/Types/BindCatalogResponse.cs
create mode 100644 src/SchematicHQ.Client/Dataexports/Requests/ListDataExportsRequest.cs
create mode 100644 src/SchematicHQ.Client/Dataexports/Types/GetDataExportResponse.cs
create mode 100644 src/SchematicHQ.Client/Dataexports/Types/ListDataExportsParams.cs
create mode 100644 src/SchematicHQ.Client/Dataexports/Types/ListDataExportsResponse.cs
create mode 100644 src/SchematicHQ.Client/Types/AuditLogExportMetadata.cs
create mode 100644 src/SchematicHQ.Client/Types/CatalogConfigOrderedBundle.cs
create mode 100644 src/SchematicHQ.Client/Types/CatalogConfigOrderedBundleResponseData.cs
create mode 100644 src/SchematicHQ.Client/Types/CatalogConfigOrderedEntitlement.cs
create mode 100644 src/SchematicHQ.Client/Types/CatalogConfigOrderedEntitlementResponseData.cs
create mode 100644 src/SchematicHQ.Client/Types/CatalogConfigOrderedPlan.cs
create mode 100644 src/SchematicHQ.Client/Types/CatalogConfigOrderedPlanResponseData.cs
create mode 100644 src/SchematicHQ.Client/Types/CatalogConfigurationResponseData.cs
create mode 100644 src/SchematicHQ.Client/Types/CatalogCreditBundleIDsResponseData.cs
create mode 100644 src/SchematicHQ.Client/Types/CatalogDerivedFeatureResponseData.cs
create mode 100644 src/SchematicHQ.Client/Types/CatalogDerivedFeaturesResponseData.cs
create mode 100644 src/SchematicHQ.Client/Types/CatalogPlanIDsResponseData.cs
create mode 100644 src/SchematicHQ.Client/Types/CatalogResponseData.cs
create mode 100644 src/SchematicHQ.Client/Types/CompanyFeatureUsageExportMetadata.cs
create mode 100644 src/SchematicHQ.Client/Types/DataExportMetadata.cs
create mode 100644 src/SchematicHQ.Client/Types/DataExportOutputFileType.cs
create mode 100644 src/SchematicHQ.Client/Types/DataExportType.cs
create mode 100644 src/SchematicHQ.Client/Types/PlanCatalogMembershipResponseData.cs
create mode 100644 src/SchematicHQ.Client/Types/PreviewSubscriptionDiscountResponseData.cs
create mode 100644 src/SchematicHQ.Client/Types/RulesengineWarningTier.cs
create mode 100644 src/SchematicHQ.Client/Types/WarningTier.cs
diff --git a/.fern/metadata.json b/.fern/metadata.json
index fd816940..367f19f5 100644
--- a/.fern/metadata.json
+++ b/.fern/metadata.json
@@ -8,10 +8,10 @@
"exported-client-class-name": "Schematic",
"generate-mock-server-tests": false
},
- "originGitCommit": "19cafdf92ab056ef6ba803bf1e352b0422a8ec45",
+ "originGitCommit": "86a4c45d14847babf70751d87de4da7764ecd894",
"originGitCommitIsDirty": false,
"invokedBy": "ci",
- "requestedVersion": "1.5.1",
+ "requestedVersion": "1.5.2",
"ciProvider": "github",
- "sdkVersion": "1.5.1"
+ "sdkVersion": "1.5.2"
}
\ 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 1aac3f10..830c18e5 100644
--- a/reference.md
+++ b/reference.md
@@ -3459,6 +3459,628 @@ await client.Credits.CountCreditEventLedgerAsync(
+
+
+
+
+## catalogs
+client.Catalogs.ListCatalogsAsync(ListCatalogsRequest { ... }) -> WithRawResponseTask<ListCatalogsResponse>
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```csharp
+await client.Catalogs.ListCatalogsAsync(
+ new ListCatalogsRequest
+ {
+ IsDefault = true,
+ Q = "q",
+ Limit = 1000000,
+ Offset = 1000000,
+ }
+);
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `ListCatalogsRequest`
+
+
+
+
+
+
+
+
+
+
+
+client.Catalogs.CreateCatalogAsync(CreateCatalogRequestBody { ... }) -> WithRawResponseTask<CreateCatalogResponse>
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```csharp
+await client.Catalogs.CreateCatalogAsync(
+ new CreateCatalogRequestBody { IsDefault = true, Name = "name" }
+);
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `CreateCatalogRequestBody`
+
+
+
+
+
+
+
+
+
+
+
+client.Catalogs.GetCatalogAsync(catalogId) -> WithRawResponseTask<GetCatalogResponse>
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```csharp
+await client.Catalogs.GetCatalogAsync("catalog_id");
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**catalogId:** `string` — catalog_id
+
+
+
+
+
+
+
+
+
+
+
+client.Catalogs.UpdateCatalogAsync(catalogId, UpdateCatalogRequestBody { ... }) -> WithRawResponseTask<UpdateCatalogResponse>
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```csharp
+await client.Catalogs.UpdateCatalogAsync("catalog_id", new UpdateCatalogRequestBody());
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**catalogId:** `string` — catalog_id
+
+
+
+
+
+-
+
+**request:** `UpdateCatalogRequestBody`
+
+
+
+
+
+
+
+
+
+
+
+client.Catalogs.DeleteCatalogAsync(catalogId) -> WithRawResponseTask<DeleteCatalogResponse>
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```csharp
+await client.Catalogs.DeleteCatalogAsync("catalog_id");
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**catalogId:** `string` — catalog_id
+
+
+
+
+
+
+
+
+
+
+
+client.Catalogs.GetConfigurationAsync(catalogId) -> WithRawResponseTask<GetConfigurationResponse>
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```csharp
+await client.Catalogs.GetConfigurationAsync("catalog_id");
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**catalogId:** `string` — catalog_id
+
+
+
+
+
+
+
+
+
+
+
+client.Catalogs.UpdateConfigurationAsync(catalogId, UpdateCatalogConfigurationRequestBody { ... }) -> WithRawResponseTask<UpdateConfigurationResponse>
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```csharp
+await client.Catalogs.UpdateConfigurationAsync(
+ "catalog_id",
+ new UpdateCatalogConfigurationRequestBody()
+);
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**catalogId:** `string` — catalog_id
+
+
+
+
+
+-
+
+**request:** `UpdateCatalogConfigurationRequestBody`
+
+
+
+
+
+
+
+
+
+
+
+client.Catalogs.GetCreditBundlesInCatalogAsync(catalogId) -> WithRawResponseTask<GetCreditBundlesInCatalogResponse>
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```csharp
+await client.Catalogs.GetCreditBundlesInCatalogAsync("catalog_id");
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**catalogId:** `string` — catalog_id
+
+
+
+
+
+
+
+
+
+
+
+client.Catalogs.AddCreditBundleAsync(catalogId, creditBundleId) -> WithRawResponseTask
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```csharp
+await client.Catalogs.AddCreditBundleAsync("catalog_id", "credit_bundle_id");
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**catalogId:** `string` — catalog_id
+
+
+
+
+
+-
+
+**creditBundleId:** `string` — credit_bundle_id
+
+
+
+
+
+
+
+
+
+
+
+client.Catalogs.RemoveCreditBundleAsync(catalogId, creditBundleId) -> WithRawResponseTask
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```csharp
+await client.Catalogs.RemoveCreditBundleAsync("catalog_id", "credit_bundle_id");
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**catalogId:** `string` — catalog_id
+
+
+
+
+
+-
+
+**creditBundleId:** `string` — credit_bundle_id
+
+
+
+
+
+
+
+
+
+
+
+client.Catalogs.GetDerivedFeaturesAsync(catalogId) -> WithRawResponseTask<GetDerivedFeaturesResponse>
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```csharp
+await client.Catalogs.GetDerivedFeaturesAsync("catalog_id");
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**catalogId:** `string` — catalog_id
+
+
+
+
+
+
+
+
+
+
+
+client.Catalogs.GetPlansInCatalogAsync(catalogId) -> WithRawResponseTask<GetPlansInCatalogResponse>
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```csharp
+await client.Catalogs.GetPlansInCatalogAsync("catalog_id");
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**catalogId:** `string` — catalog_id
+
+
+
+
+
+
+
+
+
+
+
+client.Catalogs.AddPlanAsync(catalogId, planId) -> WithRawResponseTask
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```csharp
+await client.Catalogs.AddPlanAsync("catalog_id", "plan_id");
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**catalogId:** `string` — catalog_id
+
+
+
+
+
+-
+
+**planId:** `string` — plan_id
+
+
+
+
+
+
+
+
+
+
+
+client.Catalogs.RemovePlanAsync(catalogId, planId) -> WithRawResponseTask
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```csharp
+await client.Catalogs.RemovePlanAsync("catalog_id", "plan_id");
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**catalogId:** `string` — catalog_id
+
+
+
+
+
+-
+
+**planId:** `string` — plan_id
+
+
+
+
+
+
+
@@ -7805,6 +8427,54 @@ await client.Components.DeleteComponentAsync("component_id");
+
+
+
+
+client.Components.BindCatalogAsync(componentId, BindCatalogRequestBody { ... }) -> WithRawResponseTask<BindCatalogResponse>
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```csharp
+await client.Components.BindCatalogAsync("component_id", new BindCatalogRequestBody());
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**componentId:** `string` — component_id
+
+
+
+
+
+-
+
+**request:** `BindCatalogRequestBody`
+
+
+
+
+
+
+
@@ -8053,6 +8723,54 @@ await client.Planbundle.UpdatePlanBundleAsync(
## dataexports
+client.Dataexports.ListDataExportsAsync(ListDataExportsRequest { ... }) -> WithRawResponseTask<ListDataExportsResponse>
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```csharp
+await client.Dataexports.ListDataExportsAsync(
+ new ListDataExportsRequest
+ {
+ ExportType = DataExportType.AuditLog,
+ Status = DataExportStatus.Failure,
+ Limit = 1000000,
+ Offset = 1000000,
+ }
+);
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `ListDataExportsRequest`
+
+
+
+
+
+
+
+
+
+
+
client.Dataexports.CreateDataExportAsync(CreateDataExportRequestBody { ... }) -> WithRawResponseTask<CreateDataExportResponse>
-
@@ -8069,9 +8787,8 @@ await client.Planbundle.UpdatePlanBundleAsync(
await client.Dataexports.CreateDataExportAsync(
new CreateDataExportRequestBody
{
- ExportType = "company-feature-usage",
- Metadata = "metadata",
- OutputFileType = "csv",
+ ExportType = DataExportType.AuditLog,
+ OutputFileType = DataExportOutputFileType.Csv,
}
);
```
@@ -8096,6 +8813,46 @@ await client.Dataexports.CreateDataExportAsync(
+
+
+
+
+client.Dataexports.GetDataExportAsync(dataExportId) -> WithRawResponseTask<GetDataExportResponse>
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```csharp
+await client.Dataexports.GetDataExportAsync("data_export_id");
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**dataExportId:** `string` — data_export_id
+
+
+
+
+
+
+
diff --git a/src/SchematicHQ.Client/Catalogs/CatalogsClient.cs b/src/SchematicHQ.Client/Catalogs/CatalogsClient.cs
new file mode 100644
index 00000000..1f0c35f4
--- /dev/null
+++ b/src/SchematicHQ.Client/Catalogs/CatalogsClient.cs
@@ -0,0 +1,2241 @@
+using global::System.Text.Json;
+using SchematicHQ.Client.Core;
+
+namespace SchematicHQ.Client;
+
+public partial class CatalogsClient : ICatalogsClient
+{
+ private readonly RawClient _client;
+
+ internal CatalogsClient(RawClient client)
+ {
+ _client = client;
+ }
+
+ private async Task> ListCatalogsAsyncCore(
+ ListCatalogsRequest request,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ )
+ {
+ var _queryString = new SchematicHQ.Client.Core.QueryStringBuilder.Builder(capacity: 4)
+ .Add("is_default", request.IsDefault)
+ .Add("q", request.Q)
+ .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 = "catalogs",
+ 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> CreateCatalogAsyncCore(
+ CreateCatalogRequestBody 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 = "catalogs",
+ 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> GetCatalogAsyncCore(
+ string catalogId,
+ 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(
+ "catalogs/{0}",
+ ValueConvert.ToPathParameterString(catalogId)
+ ),
+ 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> UpdateCatalogAsyncCore(
+ string catalogId,
+ UpdateCatalogRequestBody 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(
+ "catalogs/{0}",
+ ValueConvert.ToPathParameterString(catalogId)
+ ),
+ 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> DeleteCatalogAsyncCore(
+ string catalogId,
+ 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.Delete,
+ Path = string.Format(
+ "catalogs/{0}",
+ ValueConvert.ToPathParameterString(catalogId)
+ ),
+ 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> GetConfigurationAsyncCore(
+ string catalogId,
+ 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(
+ "catalogs/{0}/configuration",
+ ValueConvert.ToPathParameterString(catalogId)
+ ),
+ 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> UpdateConfigurationAsyncCore(
+ string catalogId,
+ UpdateCatalogConfigurationRequestBody 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(
+ "catalogs/{0}/configuration",
+ ValueConvert.ToPathParameterString(catalogId)
+ ),
+ 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<
+ WithRawResponse
+ > GetCreditBundlesInCatalogAsyncCore(
+ string catalogId,
+ 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(
+ "catalogs/{0}/credit-bundles",
+ ValueConvert.ToPathParameterString(catalogId)
+ ),
+ 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 AddCreditBundleAsyncCore(
+ string catalogId,
+ string creditBundleId,
+ 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 = string.Format(
+ "catalogs/{0}/credit-bundles/{1}",
+ ValueConvert.ToPathParameterString(catalogId),
+ ValueConvert.ToPathParameterString(creditBundleId)
+ ),
+ QueryString = _queryString,
+ Headers = _headers,
+ Options = options,
+ },
+ cancellationToken
+ )
+ .ConfigureAwait(false);
+ if (response.StatusCode is >= 200 and < 400)
+ {
+ return 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 RemoveCreditBundleAsyncCore(
+ string catalogId,
+ string creditBundleId,
+ 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.Delete,
+ Path = string.Format(
+ "catalogs/{0}/credit-bundles/{1}",
+ ValueConvert.ToPathParameterString(catalogId),
+ ValueConvert.ToPathParameterString(creditBundleId)
+ ),
+ QueryString = _queryString,
+ Headers = _headers,
+ Options = options,
+ },
+ cancellationToken
+ )
+ .ConfigureAwait(false);
+ if (response.StatusCode is >= 200 and < 400)
+ {
+ return 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> GetDerivedFeaturesAsyncCore(
+ string catalogId,
+ 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(
+ "catalogs/{0}/features",
+ ValueConvert.ToPathParameterString(catalogId)
+ ),
+ 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> GetPlansInCatalogAsyncCore(
+ string catalogId,
+ 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(
+ "catalogs/{0}/plans",
+ ValueConvert.ToPathParameterString(catalogId)
+ ),
+ 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 AddPlanAsyncCore(
+ string catalogId,
+ string planId,
+ 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 = string.Format(
+ "catalogs/{0}/plans/{1}",
+ ValueConvert.ToPathParameterString(catalogId),
+ ValueConvert.ToPathParameterString(planId)
+ ),
+ QueryString = _queryString,
+ Headers = _headers,
+ Options = options,
+ },
+ cancellationToken
+ )
+ .ConfigureAwait(false);
+ if (response.StatusCode is >= 200 and < 400)
+ {
+ return 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 RemovePlanAsyncCore(
+ string catalogId,
+ string planId,
+ 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.Delete,
+ Path = string.Format(
+ "catalogs/{0}/plans/{1}",
+ ValueConvert.ToPathParameterString(catalogId),
+ ValueConvert.ToPathParameterString(planId)
+ ),
+ QueryString = _queryString,
+ Headers = _headers,
+ Options = options,
+ },
+ cancellationToken
+ )
+ .ConfigureAwait(false);
+ if (response.StatusCode is >= 200 and < 400)
+ {
+ return 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.Catalogs.ListCatalogsAsync(
+ /// new ListCatalogsRequest
+ /// {
+ /// IsDefault = true,
+ /// Q = "q",
+ /// Limit = 1000000,
+ /// Offset = 1000000,
+ /// }
+ /// );
+ ///
+ public WithRawResponseTask ListCatalogsAsync(
+ ListCatalogsRequest request,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ )
+ {
+ return new WithRawResponseTask(
+ ListCatalogsAsyncCore(request, options, cancellationToken)
+ );
+ }
+
+ ///
+ /// await client.Catalogs.CreateCatalogAsync(
+ /// new CreateCatalogRequestBody { IsDefault = true, Name = "name" }
+ /// );
+ ///
+ public WithRawResponseTask CreateCatalogAsync(
+ CreateCatalogRequestBody request,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ )
+ {
+ return new WithRawResponseTask(
+ CreateCatalogAsyncCore(request, options, cancellationToken)
+ );
+ }
+
+ ///
+ /// await client.Catalogs.GetCatalogAsync("catalog_id");
+ ///
+ public WithRawResponseTask GetCatalogAsync(
+ string catalogId,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ )
+ {
+ return new WithRawResponseTask(
+ GetCatalogAsyncCore(catalogId, options, cancellationToken)
+ );
+ }
+
+ ///
+ /// await client.Catalogs.UpdateCatalogAsync("catalog_id", new UpdateCatalogRequestBody());
+ ///
+ public WithRawResponseTask UpdateCatalogAsync(
+ string catalogId,
+ UpdateCatalogRequestBody request,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ )
+ {
+ return new WithRawResponseTask(
+ UpdateCatalogAsyncCore(catalogId, request, options, cancellationToken)
+ );
+ }
+
+ ///
+ /// await client.Catalogs.DeleteCatalogAsync("catalog_id");
+ ///
+ public WithRawResponseTask DeleteCatalogAsync(
+ string catalogId,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ )
+ {
+ return new WithRawResponseTask(
+ DeleteCatalogAsyncCore(catalogId, options, cancellationToken)
+ );
+ }
+
+ ///
+ /// await client.Catalogs.GetConfigurationAsync("catalog_id");
+ ///
+ public WithRawResponseTask GetConfigurationAsync(
+ string catalogId,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ )
+ {
+ return new WithRawResponseTask(
+ GetConfigurationAsyncCore(catalogId, options, cancellationToken)
+ );
+ }
+
+ ///
+ /// await client.Catalogs.UpdateConfigurationAsync(
+ /// "catalog_id",
+ /// new UpdateCatalogConfigurationRequestBody()
+ /// );
+ ///
+ public WithRawResponseTask UpdateConfigurationAsync(
+ string catalogId,
+ UpdateCatalogConfigurationRequestBody request,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ )
+ {
+ return new WithRawResponseTask(
+ UpdateConfigurationAsyncCore(catalogId, request, options, cancellationToken)
+ );
+ }
+
+ ///
+ /// await client.Catalogs.GetCreditBundlesInCatalogAsync("catalog_id");
+ ///
+ public WithRawResponseTask GetCreditBundlesInCatalogAsync(
+ string catalogId,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ )
+ {
+ return new WithRawResponseTask(
+ GetCreditBundlesInCatalogAsyncCore(catalogId, options, cancellationToken)
+ );
+ }
+
+ ///
+ /// await client.Catalogs.AddCreditBundleAsync("catalog_id", "credit_bundle_id");
+ ///
+ public WithRawResponseTask AddCreditBundleAsync(
+ string catalogId,
+ string creditBundleId,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ )
+ {
+ return new WithRawResponseTask(
+ AddCreditBundleAsyncCore(catalogId, creditBundleId, options, cancellationToken)
+ );
+ }
+
+ ///
+ /// await client.Catalogs.RemoveCreditBundleAsync("catalog_id", "credit_bundle_id");
+ ///
+ public WithRawResponseTask RemoveCreditBundleAsync(
+ string catalogId,
+ string creditBundleId,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ )
+ {
+ return new WithRawResponseTask(
+ RemoveCreditBundleAsyncCore(catalogId, creditBundleId, options, cancellationToken)
+ );
+ }
+
+ ///
+ /// await client.Catalogs.GetDerivedFeaturesAsync("catalog_id");
+ ///
+ public WithRawResponseTask GetDerivedFeaturesAsync(
+ string catalogId,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ )
+ {
+ return new WithRawResponseTask(
+ GetDerivedFeaturesAsyncCore(catalogId, options, cancellationToken)
+ );
+ }
+
+ ///
+ /// await client.Catalogs.GetPlansInCatalogAsync("catalog_id");
+ ///
+ public WithRawResponseTask GetPlansInCatalogAsync(
+ string catalogId,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ )
+ {
+ return new WithRawResponseTask(
+ GetPlansInCatalogAsyncCore(catalogId, options, cancellationToken)
+ );
+ }
+
+ ///
+ /// await client.Catalogs.AddPlanAsync("catalog_id", "plan_id");
+ ///
+ public WithRawResponseTask AddPlanAsync(
+ string catalogId,
+ string planId,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ )
+ {
+ return new WithRawResponseTask(
+ AddPlanAsyncCore(catalogId, planId, options, cancellationToken)
+ );
+ }
+
+ ///
+ /// await client.Catalogs.RemovePlanAsync("catalog_id", "plan_id");
+ ///
+ public WithRawResponseTask RemovePlanAsync(
+ string catalogId,
+ string planId,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ )
+ {
+ return new WithRawResponseTask(
+ RemovePlanAsyncCore(catalogId, planId, options, cancellationToken)
+ );
+ }
+}
diff --git a/src/SchematicHQ.Client/Catalogs/ICatalogsClient.cs b/src/SchematicHQ.Client/Catalogs/ICatalogsClient.cs
new file mode 100644
index 00000000..8f156553
--- /dev/null
+++ b/src/SchematicHQ.Client/Catalogs/ICatalogsClient.cs
@@ -0,0 +1,94 @@
+namespace SchematicHQ.Client;
+
+public partial interface ICatalogsClient
+{
+ WithRawResponseTask ListCatalogsAsync(
+ ListCatalogsRequest request,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ );
+
+ WithRawResponseTask CreateCatalogAsync(
+ CreateCatalogRequestBody request,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ );
+
+ WithRawResponseTask GetCatalogAsync(
+ string catalogId,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ );
+
+ WithRawResponseTask UpdateCatalogAsync(
+ string catalogId,
+ UpdateCatalogRequestBody request,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ );
+
+ WithRawResponseTask DeleteCatalogAsync(
+ string catalogId,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ );
+
+ WithRawResponseTask GetConfigurationAsync(
+ string catalogId,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ );
+
+ WithRawResponseTask UpdateConfigurationAsync(
+ string catalogId,
+ UpdateCatalogConfigurationRequestBody request,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ );
+
+ WithRawResponseTask GetCreditBundlesInCatalogAsync(
+ string catalogId,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ );
+
+ WithRawResponseTask AddCreditBundleAsync(
+ string catalogId,
+ string creditBundleId,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ );
+
+ WithRawResponseTask RemoveCreditBundleAsync(
+ string catalogId,
+ string creditBundleId,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ );
+
+ WithRawResponseTask GetDerivedFeaturesAsync(
+ string catalogId,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ );
+
+ WithRawResponseTask GetPlansInCatalogAsync(
+ string catalogId,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ );
+
+ WithRawResponseTask AddPlanAsync(
+ string catalogId,
+ string planId,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ );
+
+ WithRawResponseTask RemovePlanAsync(
+ string catalogId,
+ string planId,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ );
+}
diff --git a/src/SchematicHQ.Client/Catalogs/Requests/CreateCatalogRequestBody.cs b/src/SchematicHQ.Client/Catalogs/Requests/CreateCatalogRequestBody.cs
new file mode 100644
index 00000000..0a2e3a7c
--- /dev/null
+++ b/src/SchematicHQ.Client/Catalogs/Requests/CreateCatalogRequestBody.cs
@@ -0,0 +1,23 @@
+using global::System.Text.Json.Serialization;
+using SchematicHQ.Client.Core;
+
+namespace SchematicHQ.Client;
+
+[Serializable]
+public record CreateCatalogRequestBody
+{
+ [JsonPropertyName("description")]
+ public string? Description { get; set; }
+
+ [JsonPropertyName("is_default")]
+ public required bool IsDefault { get; set; }
+
+ [JsonPropertyName("name")]
+ public required string Name { get; set; }
+
+ ///
+ public override string ToString()
+ {
+ return JsonUtils.Serialize(this);
+ }
+}
diff --git a/src/SchematicHQ.Client/Catalogs/Requests/ListCatalogsRequest.cs b/src/SchematicHQ.Client/Catalogs/Requests/ListCatalogsRequest.cs
new file mode 100644
index 00000000..e69f37ea
--- /dev/null
+++ b/src/SchematicHQ.Client/Catalogs/Requests/ListCatalogsRequest.cs
@@ -0,0 +1,35 @@
+using global::System.Text.Json.Serialization;
+using SchematicHQ.Client.Core;
+
+namespace SchematicHQ.Client;
+
+[Serializable]
+public record ListCatalogsRequest
+{
+ [JsonIgnore]
+ public bool? IsDefault { get; set; }
+
+ ///
+ /// Search by catalog name
+ ///
+ [JsonIgnore]
+ public string? Q { 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/Catalogs/Requests/UpdateCatalogConfigurationRequestBody.cs b/src/SchematicHQ.Client/Catalogs/Requests/UpdateCatalogConfigurationRequestBody.cs
new file mode 100644
index 00000000..d64ff0a4
--- /dev/null
+++ b/src/SchematicHQ.Client/Catalogs/Requests/UpdateCatalogConfigurationRequestBody.cs
@@ -0,0 +1,41 @@
+using global::System.Text.Json.Serialization;
+using SchematicHQ.Client.Core;
+
+namespace SchematicHQ.Client;
+
+[Serializable]
+public record UpdateCatalogConfigurationRequestBody
+{
+ [JsonPropertyName("custom_plan_cta_text")]
+ public string? CustomPlanCtaText { get; set; }
+
+ [JsonPropertyName("custom_plan_cta_url")]
+ public string? CustomPlanCtaUrl { get; set; }
+
+ [JsonPropertyName("custom_plan_price_text")]
+ public string? CustomPlanPriceText { get; set; }
+
+ [JsonPropertyName("custom_plans_visible")]
+ public bool? CustomPlansVisible { get; set; }
+
+ [JsonPropertyName("ordered_add_ons")]
+ public IEnumerable? OrderedAddOns { get; set; }
+
+ [JsonPropertyName("ordered_bundles")]
+ public IEnumerable? OrderedBundles { get; set; }
+
+ [JsonPropertyName("ordered_plans")]
+ public IEnumerable? OrderedPlans { get; set; }
+
+ [JsonPropertyName("pricing_model")]
+ public string? PricingModel { get; set; }
+
+ [JsonPropertyName("pricing_url")]
+ public string? PricingUrl { get; set; }
+
+ ///
+ public override string ToString()
+ {
+ return JsonUtils.Serialize(this);
+ }
+}
diff --git a/src/SchematicHQ.Client/Catalogs/Requests/UpdateCatalogRequestBody.cs b/src/SchematicHQ.Client/Catalogs/Requests/UpdateCatalogRequestBody.cs
new file mode 100644
index 00000000..6be33c40
--- /dev/null
+++ b/src/SchematicHQ.Client/Catalogs/Requests/UpdateCatalogRequestBody.cs
@@ -0,0 +1,23 @@
+using global::System.Text.Json.Serialization;
+using SchematicHQ.Client.Core;
+
+namespace SchematicHQ.Client;
+
+[Serializable]
+public record UpdateCatalogRequestBody
+{
+ [JsonPropertyName("description")]
+ public string? Description { get; set; }
+
+ [JsonPropertyName("is_default")]
+ public bool? IsDefault { get; set; }
+
+ [JsonPropertyName("name")]
+ public string? Name { get; set; }
+
+ ///
+ public override string ToString()
+ {
+ return JsonUtils.Serialize(this);
+ }
+}
diff --git a/src/SchematicHQ.Client/Catalogs/Types/CreateCatalogResponse.cs b/src/SchematicHQ.Client/Catalogs/Types/CreateCatalogResponse.cs
new file mode 100644
index 00000000..cb1a9a66
--- /dev/null
+++ b/src/SchematicHQ.Client/Catalogs/Types/CreateCatalogResponse.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 CreateCatalogResponse : IJsonOnDeserialized
+{
+ [JsonExtensionData]
+ private readonly IDictionary _extensionData =
+ new Dictionary();
+
+ [JsonPropertyName("data")]
+ public required CatalogResponseData 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/Catalogs/Types/DeleteCatalogResponse.cs b/src/SchematicHQ.Client/Catalogs/Types/DeleteCatalogResponse.cs
new file mode 100644
index 00000000..2acf9100
--- /dev/null
+++ b/src/SchematicHQ.Client/Catalogs/Types/DeleteCatalogResponse.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 DeleteCatalogResponse : IJsonOnDeserialized
+{
+ [JsonExtensionData]
+ private readonly IDictionary _extensionData =
+ new Dictionary();
+
+ [JsonPropertyName("data")]
+ public required DeleteResponse 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/Catalogs/Types/GetCatalogResponse.cs b/src/SchematicHQ.Client/Catalogs/Types/GetCatalogResponse.cs
new file mode 100644
index 00000000..12a074c4
--- /dev/null
+++ b/src/SchematicHQ.Client/Catalogs/Types/GetCatalogResponse.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 GetCatalogResponse : IJsonOnDeserialized
+{
+ [JsonExtensionData]
+ private readonly IDictionary _extensionData =
+ new Dictionary();
+
+ [JsonPropertyName("data")]
+ public required CatalogResponseData 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/Catalogs/Types/GetConfigurationResponse.cs b/src/SchematicHQ.Client/Catalogs/Types/GetConfigurationResponse.cs
new file mode 100644
index 00000000..c1c1558d
--- /dev/null
+++ b/src/SchematicHQ.Client/Catalogs/Types/GetConfigurationResponse.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 GetConfigurationResponse : IJsonOnDeserialized
+{
+ [JsonExtensionData]
+ private readonly IDictionary _extensionData =
+ new Dictionary();
+
+ [JsonPropertyName("data")]
+ public required CatalogConfigurationResponseData 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/Catalogs/Types/GetCreditBundlesInCatalogResponse.cs b/src/SchematicHQ.Client/Catalogs/Types/GetCreditBundlesInCatalogResponse.cs
new file mode 100644
index 00000000..006043a8
--- /dev/null
+++ b/src/SchematicHQ.Client/Catalogs/Types/GetCreditBundlesInCatalogResponse.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 GetCreditBundlesInCatalogResponse : IJsonOnDeserialized
+{
+ [JsonExtensionData]
+ private readonly IDictionary _extensionData =
+ new Dictionary();
+
+ [JsonPropertyName("data")]
+ public required CatalogCreditBundleIDsResponseData 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/Catalogs/Types/GetDerivedFeaturesResponse.cs b/src/SchematicHQ.Client/Catalogs/Types/GetDerivedFeaturesResponse.cs
new file mode 100644
index 00000000..fa04b083
--- /dev/null
+++ b/src/SchematicHQ.Client/Catalogs/Types/GetDerivedFeaturesResponse.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 GetDerivedFeaturesResponse : IJsonOnDeserialized
+{
+ [JsonExtensionData]
+ private readonly IDictionary _extensionData =
+ new Dictionary();
+
+ [JsonPropertyName("data")]
+ public required CatalogDerivedFeaturesResponseData 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/Catalogs/Types/GetPlansInCatalogResponse.cs b/src/SchematicHQ.Client/Catalogs/Types/GetPlansInCatalogResponse.cs
new file mode 100644
index 00000000..025a7d22
--- /dev/null
+++ b/src/SchematicHQ.Client/Catalogs/Types/GetPlansInCatalogResponse.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 GetPlansInCatalogResponse : IJsonOnDeserialized
+{
+ [JsonExtensionData]
+ private readonly IDictionary _extensionData =
+ new Dictionary();
+
+ [JsonPropertyName("data")]
+ public required CatalogPlanIDsResponseData 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/Catalogs/Types/ListCatalogsParams.cs b/src/SchematicHQ.Client/Catalogs/Types/ListCatalogsParams.cs
new file mode 100644
index 00000000..9d373558
--- /dev/null
+++ b/src/SchematicHQ.Client/Catalogs/Types/ListCatalogsParams.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 ListCatalogsParams : IJsonOnDeserialized
+{
+ [JsonExtensionData]
+ private readonly IDictionary _extensionData =
+ new Dictionary();
+
+ [JsonPropertyName("is_default")]
+ public bool? IsDefault { get; set; }
+
+ ///
+ /// Page limit (default 100)
+ ///
+ [JsonPropertyName("limit")]
+ public long? Limit { get; set; }
+
+ ///
+ /// Page offset (default 0)
+ ///
+ [JsonPropertyName("offset")]
+ public long? Offset { get; set; }
+
+ ///
+ /// Search by catalog name
+ ///
+ [JsonPropertyName("q")]
+ public string? Q { 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/Catalogs/Types/ListCatalogsResponse.cs b/src/SchematicHQ.Client/Catalogs/Types/ListCatalogsResponse.cs
new file mode 100644
index 00000000..9f8eed04
--- /dev/null
+++ b/src/SchematicHQ.Client/Catalogs/Types/ListCatalogsResponse.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 ListCatalogsResponse : IJsonOnDeserialized
+{
+ [JsonExtensionData]
+ private readonly IDictionary _extensionData =
+ new Dictionary();
+
+ [JsonPropertyName("data")]
+ public IEnumerable Data { get; set; } = new List();
+
+ ///
+ /// Input parameters
+ ///
+ [JsonPropertyName("params")]
+ public required ListCatalogsParams 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/Catalogs/Types/UpdateCatalogResponse.cs b/src/SchematicHQ.Client/Catalogs/Types/UpdateCatalogResponse.cs
new file mode 100644
index 00000000..d6cd2caa
--- /dev/null
+++ b/src/SchematicHQ.Client/Catalogs/Types/UpdateCatalogResponse.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 UpdateCatalogResponse : IJsonOnDeserialized
+{
+ [JsonExtensionData]
+ private readonly IDictionary _extensionData =
+ new Dictionary();
+
+ [JsonPropertyName("data")]
+ public required CatalogResponseData 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/Catalogs/Types/UpdateConfigurationResponse.cs b/src/SchematicHQ.Client/Catalogs/Types/UpdateConfigurationResponse.cs
new file mode 100644
index 00000000..fdf76176
--- /dev/null
+++ b/src/SchematicHQ.Client/Catalogs/Types/UpdateConfigurationResponse.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 UpdateConfigurationResponse : IJsonOnDeserialized
+{
+ [JsonExtensionData]
+ private readonly IDictionary _extensionData =
+ new Dictionary();
+
+ [JsonPropertyName("data")]
+ public required CatalogResponseData 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/Components/ComponentsClient.cs b/src/SchematicHQ.Client/Components/ComponentsClient.cs
index 4b1403f6..73dea762 100644
--- a/src/SchematicHQ.Client/Components/ComponentsClient.cs
+++ b/src/SchematicHQ.Client/Components/ComponentsClient.cs
@@ -772,6 +772,163 @@ private async Task> DeleteComponentAsyn
}
}
+ private async Task> BindCatalogAsyncCore(
+ string componentId,
+ BindCatalogRequestBody 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(
+ "components/{0}/catalog",
+ ValueConvert.ToPathParameterString(componentId)
+ ),
+ 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> CountComponentsAsyncCore(
CountComponentsRequest request,
RequestOptions? options = null,
@@ -1149,6 +1306,21 @@ public WithRawResponseTask DeleteComponentAsync(
);
}
+ ///
+ /// await client.Components.BindCatalogAsync("component_id", new BindCatalogRequestBody());
+ ///
+ public WithRawResponseTask BindCatalogAsync(
+ string componentId,
+ BindCatalogRequestBody request,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ )
+ {
+ return new WithRawResponseTask(
+ BindCatalogAsyncCore(componentId, request, options, cancellationToken)
+ );
+ }
+
///
/// await client.Components.CountComponentsAsync(
/// new CountComponentsRequest
diff --git a/src/SchematicHQ.Client/Components/IComponentsClient.cs b/src/SchematicHQ.Client/Components/IComponentsClient.cs
index ad1bded0..fff2f6db 100644
--- a/src/SchematicHQ.Client/Components/IComponentsClient.cs
+++ b/src/SchematicHQ.Client/Components/IComponentsClient.cs
@@ -33,6 +33,13 @@ WithRawResponseTask DeleteComponentAsync(
CancellationToken cancellationToken = default
);
+ WithRawResponseTask BindCatalogAsync(
+ string componentId,
+ BindCatalogRequestBody request,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ );
+
WithRawResponseTask CountComponentsAsync(
CountComponentsRequest request,
RequestOptions? options = null,
diff --git a/src/SchematicHQ.Client/Components/Requests/BindCatalogRequestBody.cs b/src/SchematicHQ.Client/Components/Requests/BindCatalogRequestBody.cs
new file mode 100644
index 00000000..ea641ef8
--- /dev/null
+++ b/src/SchematicHQ.Client/Components/Requests/BindCatalogRequestBody.cs
@@ -0,0 +1,17 @@
+using global::System.Text.Json.Serialization;
+using SchematicHQ.Client.Core;
+
+namespace SchematicHQ.Client;
+
+[Serializable]
+public record BindCatalogRequestBody
+{
+ [JsonPropertyName("catalog_id")]
+ public string? CatalogId { get; set; }
+
+ ///
+ public override string ToString()
+ {
+ return JsonUtils.Serialize(this);
+ }
+}
diff --git a/src/SchematicHQ.Client/Components/Types/BindCatalogResponse.cs b/src/SchematicHQ.Client/Components/Types/BindCatalogResponse.cs
new file mode 100644
index 00000000..044287bb
--- /dev/null
+++ b/src/SchematicHQ.Client/Components/Types/BindCatalogResponse.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 BindCatalogResponse : IJsonOnDeserialized
+{
+ [JsonExtensionData]
+ private readonly IDictionary _extensionData =
+ new Dictionary();
+
+ [JsonPropertyName("data")]
+ public required ComponentResponseData 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 5e7eb8d5..1fb2f5c9 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.1";
+ public const string Current = "1.5.2";
}
diff --git a/src/SchematicHQ.Client/Dataexports/DataexportsClient.cs b/src/SchematicHQ.Client/Dataexports/DataexportsClient.cs
index 547d53a4..e191e734 100644
--- a/src/SchematicHQ.Client/Dataexports/DataexportsClient.cs
+++ b/src/SchematicHQ.Client/Dataexports/DataexportsClient.cs
@@ -12,6 +12,161 @@ internal DataexportsClient(RawClient client)
_client = client;
}
+ private async Task> ListDataExportsAsyncCore(
+ ListDataExportsRequest request,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ )
+ {
+ var _queryString = new SchematicHQ.Client.Core.QueryStringBuilder.Builder(capacity: 4)
+ .Add("export_type", request.ExportType)
+ .Add("status", request.Status)
+ .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 = "data-exports",
+ 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> CreateDataExportAsyncCore(
CreateDataExportRequestBody request,
RequestOptions? options = null,
@@ -165,6 +320,148 @@ private async Task> CreateDataExportAs
}
}
+ private async Task> GetDataExportAsyncCore(
+ string dataExportId,
+ 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(
+ "data-exports/{0}",
+ ValueConvert.ToPathParameterString(dataExportId)
+ ),
+ 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> GetDataExportArtifactAsyncCore(
string dataExportId,
RequestOptions? options = null,
@@ -286,13 +583,34 @@ private async Task> CreateDataExportAs
}
}
+ ///
+ /// await client.Dataexports.ListDataExportsAsync(
+ /// new ListDataExportsRequest
+ /// {
+ /// ExportType = DataExportType.AuditLog,
+ /// Status = DataExportStatus.Failure,
+ /// Limit = 1000000,
+ /// Offset = 1000000,
+ /// }
+ /// );
+ ///
+ public WithRawResponseTask ListDataExportsAsync(
+ ListDataExportsRequest request,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ )
+ {
+ return new WithRawResponseTask(
+ ListDataExportsAsyncCore(request, options, cancellationToken)
+ );
+ }
+
///
/// await client.Dataexports.CreateDataExportAsync(
/// new CreateDataExportRequestBody
/// {
- /// ExportType = "company-feature-usage",
- /// Metadata = "metadata",
- /// OutputFileType = "csv",
+ /// ExportType = DataExportType.AuditLog,
+ /// OutputFileType = DataExportOutputFileType.Csv,
/// }
/// );
///
@@ -307,6 +625,20 @@ public WithRawResponseTask CreateDataExportAsync(
);
}
+ ///
+ /// await client.Dataexports.GetDataExportAsync("data_export_id");
+ ///
+ public WithRawResponseTask GetDataExportAsync(
+ string dataExportId,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ )
+ {
+ return new WithRawResponseTask(
+ GetDataExportAsyncCore(dataExportId, options, cancellationToken)
+ );
+ }
+
///
/// await client.Dataexports.GetDataExportArtifactAsync("data_export_id");
///
diff --git a/src/SchematicHQ.Client/Dataexports/IDataexportsClient.cs b/src/SchematicHQ.Client/Dataexports/IDataexportsClient.cs
index 77880131..1ee3035d 100644
--- a/src/SchematicHQ.Client/Dataexports/IDataexportsClient.cs
+++ b/src/SchematicHQ.Client/Dataexports/IDataexportsClient.cs
@@ -2,12 +2,24 @@ namespace SchematicHQ.Client;
public partial interface IDataexportsClient
{
+ WithRawResponseTask ListDataExportsAsync(
+ ListDataExportsRequest request,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ );
+
WithRawResponseTask CreateDataExportAsync(
CreateDataExportRequestBody request,
RequestOptions? options = null,
CancellationToken cancellationToken = default
);
+ WithRawResponseTask GetDataExportAsync(
+ string dataExportId,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ );
+
WithRawResponseTask GetDataExportArtifactAsync(
string dataExportId,
RequestOptions? options = null,
diff --git a/src/SchematicHQ.Client/Dataexports/Requests/CreateDataExportRequestBody.cs b/src/SchematicHQ.Client/Dataexports/Requests/CreateDataExportRequestBody.cs
index e827995b..9eff51aa 100644
--- a/src/SchematicHQ.Client/Dataexports/Requests/CreateDataExportRequestBody.cs
+++ b/src/SchematicHQ.Client/Dataexports/Requests/CreateDataExportRequestBody.cs
@@ -7,13 +7,13 @@ namespace SchematicHQ.Client;
public record CreateDataExportRequestBody
{
[JsonPropertyName("export_type")]
- public string ExportType { get; set; } = "company-feature-usage";
+ public required DataExportType ExportType { get; set; }
[JsonPropertyName("metadata")]
- public required string Metadata { get; set; }
+ public DataExportMetadata? Metadata { get; set; }
[JsonPropertyName("output_file_type")]
- public string OutputFileType { get; set; } = "csv";
+ public required DataExportOutputFileType OutputFileType { get; set; }
///
public override string ToString()
diff --git a/src/SchematicHQ.Client/Dataexports/Requests/ListDataExportsRequest.cs b/src/SchematicHQ.Client/Dataexports/Requests/ListDataExportsRequest.cs
new file mode 100644
index 00000000..b3958bd9
--- /dev/null
+++ b/src/SchematicHQ.Client/Dataexports/Requests/ListDataExportsRequest.cs
@@ -0,0 +1,32 @@
+using global::System.Text.Json.Serialization;
+using SchematicHQ.Client.Core;
+
+namespace SchematicHQ.Client;
+
+[Serializable]
+public record ListDataExportsRequest
+{
+ [JsonIgnore]
+ public DataExportType? ExportType { get; set; }
+
+ [JsonIgnore]
+ public DataExportStatus? Status { 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/Dataexports/Types/GetDataExportResponse.cs b/src/SchematicHQ.Client/Dataexports/Types/GetDataExportResponse.cs
new file mode 100644
index 00000000..37948755
--- /dev/null
+++ b/src/SchematicHQ.Client/Dataexports/Types/GetDataExportResponse.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 GetDataExportResponse : IJsonOnDeserialized
+{
+ [JsonExtensionData]
+ private readonly IDictionary _extensionData =
+ new Dictionary();
+
+ [JsonPropertyName("data")]
+ public required DataExportResponseData 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/Dataexports/Types/ListDataExportsParams.cs b/src/SchematicHQ.Client/Dataexports/Types/ListDataExportsParams.cs
new file mode 100644
index 00000000..daed5514
--- /dev/null
+++ b/src/SchematicHQ.Client/Dataexports/Types/ListDataExportsParams.cs
@@ -0,0 +1,46 @@
+using global::System.Text.Json;
+using global::System.Text.Json.Serialization;
+using SchematicHQ.Client.Core;
+
+namespace SchematicHQ.Client;
+
+///
+/// Input parameters
+///
+[Serializable]
+public record ListDataExportsParams : IJsonOnDeserialized
+{
+ [JsonExtensionData]
+ private readonly IDictionary _extensionData =
+ new Dictionary();
+
+ [JsonPropertyName("export_type")]
+ public DataExportType? ExportType { get; set; }
+
+ ///
+ /// Page limit (default 100)
+ ///
+ [JsonPropertyName("limit")]
+ public long? Limit { get; set; }
+
+ ///
+ /// Page offset (default 0)
+ ///
+ [JsonPropertyName("offset")]
+ public long? Offset { get; set; }
+
+ [JsonPropertyName("status")]
+ public DataExportStatus? Status { 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/Dataexports/Types/ListDataExportsResponse.cs b/src/SchematicHQ.Client/Dataexports/Types/ListDataExportsResponse.cs
new file mode 100644
index 00000000..79033c97
--- /dev/null
+++ b/src/SchematicHQ.Client/Dataexports/Types/ListDataExportsResponse.cs
@@ -0,0 +1,35 @@
+using global::System.Text.Json;
+using global::System.Text.Json.Serialization;
+using SchematicHQ.Client.Core;
+
+namespace SchematicHQ.Client;
+
+[Serializable]
+public record ListDataExportsResponse : IJsonOnDeserialized
+{
+ [JsonExtensionData]
+ private readonly IDictionary _extensionData =
+ new Dictionary();
+
+ [JsonPropertyName("data")]
+ public IEnumerable Data { get; set; } =
+ new List();
+
+ ///
+ /// Input parameters
+ ///
+ [JsonPropertyName("params")]
+ public required ListDataExportsParams 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/ISchematicApi.cs b/src/SchematicHQ.Client/ISchematicApi.cs
index 17490b4d..c7281e63 100644
--- a/src/SchematicHQ.Client/ISchematicApi.cs
+++ b/src/SchematicHQ.Client/ISchematicApi.cs
@@ -5,6 +5,7 @@ public partial interface ISchematicApi
public IAccountsClient Accounts { get; }
public IBillingClient Billing { get; }
public ICreditsClient Credits { get; }
+ public ICatalogsClient Catalogs { get; }
public ICheckoutClient Checkout { get; }
public ICompaniesClient Companies { get; }
public IEntitlementsClient Entitlements { get; }
diff --git a/src/SchematicHQ.Client/Planbundle/Requests/CreateCustomPlanBundleRequestBody.cs b/src/SchematicHQ.Client/Planbundle/Requests/CreateCustomPlanBundleRequestBody.cs
index fa11c65e..945ae3e1 100644
--- a/src/SchematicHQ.Client/Planbundle/Requests/CreateCustomPlanBundleRequestBody.cs
+++ b/src/SchematicHQ.Client/Planbundle/Requests/CreateCustomPlanBundleRequestBody.cs
@@ -9,6 +9,9 @@ public record CreateCustomPlanBundleRequestBody
[JsonPropertyName("billing_product")]
public UpsertBillingProductRequestBody? BillingProduct { get; set; }
+ [JsonPropertyName("credit_grants")]
+ public IEnumerable? CreditGrants { get; set; }
+
[JsonPropertyName("entitlements")]
public IEnumerable Entitlements { get; set; } =
new List();
diff --git a/src/SchematicHQ.Client/SchematicApi.cs b/src/SchematicHQ.Client/SchematicApi.cs
index 90d7f109..fa3073a2 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.1" },
+ { "User-Agent", "SchematicHQ.Client/1.5.2" },
}
);
foreach (var header in platformHeaders)
@@ -37,6 +37,7 @@ public SchematicApi(string? apiKey = null, ClientOptions? clientOptions = null)
Accounts = new AccountsClient(_client);
Billing = new BillingClient(_client);
Credits = new CreditsClient(_client);
+ Catalogs = new CatalogsClient(_client);
Checkout = new CheckoutClient(_client);
Companies = new CompaniesClient(_client);
Entitlements = new EntitlementsClient(_client);
@@ -62,6 +63,8 @@ public SchematicApi(string? apiKey = null, ClientOptions? clientOptions = null)
public ICreditsClient Credits { get; }
+ public ICatalogsClient Catalogs { get; }
+
public ICheckoutClient Checkout { get; }
public ICompaniesClient Companies { get; }
diff --git a/src/SchematicHQ.Client/SchematicHQ.Client.csproj b/src/SchematicHQ.Client/SchematicHQ.Client.csproj
index afa50c9a..e7d2f024 100644
--- a/src/SchematicHQ.Client/SchematicHQ.Client.csproj
+++ b/src/SchematicHQ.Client/SchematicHQ.Client.csproj
@@ -4,7 +4,7 @@
enable
12
enable
- 1.5.1
+ 1.5.2
$(Version)
$(Version)
README.md
diff --git a/src/SchematicHQ.Client/Types/AuditLogExportMetadata.cs b/src/SchematicHQ.Client/Types/AuditLogExportMetadata.cs
new file mode 100644
index 00000000..a9f42707
--- /dev/null
+++ b/src/SchematicHQ.Client/Types/AuditLogExportMetadata.cs
@@ -0,0 +1,55 @@
+using global::System.Text.Json;
+using global::System.Text.Json.Serialization;
+using SchematicHQ.Client.Core;
+
+namespace SchematicHQ.Client;
+
+[Serializable]
+public record AuditLogExportMetadata : IJsonOnDeserialized
+{
+ [JsonExtensionData]
+ private readonly IDictionary _extensionData =
+ new Dictionary();
+
+ ///
+ /// Restrict the export to audit log entries from this actor type
+ ///
+ [JsonPropertyName("actor_type")]
+ public string? ActorType { get; set; }
+
+ ///
+ /// Restrict the export to audit log entries that started before this time
+ ///
+ [JsonPropertyName("end_time")]
+ public DateTime? EndTime { get; set; }
+
+ ///
+ /// Account member emails to notify when the export completes; empty means the artifact is only retrievable via the API
+ ///
+ [JsonPropertyName("notification_email_recipient_email_addresses")]
+ public IEnumerable? NotificationEmailRecipientEmailAddresses { get; set; }
+
+ ///
+ /// Free-text search over audit log entries
+ ///
+ [JsonPropertyName("q")]
+ public string? Q { get; set; }
+
+ ///
+ /// Restrict the export to audit log entries that started at or after this time
+ ///
+ [JsonPropertyName("start_time")]
+ public DateTime? StartTime { 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/CatalogConfigOrderedBundle.cs b/src/SchematicHQ.Client/Types/CatalogConfigOrderedBundle.cs
new file mode 100644
index 00000000..fa6161cb
--- /dev/null
+++ b/src/SchematicHQ.Client/Types/CatalogConfigOrderedBundle.cs
@@ -0,0 +1,28 @@
+using global::System.Text.Json;
+using global::System.Text.Json.Serialization;
+using SchematicHQ.Client.Core;
+
+namespace SchematicHQ.Client;
+
+[Serializable]
+public record CatalogConfigOrderedBundle : IJsonOnDeserialized
+{
+ [JsonExtensionData]
+ private readonly IDictionary _extensionData =
+ new Dictionary();
+
+ [JsonPropertyName("bundle_id")]
+ public required string BundleId { 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/CatalogConfigOrderedBundleResponseData.cs b/src/SchematicHQ.Client/Types/CatalogConfigOrderedBundleResponseData.cs
new file mode 100644
index 00000000..6ee82ae1
--- /dev/null
+++ b/src/SchematicHQ.Client/Types/CatalogConfigOrderedBundleResponseData.cs
@@ -0,0 +1,28 @@
+using global::System.Text.Json;
+using global::System.Text.Json.Serialization;
+using SchematicHQ.Client.Core;
+
+namespace SchematicHQ.Client;
+
+[Serializable]
+public record CatalogConfigOrderedBundleResponseData : IJsonOnDeserialized
+{
+ [JsonExtensionData]
+ private readonly IDictionary _extensionData =
+ new Dictionary();
+
+ [JsonPropertyName("bundle_id")]
+ public required string BundleId { 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/CatalogConfigOrderedEntitlement.cs b/src/SchematicHQ.Client/Types/CatalogConfigOrderedEntitlement.cs
new file mode 100644
index 00000000..fcee1e65
--- /dev/null
+++ b/src/SchematicHQ.Client/Types/CatalogConfigOrderedEntitlement.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 CatalogConfigOrderedEntitlement : IJsonOnDeserialized
+{
+ [JsonExtensionData]
+ private readonly IDictionary _extensionData =
+ new Dictionary();
+
+ [JsonPropertyName("plan_entitlement_id")]
+ public required string PlanEntitlementId { get; set; }
+
+ [JsonPropertyName("visible")]
+ public bool? Visible { 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/CatalogConfigOrderedEntitlementResponseData.cs b/src/SchematicHQ.Client/Types/CatalogConfigOrderedEntitlementResponseData.cs
new file mode 100644
index 00000000..79b4e949
--- /dev/null
+++ b/src/SchematicHQ.Client/Types/CatalogConfigOrderedEntitlementResponseData.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 CatalogConfigOrderedEntitlementResponseData : IJsonOnDeserialized
+{
+ [JsonExtensionData]
+ private readonly IDictionary _extensionData =
+ new Dictionary();
+
+ [JsonPropertyName("plan_entitlement_id")]
+ public required string PlanEntitlementId { get; set; }
+
+ [JsonPropertyName("visible")]
+ public required bool Visible { 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/CatalogConfigOrderedPlan.cs b/src/SchematicHQ.Client/Types/CatalogConfigOrderedPlan.cs
new file mode 100644
index 00000000..7fd3eead
--- /dev/null
+++ b/src/SchematicHQ.Client/Types/CatalogConfigOrderedPlan.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 CatalogConfigOrderedPlan : IJsonOnDeserialized
+{
+ [JsonExtensionData]
+ private readonly IDictionary _extensionData =
+ new Dictionary();
+
+ [JsonPropertyName("entitlements")]
+ public IEnumerable? Entitlements { get; set; }
+
+ [JsonPropertyName("plan_id")]
+ public required string PlanId { 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/CatalogConfigOrderedPlanResponseData.cs b/src/SchematicHQ.Client/Types/CatalogConfigOrderedPlanResponseData.cs
new file mode 100644
index 00000000..a3e5cdf4
--- /dev/null
+++ b/src/SchematicHQ.Client/Types/CatalogConfigOrderedPlanResponseData.cs
@@ -0,0 +1,32 @@
+using global::System.Text.Json;
+using global::System.Text.Json.Serialization;
+using SchematicHQ.Client.Core;
+
+namespace SchematicHQ.Client;
+
+[Serializable]
+public record CatalogConfigOrderedPlanResponseData : IJsonOnDeserialized
+{
+ [JsonExtensionData]
+ private readonly IDictionary _extensionData =
+ new Dictionary();
+
+ [JsonPropertyName("entitlements")]
+ public IEnumerable Entitlements { get; set; } =
+ new List