From a3f82903d9986a3f34bb17b2da7d067bbbfd0059 Mon Sep 17 00:00:00 2001
From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com>
Date: Wed, 22 Jul 2026 19:43:45 +0000
Subject: [PATCH 1/2] [fern-generated] Update SDK
Generated by Fern
CLI Version: unknown
Generators:
- fernapi/fern-java-sdk: 4.11.1
---
.fern/metadata.json | 6 +-
build.gradle | 4 +-
reference.md | 1169 ++++++++++++-
.../com/schematic/api/AsyncBaseSchematic.java | 8 +
.../com/schematic/api/core/ClientOptions.java | 4 +-
.../catalogs/AsyncCatalogsClient.java | 196 +++
.../catalogs/AsyncRawCatalogsClient.java | 1472 +++++++++++++++++
.../resources/catalogs/CatalogsClient.java | 187 +++
.../resources/catalogs/RawCatalogsClient.java | 1123 +++++++++++++
.../requests/CreateCatalogRequestBody.java | 171 ++
.../requests/ListCatalogsRequest.java | 197 +++
...UpdateCatalogConfigurationRequestBody.java | 322 ++++
.../requests/UpdateCatalogRequestBody.java | 153 ++
.../catalogs/types/CreateCatalogResponse.java | 181 ++
.../catalogs/types/DeleteCatalogResponse.java | 181 ++
.../catalogs/types/GetCatalogResponse.java | 181 ++
.../types/GetConfigurationResponse.java | 183 ++
.../GetCreditBundlesInCatalogResponse.java | 183 ++
.../types/GetDerivedFeaturesResponse.java | 183 ++
.../types/GetPlansInCatalogResponse.java | 181 ++
.../catalogs/types/ListCatalogsParams.java | 197 +++
.../catalogs/types/ListCatalogsResponse.java | 174 ++
.../catalogs/types/UpdateCatalogResponse.java | 181 ++
.../types/UpdateConfigurationResponse.java | 181 ++
.../checkout/AsyncCheckoutClient.java | 26 +
.../checkout/AsyncRawCheckoutClient.java | 209 +++
.../resources/checkout/CheckoutClient.java | 25 +
.../resources/checkout/RawCheckoutClient.java | 158 ++
...pdateCompanyBillingDetailsRequestBody.java | 194 +++
.../GetCompanyBillingDetailsResponse.java | 183 ++
.../UpdateCompanyBillingDetailsResponse.java | 184 +++
.../components/AsyncComponentsClient.java | 19 +
.../components/AsyncRawComponentsClient.java | 118 ++
.../components/ComponentsClient.java | 19 +
.../components/RawComponentsClient.java | 93 ++
.../requests/BindCatalogRequestBody.java | 105 ++
.../components/types/BindCatalogResponse.java | 181 ++
.../dataexports/AsyncDataexportsClient.java | 28 +
.../AsyncRawDataexportsClient.java | 218 +++
.../dataexports/DataexportsClient.java | 27 +
.../dataexports/RawDataexportsClient.java | 169 ++
.../requests/CreateDataExportRequestBody.java | 62 +-
.../requests/ListDataExportsRequest.java | 193 +++
.../types/GetDataExportResponse.java | 181 ++
.../types/ListDataExportsParams.java | 193 +++
.../types/ListDataExportsResponse.java | 174 ++
.../CreateCustomPlanBundleRequestBody.java | 30 +-
.../api/types/AuditLogExportMetadata.java | 239 +++
.../api/types/CatalogConfigOrderedBundle.java | 118 ++
...atalogConfigOrderedBundleResponseData.java | 119 ++
.../CatalogConfigOrderedEntitlement.java | 149 ++
...gConfigOrderedEntitlementResponseData.java | 142 ++
.../api/types/CatalogConfigOrderedPlan.java | 152 ++
.../CatalogConfigOrderedPlanResponseData.java | 166 ++
.../CatalogConfigurationResponseData.java | 511 ++++++
.../CatalogCreditBundleIDsResponseData.java | 117 ++
.../CatalogDerivedFeatureResponseData.java | 163 ++
.../CatalogDerivedFeaturesResponseData.java | 118 ++
.../api/types/CatalogPlanIDsResponseData.java | 116 ++
.../api/types/CatalogResponseData.java | 509 ++++++
.../api/types/CompanyBillingAddressView.java | 241 +++
.../types/CompanyBillingCheckoutSettings.java | 168 ++
.../CompanyBillingDetailsResponseData.java | 258 +++
.../api/types/CompanyBillingDetailsView.java | 258 +++
.../CompanyFeatureUsageExportMetadata.java | 642 +++++++
.../types/CompanyPlanDetailResponseData.java | 32 +
.../api/types/ComponentResponseData.java | 36 +-
.../CreateEntitlementInBundleRequestBody.java | 32 +
.../api/types/CreditsAutoTopupSuccess.java | 206 +++
.../types/CreditsCreditPurchaseSuccess.java | 276 ++++
.../types/CreditsWebhookCompanySummary.java | 140 ++
.../types/CreditsWebhookCreditSummary.java | 140 ++
.../api/types/CustomerBillingAddress.java | 241 +++
.../api/types/DataExportMetadata.java | 225 +++
.../api/types/DataExportOutputFileType.java | 84 +
.../api/types/DataExportResponseData.java | 69 +-
.../schematic/api/types/DataExportType.java | 84 +
.../api/types/FeatureEntitlement.java | 50 +-
.../PlanCatalogMembershipResponseData.java | 140 ++
.../api/types/PlanDetailResponseData.java | 32 +
.../PlanGroupPlanDetailResponseData.java | 32 +
.../api/types/PlanViewPublicResponseData.java | 32 +
...eviewSubscriptionDiscountResponseData.java | 430 +++++
...reviewSubscriptionFinanceResponseData.java | 76 +-
.../types/RulesengineFeatureEntitlement.java | 50 +-
.../api/types/RulesengineWarningTier.java | 160 ++
.../api/types/UpsertCompanyRequestBody.java | 83 +-
.../com/schematic/api/types/WarningTier.java | 160 ++
.../api/types/WebhookRequestType.java | 22 +
89 files changed, 16691 insertions(+), 134 deletions(-)
create mode 100644 src/main/java/com/schematic/api/resources/catalogs/AsyncCatalogsClient.java
create mode 100644 src/main/java/com/schematic/api/resources/catalogs/AsyncRawCatalogsClient.java
create mode 100644 src/main/java/com/schematic/api/resources/catalogs/CatalogsClient.java
create mode 100644 src/main/java/com/schematic/api/resources/catalogs/RawCatalogsClient.java
create mode 100644 src/main/java/com/schematic/api/resources/catalogs/requests/CreateCatalogRequestBody.java
create mode 100644 src/main/java/com/schematic/api/resources/catalogs/requests/ListCatalogsRequest.java
create mode 100644 src/main/java/com/schematic/api/resources/catalogs/requests/UpdateCatalogConfigurationRequestBody.java
create mode 100644 src/main/java/com/schematic/api/resources/catalogs/requests/UpdateCatalogRequestBody.java
create mode 100644 src/main/java/com/schematic/api/resources/catalogs/types/CreateCatalogResponse.java
create mode 100644 src/main/java/com/schematic/api/resources/catalogs/types/DeleteCatalogResponse.java
create mode 100644 src/main/java/com/schematic/api/resources/catalogs/types/GetCatalogResponse.java
create mode 100644 src/main/java/com/schematic/api/resources/catalogs/types/GetConfigurationResponse.java
create mode 100644 src/main/java/com/schematic/api/resources/catalogs/types/GetCreditBundlesInCatalogResponse.java
create mode 100644 src/main/java/com/schematic/api/resources/catalogs/types/GetDerivedFeaturesResponse.java
create mode 100644 src/main/java/com/schematic/api/resources/catalogs/types/GetPlansInCatalogResponse.java
create mode 100644 src/main/java/com/schematic/api/resources/catalogs/types/ListCatalogsParams.java
create mode 100644 src/main/java/com/schematic/api/resources/catalogs/types/ListCatalogsResponse.java
create mode 100644 src/main/java/com/schematic/api/resources/catalogs/types/UpdateCatalogResponse.java
create mode 100644 src/main/java/com/schematic/api/resources/catalogs/types/UpdateConfigurationResponse.java
create mode 100644 src/main/java/com/schematic/api/resources/checkout/requests/UpdateCompanyBillingDetailsRequestBody.java
create mode 100644 src/main/java/com/schematic/api/resources/checkout/types/GetCompanyBillingDetailsResponse.java
create mode 100644 src/main/java/com/schematic/api/resources/checkout/types/UpdateCompanyBillingDetailsResponse.java
create mode 100644 src/main/java/com/schematic/api/resources/components/requests/BindCatalogRequestBody.java
create mode 100644 src/main/java/com/schematic/api/resources/components/types/BindCatalogResponse.java
create mode 100644 src/main/java/com/schematic/api/resources/dataexports/requests/ListDataExportsRequest.java
create mode 100644 src/main/java/com/schematic/api/resources/dataexports/types/GetDataExportResponse.java
create mode 100644 src/main/java/com/schematic/api/resources/dataexports/types/ListDataExportsParams.java
create mode 100644 src/main/java/com/schematic/api/resources/dataexports/types/ListDataExportsResponse.java
create mode 100644 src/main/java/com/schematic/api/types/AuditLogExportMetadata.java
create mode 100644 src/main/java/com/schematic/api/types/CatalogConfigOrderedBundle.java
create mode 100644 src/main/java/com/schematic/api/types/CatalogConfigOrderedBundleResponseData.java
create mode 100644 src/main/java/com/schematic/api/types/CatalogConfigOrderedEntitlement.java
create mode 100644 src/main/java/com/schematic/api/types/CatalogConfigOrderedEntitlementResponseData.java
create mode 100644 src/main/java/com/schematic/api/types/CatalogConfigOrderedPlan.java
create mode 100644 src/main/java/com/schematic/api/types/CatalogConfigOrderedPlanResponseData.java
create mode 100644 src/main/java/com/schematic/api/types/CatalogConfigurationResponseData.java
create mode 100644 src/main/java/com/schematic/api/types/CatalogCreditBundleIDsResponseData.java
create mode 100644 src/main/java/com/schematic/api/types/CatalogDerivedFeatureResponseData.java
create mode 100644 src/main/java/com/schematic/api/types/CatalogDerivedFeaturesResponseData.java
create mode 100644 src/main/java/com/schematic/api/types/CatalogPlanIDsResponseData.java
create mode 100644 src/main/java/com/schematic/api/types/CatalogResponseData.java
create mode 100644 src/main/java/com/schematic/api/types/CompanyBillingAddressView.java
create mode 100644 src/main/java/com/schematic/api/types/CompanyBillingCheckoutSettings.java
create mode 100644 src/main/java/com/schematic/api/types/CompanyBillingDetailsResponseData.java
create mode 100644 src/main/java/com/schematic/api/types/CompanyBillingDetailsView.java
create mode 100644 src/main/java/com/schematic/api/types/CompanyFeatureUsageExportMetadata.java
create mode 100644 src/main/java/com/schematic/api/types/CreditsAutoTopupSuccess.java
create mode 100644 src/main/java/com/schematic/api/types/CreditsCreditPurchaseSuccess.java
create mode 100644 src/main/java/com/schematic/api/types/CreditsWebhookCompanySummary.java
create mode 100644 src/main/java/com/schematic/api/types/CreditsWebhookCreditSummary.java
create mode 100644 src/main/java/com/schematic/api/types/CustomerBillingAddress.java
create mode 100644 src/main/java/com/schematic/api/types/DataExportMetadata.java
create mode 100644 src/main/java/com/schematic/api/types/DataExportOutputFileType.java
create mode 100644 src/main/java/com/schematic/api/types/DataExportType.java
create mode 100644 src/main/java/com/schematic/api/types/PlanCatalogMembershipResponseData.java
create mode 100644 src/main/java/com/schematic/api/types/PreviewSubscriptionDiscountResponseData.java
create mode 100644 src/main/java/com/schematic/api/types/RulesengineWarningTier.java
create mode 100644 src/main/java/com/schematic/api/types/WarningTier.java
diff --git a/.fern/metadata.json b/.fern/metadata.json
index 1dc7ebde..68b76a32 100644
--- a/.fern/metadata.json
+++ b/.fern/metadata.json
@@ -14,10 +14,10 @@
"implementation redis.clients:jedis:5.2.0"
]
},
- "originGitCommit": "19cafdf92ab056ef6ba803bf1e352b0422a8ec45",
+ "originGitCommit": "75191b40ce7af084ca4fb11f623ab59c57cf97e3",
"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/build.gradle b/build.gradle
index aaef1575..1307bd8f 100644
--- a/build.gradle
+++ b/build.gradle
@@ -62,7 +62,7 @@ java {
group = 'com.schematichq'
-version = '1.5.1'
+version = '1.5.2'
jar {
dependsOn(":generatePomFileForMavenPublication")
@@ -93,7 +93,7 @@ publishing {
maven(MavenPublication) {
groupId = 'com.schematichq'
artifactId = 'schematic-java'
- version = '1.5.1'
+ version = '1.5.2'
from components.java
pom {
name = 'Schematic'
diff --git a/reference.md b/reference.md
index 97bae759..2d2fd29f 100644
--- a/reference.md
+++ b/reference.md
@@ -6022,6 +6022,759 @@ client.credits().countCreditEventLedger(
+
+
+
+
+## catalogs
+client.catalogs.listCatalogs() -> ListCatalogsResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```java
+client.catalogs().listCatalogs(
+ ListCatalogsRequest
+ .builder()
+ .isDefault(true)
+ .q("q")
+ .limit(1000000L)
+ .offset(1000000L)
+ .build()
+);
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**isDefault:** `Optional`
+
+
+
+
+
+-
+
+**q:** `Optional` — Search by catalog name
+
+
+
+
+
+-
+
+**limit:** `Optional` — Page limit (default 100)
+
+
+
+
+
+-
+
+**offset:** `Optional` — Page offset (default 0)
+
+
+
+
+
+
+
+
+
+
+
+client.catalogs.createCatalog(request) -> CreateCatalogResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```java
+client.catalogs().createCatalog(
+ CreateCatalogRequestBody
+ .builder()
+ .isDefault(true)
+ .name("name")
+ .build()
+);
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**description:** `Optional`
+
+
+
+
+
+-
+
+**isDefault:** `Boolean`
+
+
+
+
+
+-
+
+**name:** `String`
+
+
+
+
+
+
+
+
+
+
+
+client.catalogs.getCatalog(catalogId) -> GetCatalogResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```java
+client.catalogs().getCatalog("catalog_id");
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**catalogId:** `String` — catalog_id
+
+
+
+
+
+
+
+
+
+
+
+client.catalogs.updateCatalog(catalogId, request) -> UpdateCatalogResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```java
+client.catalogs().updateCatalog(
+ "catalog_id",
+ UpdateCatalogRequestBody
+ .builder()
+ .build()
+);
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**catalogId:** `String` — catalog_id
+
+
+
+
+
+-
+
+**description:** `Optional`
+
+
+
+
+
+-
+
+**isDefault:** `Optional`
+
+
+
+
+
+-
+
+**name:** `Optional`
+
+
+
+
+
+
+
+
+
+
+
+client.catalogs.deleteCatalog(catalogId) -> DeleteCatalogResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```java
+client.catalogs().deleteCatalog("catalog_id");
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**catalogId:** `String` — catalog_id
+
+
+
+
+
+
+
+
+
+
+
+client.catalogs.getConfiguration(catalogId) -> GetConfigurationResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```java
+client.catalogs().getConfiguration("catalog_id");
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**catalogId:** `String` — catalog_id
+
+
+
+
+
+
+
+
+
+
+
+client.catalogs.updateConfiguration(catalogId, request) -> UpdateConfigurationResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```java
+client.catalogs().updateConfiguration(
+ "catalog_id",
+ UpdateCatalogConfigurationRequestBody
+ .builder()
+ .build()
+);
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**catalogId:** `String` — catalog_id
+
+
+
+
+
+-
+
+**customPlanCtaText:** `Optional`
+
+
+
+
+
+-
+
+**customPlanCtaUrl:** `Optional`
+
+
+
+
+
+-
+
+**customPlanPriceText:** `Optional`
+
+
+
+
+
+-
+
+**customPlansVisible:** `Optional`
+
+
+
+
+
+-
+
+**orderedAddOns:** `Optional
>`
+
+
+
+
+
+-
+
+**orderedBundles:** `Optional
>`
+
+
+
+
+
+-
+
+**orderedPlans:** `Optional
>`
+
+
+
+
+
+-
+
+**pricingModel:** `Optional`
+
+
+
+
+
+-
+
+**pricingUrl:** `Optional`
+
+
+
+
+
+
+
+
+
+
+
+client.catalogs.getCreditBundlesInCatalog(catalogId) -> GetCreditBundlesInCatalogResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```java
+client.catalogs().getCreditBundlesInCatalog("catalog_id");
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**catalogId:** `String` — catalog_id
+
+
+
+
+
+
+
+
+
+
+
+client.catalogs.addCreditBundle(catalogId, creditBundleId)
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```java
+client.catalogs().addCreditBundle("catalog_id", "credit_bundle_id");
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**catalogId:** `String` — catalog_id
+
+
+
+
+
+-
+
+**creditBundleId:** `String` — credit_bundle_id
+
+
+
+
+
+
+
+
+
+
+
+client.catalogs.removeCreditBundle(catalogId, creditBundleId)
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```java
+client.catalogs().removeCreditBundle("catalog_id", "credit_bundle_id");
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**catalogId:** `String` — catalog_id
+
+
+
+
+
+-
+
+**creditBundleId:** `String` — credit_bundle_id
+
+
+
+
+
+
+
+
+
+
+
+client.catalogs.getDerivedFeatures(catalogId) -> GetDerivedFeaturesResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```java
+client.catalogs().getDerivedFeatures("catalog_id");
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**catalogId:** `String` — catalog_id
+
+
+
+
+
+
+
+
+
+
+
+client.catalogs.getPlansInCatalog(catalogId) -> GetPlansInCatalogResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```java
+client.catalogs().getPlansInCatalog("catalog_id");
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**catalogId:** `String` — catalog_id
+
+
+
+
+
+
+
+
+
+
+
+client.catalogs.addPlan(catalogId, planId)
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```java
+client.catalogs().addPlan("catalog_id", "plan_id");
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**catalogId:** `String` — catalog_id
+
+
+
+
+
+-
+
+**planId:** `String` — plan_id
+
+
+
+
+
+
+
+
+
+
+
+client.catalogs.removePlan(catalogId, planId)
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```java
+client.catalogs().removePlan("catalog_id", "plan_id");
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**catalogId:** `String` — catalog_id
+
+
+
+
+
+-
+
+**planId:** `String` — plan_id
+
+
+
+
+
+
+
@@ -6144,7 +6897,139 @@ client.checkout().getCheckoutData(
-#### ⚙️ Parameters
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**companyId:** `String`
+
+
+
+
+
+-
+
+**currency:** `Optional`
+
+
+
+
+
+-
+
+**selectedPlanId:** `Optional`
+
+
+
+
+
+
+
+
+
+
+
+client.checkout.previewCheckoutInternal(request) -> PreviewCheckoutInternalResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```java
+client.checkout().previewCheckoutInternal(
+ ChangeSubscriptionInternalRequestBody
+ .builder()
+ .companyId("company_id")
+ .newPlanId("new_plan_id")
+ .newPriceId("new_price_id")
+ .skipTrial(true)
+ .addOnIds(
+ Arrays.asList(
+ UpdateAddOnRequestBody
+ .builder()
+ .addOnId("add_on_id")
+ .priceId("price_id")
+ .build()
+ )
+ )
+ .autoTopupOverrides(
+ Arrays.asList(
+ UpdateAutoTopupOverrideRequestBody
+ .builder()
+ .planCreditGrantId("plan_credit_grant_id")
+ .build()
+ )
+ )
+ .creditBundles(
+ Arrays.asList(
+ UpdateCreditBundleRequestBody
+ .builder()
+ .bundleId("bundle_id")
+ .quantity(1000000L)
+ .build()
+ )
+ )
+ .customFieldValues(
+ Arrays.asList(
+ CheckoutFieldValue
+ .builder()
+ .id("id")
+ .value("value")
+ .build()
+ )
+ )
+ .payInAdvance(
+ Arrays.asList(
+ UpdatePayInAdvanceRequestBody
+ .builder()
+ .priceId("price_id")
+ .quantity(1000000L)
+ .build()
+ )
+ )
+ .build()
+);
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `ChangeSubscriptionInternalRequestBody`
+
+
+
+
+
+
+
+
+
+
+
+client.checkout.getCompanyBillingDetails(companyId) -> GetCompanyBillingDetailsResponse
+
+-
+
+#### 🔌 Usage
-
@@ -6152,23 +7037,23 @@ client.checkout().getCheckoutData(
-
-**companyId:** `String`
-
+```java
+client.checkout().getCompanyBillingDetails("company_id");
+```
+
+
+#### ⚙️ Parameters
+
-
-**currency:** `Optional`
-
-
-
-
-
-**selectedPlanId:** `Optional`
+**companyId:** `String` — company_id
@@ -6180,7 +7065,7 @@ client.checkout().getCheckoutData(
-client.checkout.previewCheckoutInternal(request) -> PreviewCheckoutInternalResponse
+client.checkout.updateCompanyBillingDetails(companyId, request) -> UpdateCompanyBillingDetailsResponse
-
@@ -6193,40 +7078,11 @@ client.checkout().getCheckoutData(
-
```java
-client.checkout().previewCheckoutInternal(
- ChangeSubscriptionInternalRequestBody
+client.checkout().updateCompanyBillingDetails(
+ "company_id",
+ UpdateCompanyBillingDetailsRequestBody
.builder()
- .companyId("company_id")
- .newPlanId("new_plan_id")
- .newPriceId("new_price_id")
- .skipTrial(true)
- .addOnIds(
- Arrays.asList(
- UpdateAddOnRequestBody
- .builder()
- .addOnId("add_on_id")
- .priceId("price_id")
- .build()
- )
- )
- .autoTopupOverrides(
- Arrays.asList(
- UpdateAutoTopupOverrideRequestBody
- .builder()
- .planCreditGrantId("plan_credit_grant_id")
- .build()
- )
- )
- .creditBundles(
- Arrays.asList(
- UpdateCreditBundleRequestBody
- .builder()
- .bundleId("bundle_id")
- .quantity(1000000L)
- .build()
- )
- )
- .customFieldValues(
+ .values(
Arrays.asList(
CheckoutFieldValue
.builder()
@@ -6235,15 +7091,6 @@ client.checkout().previewCheckoutInternal(
.build()
)
)
- .payInAdvance(
- Arrays.asList(
- UpdatePayInAdvanceRequestBody
- .builder()
- .priceId("price_id")
- .quantity(1000000L)
- .build()
- )
- )
.build()
);
```
@@ -6260,7 +7107,39 @@ client.checkout().previewCheckoutInternal(
-
-**request:** `ChangeSubscriptionInternalRequestBody`
+**companyId:** `String` — company_id
+
+
+
+
+
+-
+
+**address:** `Optional`
+
+
+
+
+
+-
+
+**email:** `Optional`
+
+
+
+
+
+-
+
+**phone:** `Optional`
+
+
+
+
+
+-
+
+**values:** `List`
@@ -13583,6 +14462,59 @@ client.components().deleteComponent("component_id");
+
+
+
+
+client.components.bindCatalog(componentId, request) -> BindCatalogResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```java
+client.components().bindCatalog(
+ "component_id",
+ BindCatalogRequestBody
+ .builder()
+ .build()
+);
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**componentId:** `String` — component_id
+
+
+
+
+
+-
+
+**catalogId:** `Optional`
+
+
+
+
+
+
+
@@ -13753,6 +14685,14 @@ client.planbundle().createCustomPlanBundle(
-
+**creditGrants:** `Optional
>`
+
+
+
+
+
+-
+
**entitlements:** `List`
@@ -13943,6 +14883,78 @@ client.planbundle().updatePlanBundle(
## dataexports
+client.dataexports.listDataExports() -> ListDataExportsResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```java
+client.dataexports().listDataExports(
+ ListDataExportsRequest
+ .builder()
+ .exportType(DataExportType.AUDIT_LOG)
+ .status(DataExportStatus.FAILURE)
+ .limit(1000000L)
+ .offset(1000000L)
+ .build()
+);
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**exportType:** `Optional`
+
+
+
+
+
+-
+
+**status:** `Optional`
+
+
+
+
+
+-
+
+**limit:** `Optional` — Page limit (default 100)
+
+
+
+
+
+-
+
+**offset:** `Optional` — Page offset (default 0)
+
+
+
+
+
+
+
+
+
+
+
client.dataexports.createDataExport(request) -> CreateDataExportResponse
-
@@ -13959,9 +14971,8 @@ client.planbundle().updatePlanBundle(
client.dataexports().createDataExport(
CreateDataExportRequestBody
.builder()
- .exportType("company-feature-usage")
- .metadata("metadata")
- .outputFileType("csv")
+ .exportType(DataExportType.AUDIT_LOG)
+ .outputFileType(DataExportOutputFileType.CSV)
.build()
);
```
@@ -13978,7 +14989,15 @@ client.dataexports().createDataExport(
-
-**exportType:** `String`
+**exportType:** `DataExportType`
+
+
+
+
+
+-
+
+**metadata:** `Optional`
@@ -13986,15 +15005,47 @@ client.dataexports().createDataExport(
-
-**metadata:** `String`
+**outputFileType:** `DataExportOutputFileType`
+
+
+
+
+
+
+
+
+client.dataexports.getDataExport(dataExportId) -> GetDataExportResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```java
+client.dataexports().getDataExport("data_export_id");
+```
+
+
+
+
+
+#### ⚙️ Parameters
-
-**outputFileType:** `String`
+
+-
+
+**dataExportId:** `String` — data_export_id
diff --git a/src/main/java/com/schematic/api/AsyncBaseSchematic.java b/src/main/java/com/schematic/api/AsyncBaseSchematic.java
index 0cbf4ac8..fada1c1a 100644
--- a/src/main/java/com/schematic/api/AsyncBaseSchematic.java
+++ b/src/main/java/com/schematic/api/AsyncBaseSchematic.java
@@ -9,6 +9,7 @@
import com.schematic.api.resources.accesstokens.AsyncAccesstokensClient;
import com.schematic.api.resources.accounts.AsyncAccountsClient;
import com.schematic.api.resources.billing.AsyncBillingClient;
+import com.schematic.api.resources.catalogs.AsyncCatalogsClient;
import com.schematic.api.resources.checkout.AsyncCheckoutClient;
import com.schematic.api.resources.companies.AsyncCompaniesClient;
import com.schematic.api.resources.components.AsyncComponentsClient;
@@ -40,6 +41,8 @@ public class AsyncBaseSchematic {
protected final Supplier creditsClient;
+ protected final Supplier catalogsClient;
+
protected final Supplier checkoutClient;
protected final Supplier companiesClient;
@@ -80,6 +83,7 @@ public AsyncBaseSchematic(ClientOptions clientOptions) {
this.accountsClient = Suppliers.memoize(() -> new AsyncAccountsClient(clientOptions));
this.billingClient = Suppliers.memoize(() -> new AsyncBillingClient(clientOptions));
this.creditsClient = Suppliers.memoize(() -> new AsyncCreditsClient(clientOptions));
+ this.catalogsClient = Suppliers.memoize(() -> new AsyncCatalogsClient(clientOptions));
this.checkoutClient = Suppliers.memoize(() -> new AsyncCheckoutClient(clientOptions));
this.companiesClient = Suppliers.memoize(() -> new AsyncCompaniesClient(clientOptions));
this.entitlementsClient = Suppliers.memoize(() -> new AsyncEntitlementsClient(clientOptions));
@@ -126,6 +130,10 @@ public AsyncCreditsClient credits() {
return this.creditsClient.get();
}
+ public AsyncCatalogsClient catalogs() {
+ return this.catalogsClient.get();
+ }
+
public AsyncCheckoutClient checkout() {
return this.checkoutClient.get();
}
diff --git a/src/main/java/com/schematic/api/core/ClientOptions.java b/src/main/java/com/schematic/api/core/ClientOptions.java
index 15e79315..d48b7c89 100644
--- a/src/main/java/com/schematic/api/core/ClientOptions.java
+++ b/src/main/java/com/schematic/api/core/ClientOptions.java
@@ -38,10 +38,10 @@ private ClientOptions(
this.headers.putAll(headers);
this.headers.putAll(new HashMap() {
{
- put("User-Agent", "com.schematichq:schematic-java/1.5.1");
+ put("User-Agent", "com.schematichq:schematic-java/1.5.2");
put("X-Fern-Language", "JAVA");
put("X-Fern-SDK-Name", "com.schematic.fern:api-sdk");
- put("X-Fern-SDK-Version", "1.5.1");
+ put("X-Fern-SDK-Version", "1.5.2");
}
});
this.headerSuppliers = headerSuppliers;
diff --git a/src/main/java/com/schematic/api/resources/catalogs/AsyncCatalogsClient.java b/src/main/java/com/schematic/api/resources/catalogs/AsyncCatalogsClient.java
new file mode 100644
index 00000000..866f66db
--- /dev/null
+++ b/src/main/java/com/schematic/api/resources/catalogs/AsyncCatalogsClient.java
@@ -0,0 +1,196 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.schematic.api.resources.catalogs;
+
+import com.schematic.api.core.ClientOptions;
+import com.schematic.api.core.RequestOptions;
+import com.schematic.api.resources.catalogs.requests.CreateCatalogRequestBody;
+import com.schematic.api.resources.catalogs.requests.ListCatalogsRequest;
+import com.schematic.api.resources.catalogs.requests.UpdateCatalogConfigurationRequestBody;
+import com.schematic.api.resources.catalogs.requests.UpdateCatalogRequestBody;
+import com.schematic.api.resources.catalogs.types.CreateCatalogResponse;
+import com.schematic.api.resources.catalogs.types.DeleteCatalogResponse;
+import com.schematic.api.resources.catalogs.types.GetCatalogResponse;
+import com.schematic.api.resources.catalogs.types.GetConfigurationResponse;
+import com.schematic.api.resources.catalogs.types.GetCreditBundlesInCatalogResponse;
+import com.schematic.api.resources.catalogs.types.GetDerivedFeaturesResponse;
+import com.schematic.api.resources.catalogs.types.GetPlansInCatalogResponse;
+import com.schematic.api.resources.catalogs.types.ListCatalogsResponse;
+import com.schematic.api.resources.catalogs.types.UpdateCatalogResponse;
+import com.schematic.api.resources.catalogs.types.UpdateConfigurationResponse;
+import java.util.concurrent.CompletableFuture;
+
+public class AsyncCatalogsClient {
+ protected final ClientOptions clientOptions;
+
+ private final AsyncRawCatalogsClient rawClient;
+
+ public AsyncCatalogsClient(ClientOptions clientOptions) {
+ this.clientOptions = clientOptions;
+ this.rawClient = new AsyncRawCatalogsClient(clientOptions);
+ }
+
+ /**
+ * Get responses with HTTP metadata like headers
+ */
+ public AsyncRawCatalogsClient withRawResponse() {
+ return this.rawClient;
+ }
+
+ public CompletableFuture listCatalogs() {
+ return this.rawClient.listCatalogs().thenApply(response -> response.body());
+ }
+
+ public CompletableFuture listCatalogs(RequestOptions requestOptions) {
+ return this.rawClient.listCatalogs(requestOptions).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture listCatalogs(ListCatalogsRequest request) {
+ return this.rawClient.listCatalogs(request).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture listCatalogs(
+ ListCatalogsRequest request, RequestOptions requestOptions) {
+ return this.rawClient.listCatalogs(request, requestOptions).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture createCatalog(CreateCatalogRequestBody request) {
+ return this.rawClient.createCatalog(request).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture createCatalog(
+ CreateCatalogRequestBody request, RequestOptions requestOptions) {
+ return this.rawClient.createCatalog(request, requestOptions).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture getCatalog(String catalogId) {
+ return this.rawClient.getCatalog(catalogId).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture getCatalog(String catalogId, RequestOptions requestOptions) {
+ return this.rawClient.getCatalog(catalogId, requestOptions).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture updateCatalog(String catalogId) {
+ return this.rawClient.updateCatalog(catalogId).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture updateCatalog(String catalogId, RequestOptions requestOptions) {
+ return this.rawClient.updateCatalog(catalogId, requestOptions).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture updateCatalog(String catalogId, UpdateCatalogRequestBody request) {
+ return this.rawClient.updateCatalog(catalogId, request).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture updateCatalog(
+ String catalogId, UpdateCatalogRequestBody request, RequestOptions requestOptions) {
+ return this.rawClient.updateCatalog(catalogId, request, requestOptions).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture deleteCatalog(String catalogId) {
+ return this.rawClient.deleteCatalog(catalogId).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture deleteCatalog(String catalogId, RequestOptions requestOptions) {
+ return this.rawClient.deleteCatalog(catalogId, requestOptions).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture getConfiguration(String catalogId) {
+ return this.rawClient.getConfiguration(catalogId).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture getConfiguration(
+ String catalogId, RequestOptions requestOptions) {
+ return this.rawClient.getConfiguration(catalogId, requestOptions).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture updateConfiguration(String catalogId) {
+ return this.rawClient.updateConfiguration(catalogId).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture updateConfiguration(
+ String catalogId, RequestOptions requestOptions) {
+ return this.rawClient.updateConfiguration(catalogId, requestOptions).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture updateConfiguration(
+ String catalogId, UpdateCatalogConfigurationRequestBody request) {
+ return this.rawClient.updateConfiguration(catalogId, request).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture updateConfiguration(
+ String catalogId, UpdateCatalogConfigurationRequestBody request, RequestOptions requestOptions) {
+ return this.rawClient
+ .updateConfiguration(catalogId, request, requestOptions)
+ .thenApply(response -> response.body());
+ }
+
+ public CompletableFuture getCreditBundlesInCatalog(String catalogId) {
+ return this.rawClient.getCreditBundlesInCatalog(catalogId).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture getCreditBundlesInCatalog(
+ String catalogId, RequestOptions requestOptions) {
+ return this.rawClient
+ .getCreditBundlesInCatalog(catalogId, requestOptions)
+ .thenApply(response -> response.body());
+ }
+
+ public CompletableFuture addCreditBundle(String catalogId, String creditBundleId) {
+ return this.rawClient.addCreditBundle(catalogId, creditBundleId).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture addCreditBundle(
+ String catalogId, String creditBundleId, RequestOptions requestOptions) {
+ return this.rawClient
+ .addCreditBundle(catalogId, creditBundleId, requestOptions)
+ .thenApply(response -> response.body());
+ }
+
+ public CompletableFuture removeCreditBundle(String catalogId, String creditBundleId) {
+ return this.rawClient.removeCreditBundle(catalogId, creditBundleId).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture removeCreditBundle(
+ String catalogId, String creditBundleId, RequestOptions requestOptions) {
+ return this.rawClient
+ .removeCreditBundle(catalogId, creditBundleId, requestOptions)
+ .thenApply(response -> response.body());
+ }
+
+ public CompletableFuture getDerivedFeatures(String catalogId) {
+ return this.rawClient.getDerivedFeatures(catalogId).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture getDerivedFeatures(
+ String catalogId, RequestOptions requestOptions) {
+ return this.rawClient.getDerivedFeatures(catalogId, requestOptions).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture getPlansInCatalog(String catalogId) {
+ return this.rawClient.getPlansInCatalog(catalogId).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture getPlansInCatalog(
+ String catalogId, RequestOptions requestOptions) {
+ return this.rawClient.getPlansInCatalog(catalogId, requestOptions).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture addPlan(String catalogId, String planId) {
+ return this.rawClient.addPlan(catalogId, planId).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture addPlan(String catalogId, String planId, RequestOptions requestOptions) {
+ return this.rawClient.addPlan(catalogId, planId, requestOptions).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture removePlan(String catalogId, String planId) {
+ return this.rawClient.removePlan(catalogId, planId).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture removePlan(String catalogId, String planId, RequestOptions requestOptions) {
+ return this.rawClient.removePlan(catalogId, planId, requestOptions).thenApply(response -> response.body());
+ }
+}
diff --git a/src/main/java/com/schematic/api/resources/catalogs/AsyncRawCatalogsClient.java b/src/main/java/com/schematic/api/resources/catalogs/AsyncRawCatalogsClient.java
new file mode 100644
index 00000000..1fcd4f41
--- /dev/null
+++ b/src/main/java/com/schematic/api/resources/catalogs/AsyncRawCatalogsClient.java
@@ -0,0 +1,1472 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.schematic.api.resources.catalogs;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.schematic.api.core.BaseSchematicApiException;
+import com.schematic.api.core.BaseSchematicException;
+import com.schematic.api.core.BaseSchematicHttpResponse;
+import com.schematic.api.core.ClientOptions;
+import com.schematic.api.core.MediaTypes;
+import com.schematic.api.core.ObjectMappers;
+import com.schematic.api.core.QueryStringMapper;
+import com.schematic.api.core.RequestOptions;
+import com.schematic.api.core.RetryInterceptor;
+import com.schematic.api.errors.BadRequestError;
+import com.schematic.api.errors.ForbiddenError;
+import com.schematic.api.errors.InternalServerError;
+import com.schematic.api.errors.NotFoundError;
+import com.schematic.api.errors.UnauthorizedError;
+import com.schematic.api.resources.catalogs.requests.CreateCatalogRequestBody;
+import com.schematic.api.resources.catalogs.requests.ListCatalogsRequest;
+import com.schematic.api.resources.catalogs.requests.UpdateCatalogConfigurationRequestBody;
+import com.schematic.api.resources.catalogs.requests.UpdateCatalogRequestBody;
+import com.schematic.api.resources.catalogs.types.CreateCatalogResponse;
+import com.schematic.api.resources.catalogs.types.DeleteCatalogResponse;
+import com.schematic.api.resources.catalogs.types.GetCatalogResponse;
+import com.schematic.api.resources.catalogs.types.GetConfigurationResponse;
+import com.schematic.api.resources.catalogs.types.GetCreditBundlesInCatalogResponse;
+import com.schematic.api.resources.catalogs.types.GetDerivedFeaturesResponse;
+import com.schematic.api.resources.catalogs.types.GetPlansInCatalogResponse;
+import com.schematic.api.resources.catalogs.types.ListCatalogsResponse;
+import com.schematic.api.resources.catalogs.types.UpdateCatalogResponse;
+import com.schematic.api.resources.catalogs.types.UpdateConfigurationResponse;
+import com.schematic.api.types.ApiError;
+import java.io.IOException;
+import java.util.concurrent.CompletableFuture;
+import okhttp3.Call;
+import okhttp3.Callback;
+import okhttp3.Headers;
+import okhttp3.HttpUrl;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.RequestBody;
+import okhttp3.Response;
+import okhttp3.ResponseBody;
+import org.jetbrains.annotations.NotNull;
+
+public class AsyncRawCatalogsClient {
+ protected final ClientOptions clientOptions;
+
+ public AsyncRawCatalogsClient(ClientOptions clientOptions) {
+ this.clientOptions = clientOptions;
+ }
+
+ public CompletableFuture> listCatalogs() {
+ return listCatalogs(ListCatalogsRequest.builder().build());
+ }
+
+ public CompletableFuture> listCatalogs(
+ RequestOptions requestOptions) {
+ return listCatalogs(ListCatalogsRequest.builder().build(), requestOptions);
+ }
+
+ public CompletableFuture> listCatalogs(
+ ListCatalogsRequest request) {
+ return listCatalogs(request, null);
+ }
+
+ public CompletableFuture> listCatalogs(
+ ListCatalogsRequest request, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("catalogs");
+ if (request.getIsDefault().isPresent()) {
+ QueryStringMapper.addQueryParameter(
+ httpUrl, "is_default", request.getIsDefault().get(), false);
+ }
+ if (request.getQ().isPresent()) {
+ QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false);
+ }
+ if (request.getLimit().isPresent()) {
+ QueryStringMapper.addQueryParameter(
+ httpUrl, "limit", request.getLimit().get(), false);
+ }
+ if (request.getOffset().isPresent()) {
+ QueryStringMapper.addQueryParameter(
+ httpUrl, "offset", request.getOffset().get(), false);
+ }
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ Request.Builder _requestBuilder = new Request.Builder()
+ .url(httpUrl.build())
+ .method("GET", null)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json");
+ Request okhttpRequest = _requestBuilder.build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ CompletableFuture> future = new CompletableFuture<>();
+ client.newCall(okhttpRequest).enqueue(new Callback() {
+ @Override
+ public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
+ try (ResponseBody responseBody = response.body()) {
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ if (response.isSuccessful()) {
+ future.complete(new BaseSchematicHttpResponse<>(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListCatalogsResponse.class),
+ response));
+ return;
+ }
+ try {
+ switch (response.code()) {
+ case 400:
+ future.completeExceptionally(new BadRequestError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 401:
+ future.completeExceptionally(new UnauthorizedError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 403:
+ future.completeExceptionally(new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 404:
+ future.completeExceptionally(new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 500:
+ future.completeExceptionally(new InternalServerError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ future.completeExceptionally(new BaseSchematicApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response));
+ return;
+ } catch (JsonProcessingException e) {
+ future.completeExceptionally(
+ new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e));
+ } catch (IOException e) {
+ future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e));
+ }
+ }
+
+ @Override
+ public void onFailure(@NotNull Call call, @NotNull IOException e) {
+ future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e));
+ }
+ });
+ return future;
+ }
+
+ public CompletableFuture> createCatalog(
+ CreateCatalogRequestBody request) {
+ return createCatalog(request, null);
+ }
+
+ public CompletableFuture> createCatalog(
+ CreateCatalogRequestBody request, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("catalogs");
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ RequestBody body;
+ try {
+ body = RequestBody.create(
+ ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON);
+ } catch (JsonProcessingException e) {
+ throw new BaseSchematicException("Failed to serialize request", e);
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl.build())
+ .method("POST", body)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Content-Type", "application/json")
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ CompletableFuture> future = new CompletableFuture<>();
+ client.newCall(okhttpRequest).enqueue(new Callback() {
+ @Override
+ public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
+ try (ResponseBody responseBody = response.body()) {
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ if (response.isSuccessful()) {
+ future.complete(new BaseSchematicHttpResponse<>(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateCatalogResponse.class),
+ response));
+ return;
+ }
+ try {
+ switch (response.code()) {
+ case 400:
+ future.completeExceptionally(new BadRequestError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 401:
+ future.completeExceptionally(new UnauthorizedError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 403:
+ future.completeExceptionally(new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 404:
+ future.completeExceptionally(new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 500:
+ future.completeExceptionally(new InternalServerError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ future.completeExceptionally(new BaseSchematicApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response));
+ return;
+ } catch (JsonProcessingException e) {
+ future.completeExceptionally(
+ new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e));
+ } catch (IOException e) {
+ future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e));
+ }
+ }
+
+ @Override
+ public void onFailure(@NotNull Call call, @NotNull IOException e) {
+ future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e));
+ }
+ });
+ return future;
+ }
+
+ public CompletableFuture> getCatalog(String catalogId) {
+ return getCatalog(catalogId, null);
+ }
+
+ public CompletableFuture> getCatalog(
+ String catalogId, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("catalogs")
+ .addPathSegment(catalogId);
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl.build())
+ .method("GET", null)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ CompletableFuture> future = new CompletableFuture<>();
+ client.newCall(okhttpRequest).enqueue(new Callback() {
+ @Override
+ public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
+ try (ResponseBody responseBody = response.body()) {
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ if (response.isSuccessful()) {
+ future.complete(new BaseSchematicHttpResponse<>(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetCatalogResponse.class),
+ response));
+ return;
+ }
+ try {
+ switch (response.code()) {
+ case 401:
+ future.completeExceptionally(new UnauthorizedError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 403:
+ future.completeExceptionally(new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 404:
+ future.completeExceptionally(new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 500:
+ future.completeExceptionally(new InternalServerError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ future.completeExceptionally(new BaseSchematicApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response));
+ return;
+ } catch (JsonProcessingException e) {
+ future.completeExceptionally(
+ new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e));
+ } catch (IOException e) {
+ future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e));
+ }
+ }
+
+ @Override
+ public void onFailure(@NotNull Call call, @NotNull IOException e) {
+ future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e));
+ }
+ });
+ return future;
+ }
+
+ public CompletableFuture> updateCatalog(String catalogId) {
+ return updateCatalog(catalogId, UpdateCatalogRequestBody.builder().build());
+ }
+
+ public CompletableFuture> updateCatalog(
+ String catalogId, RequestOptions requestOptions) {
+ return updateCatalog(catalogId, UpdateCatalogRequestBody.builder().build(), requestOptions);
+ }
+
+ public CompletableFuture> updateCatalog(
+ String catalogId, UpdateCatalogRequestBody request) {
+ return updateCatalog(catalogId, request, null);
+ }
+
+ public CompletableFuture> updateCatalog(
+ String catalogId, UpdateCatalogRequestBody request, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("catalogs")
+ .addPathSegment(catalogId);
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ RequestBody body;
+ try {
+ body = RequestBody.create(
+ ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON);
+ } catch (JsonProcessingException e) {
+ throw new BaseSchematicException("Failed to serialize request", e);
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl.build())
+ .method("PUT", body)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Content-Type", "application/json")
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ CompletableFuture> future = new CompletableFuture<>();
+ client.newCall(okhttpRequest).enqueue(new Callback() {
+ @Override
+ public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
+ try (ResponseBody responseBody = response.body()) {
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ if (response.isSuccessful()) {
+ future.complete(new BaseSchematicHttpResponse<>(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateCatalogResponse.class),
+ response));
+ return;
+ }
+ try {
+ switch (response.code()) {
+ case 400:
+ future.completeExceptionally(new BadRequestError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 401:
+ future.completeExceptionally(new UnauthorizedError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 403:
+ future.completeExceptionally(new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 404:
+ future.completeExceptionally(new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 500:
+ future.completeExceptionally(new InternalServerError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ future.completeExceptionally(new BaseSchematicApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response));
+ return;
+ } catch (JsonProcessingException e) {
+ future.completeExceptionally(
+ new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e));
+ } catch (IOException e) {
+ future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e));
+ }
+ }
+
+ @Override
+ public void onFailure(@NotNull Call call, @NotNull IOException e) {
+ future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e));
+ }
+ });
+ return future;
+ }
+
+ public CompletableFuture> deleteCatalog(String catalogId) {
+ return deleteCatalog(catalogId, null);
+ }
+
+ public CompletableFuture> deleteCatalog(
+ String catalogId, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("catalogs")
+ .addPathSegment(catalogId);
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl.build())
+ .method("DELETE", null)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ CompletableFuture> future = new CompletableFuture<>();
+ client.newCall(okhttpRequest).enqueue(new Callback() {
+ @Override
+ public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
+ try (ResponseBody responseBody = response.body()) {
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ if (response.isSuccessful()) {
+ future.complete(new BaseSchematicHttpResponse<>(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteCatalogResponse.class),
+ response));
+ return;
+ }
+ try {
+ switch (response.code()) {
+ case 400:
+ future.completeExceptionally(new BadRequestError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 401:
+ future.completeExceptionally(new UnauthorizedError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 403:
+ future.completeExceptionally(new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 404:
+ future.completeExceptionally(new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 500:
+ future.completeExceptionally(new InternalServerError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ future.completeExceptionally(new BaseSchematicApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response));
+ return;
+ } catch (JsonProcessingException e) {
+ future.completeExceptionally(
+ new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e));
+ } catch (IOException e) {
+ future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e));
+ }
+ }
+
+ @Override
+ public void onFailure(@NotNull Call call, @NotNull IOException e) {
+ future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e));
+ }
+ });
+ return future;
+ }
+
+ public CompletableFuture> getConfiguration(String catalogId) {
+ return getConfiguration(catalogId, null);
+ }
+
+ public CompletableFuture> getConfiguration(
+ String catalogId, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("catalogs")
+ .addPathSegment(catalogId)
+ .addPathSegments("configuration");
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl.build())
+ .method("GET", null)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ CompletableFuture> future = new CompletableFuture<>();
+ client.newCall(okhttpRequest).enqueue(new Callback() {
+ @Override
+ public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
+ try (ResponseBody responseBody = response.body()) {
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ if (response.isSuccessful()) {
+ future.complete(new BaseSchematicHttpResponse<>(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetConfigurationResponse.class),
+ response));
+ return;
+ }
+ try {
+ switch (response.code()) {
+ case 401:
+ future.completeExceptionally(new UnauthorizedError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 403:
+ future.completeExceptionally(new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 404:
+ future.completeExceptionally(new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 500:
+ future.completeExceptionally(new InternalServerError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ future.completeExceptionally(new BaseSchematicApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response));
+ return;
+ } catch (JsonProcessingException e) {
+ future.completeExceptionally(
+ new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e));
+ } catch (IOException e) {
+ future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e));
+ }
+ }
+
+ @Override
+ public void onFailure(@NotNull Call call, @NotNull IOException e) {
+ future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e));
+ }
+ });
+ return future;
+ }
+
+ public CompletableFuture> updateConfiguration(
+ String catalogId) {
+ return updateConfiguration(
+ catalogId, UpdateCatalogConfigurationRequestBody.builder().build());
+ }
+
+ public CompletableFuture> updateConfiguration(
+ String catalogId, RequestOptions requestOptions) {
+ return updateConfiguration(
+ catalogId, UpdateCatalogConfigurationRequestBody.builder().build(), requestOptions);
+ }
+
+ public CompletableFuture> updateConfiguration(
+ String catalogId, UpdateCatalogConfigurationRequestBody request) {
+ return updateConfiguration(catalogId, request, null);
+ }
+
+ public CompletableFuture> updateConfiguration(
+ String catalogId, UpdateCatalogConfigurationRequestBody request, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("catalogs")
+ .addPathSegment(catalogId)
+ .addPathSegments("configuration");
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ RequestBody body;
+ try {
+ body = RequestBody.create(
+ ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON);
+ } catch (JsonProcessingException e) {
+ throw new BaseSchematicException("Failed to serialize request", e);
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl.build())
+ .method("PUT", body)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Content-Type", "application/json")
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ CompletableFuture> future = new CompletableFuture<>();
+ client.newCall(okhttpRequest).enqueue(new Callback() {
+ @Override
+ public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
+ try (ResponseBody responseBody = response.body()) {
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ if (response.isSuccessful()) {
+ future.complete(new BaseSchematicHttpResponse<>(
+ ObjectMappers.JSON_MAPPER.readValue(
+ responseBodyString, UpdateConfigurationResponse.class),
+ response));
+ return;
+ }
+ try {
+ switch (response.code()) {
+ case 400:
+ future.completeExceptionally(new BadRequestError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 401:
+ future.completeExceptionally(new UnauthorizedError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 403:
+ future.completeExceptionally(new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 404:
+ future.completeExceptionally(new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 500:
+ future.completeExceptionally(new InternalServerError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ future.completeExceptionally(new BaseSchematicApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response));
+ return;
+ } catch (JsonProcessingException e) {
+ future.completeExceptionally(
+ new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e));
+ } catch (IOException e) {
+ future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e));
+ }
+ }
+
+ @Override
+ public void onFailure(@NotNull Call call, @NotNull IOException e) {
+ future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e));
+ }
+ });
+ return future;
+ }
+
+ public CompletableFuture> getCreditBundlesInCatalog(
+ String catalogId) {
+ return getCreditBundlesInCatalog(catalogId, null);
+ }
+
+ public CompletableFuture> getCreditBundlesInCatalog(
+ String catalogId, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("catalogs")
+ .addPathSegment(catalogId)
+ .addPathSegments("credit-bundles");
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl.build())
+ .method("GET", null)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ CompletableFuture> future =
+ new CompletableFuture<>();
+ client.newCall(okhttpRequest).enqueue(new Callback() {
+ @Override
+ public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
+ try (ResponseBody responseBody = response.body()) {
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ if (response.isSuccessful()) {
+ future.complete(new BaseSchematicHttpResponse<>(
+ ObjectMappers.JSON_MAPPER.readValue(
+ responseBodyString, GetCreditBundlesInCatalogResponse.class),
+ response));
+ return;
+ }
+ try {
+ switch (response.code()) {
+ case 401:
+ future.completeExceptionally(new UnauthorizedError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 403:
+ future.completeExceptionally(new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 404:
+ future.completeExceptionally(new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 500:
+ future.completeExceptionally(new InternalServerError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ future.completeExceptionally(new BaseSchematicApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response));
+ return;
+ } catch (JsonProcessingException e) {
+ future.completeExceptionally(
+ new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e));
+ } catch (IOException e) {
+ future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e));
+ }
+ }
+
+ @Override
+ public void onFailure(@NotNull Call call, @NotNull IOException e) {
+ future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e));
+ }
+ });
+ return future;
+ }
+
+ public CompletableFuture> addCreditBundle(String catalogId, String creditBundleId) {
+ return addCreditBundle(catalogId, creditBundleId, null);
+ }
+
+ public CompletableFuture> addCreditBundle(
+ String catalogId, String creditBundleId, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("catalogs")
+ .addPathSegment(catalogId)
+ .addPathSegments("credit-bundles")
+ .addPathSegment(creditBundleId);
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl.build())
+ .method("POST", RequestBody.create("", null))
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ CompletableFuture> future = new CompletableFuture<>();
+ client.newCall(okhttpRequest).enqueue(new Callback() {
+ @Override
+ public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
+ try (ResponseBody responseBody = response.body()) {
+ if (response.isSuccessful()) {
+ future.complete(new BaseSchematicHttpResponse<>(null, response));
+ return;
+ }
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ switch (response.code()) {
+ case 400:
+ future.completeExceptionally(new BadRequestError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 401:
+ future.completeExceptionally(new UnauthorizedError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 403:
+ future.completeExceptionally(new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 404:
+ future.completeExceptionally(new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 500:
+ future.completeExceptionally(new InternalServerError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ future.completeExceptionally(new BaseSchematicApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response));
+ return;
+ } catch (JsonProcessingException e) {
+ future.completeExceptionally(
+ new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e));
+ } catch (IOException e) {
+ future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e));
+ }
+ }
+
+ @Override
+ public void onFailure(@NotNull Call call, @NotNull IOException e) {
+ future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e));
+ }
+ });
+ return future;
+ }
+
+ public CompletableFuture> removeCreditBundle(
+ String catalogId, String creditBundleId) {
+ return removeCreditBundle(catalogId, creditBundleId, null);
+ }
+
+ public CompletableFuture> removeCreditBundle(
+ String catalogId, String creditBundleId, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("catalogs")
+ .addPathSegment(catalogId)
+ .addPathSegments("credit-bundles")
+ .addPathSegment(creditBundleId);
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl.build())
+ .method("DELETE", null)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ CompletableFuture> future = new CompletableFuture<>();
+ client.newCall(okhttpRequest).enqueue(new Callback() {
+ @Override
+ public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
+ try (ResponseBody responseBody = response.body()) {
+ if (response.isSuccessful()) {
+ future.complete(new BaseSchematicHttpResponse<>(null, response));
+ return;
+ }
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ switch (response.code()) {
+ case 400:
+ future.completeExceptionally(new BadRequestError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 401:
+ future.completeExceptionally(new UnauthorizedError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 403:
+ future.completeExceptionally(new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 404:
+ future.completeExceptionally(new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 500:
+ future.completeExceptionally(new InternalServerError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ future.completeExceptionally(new BaseSchematicApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response));
+ return;
+ } catch (JsonProcessingException e) {
+ future.completeExceptionally(
+ new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e));
+ } catch (IOException e) {
+ future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e));
+ }
+ }
+
+ @Override
+ public void onFailure(@NotNull Call call, @NotNull IOException e) {
+ future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e));
+ }
+ });
+ return future;
+ }
+
+ public CompletableFuture> getDerivedFeatures(
+ String catalogId) {
+ return getDerivedFeatures(catalogId, null);
+ }
+
+ public CompletableFuture> getDerivedFeatures(
+ String catalogId, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("catalogs")
+ .addPathSegment(catalogId)
+ .addPathSegments("features");
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl.build())
+ .method("GET", null)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ CompletableFuture> future = new CompletableFuture<>();
+ client.newCall(okhttpRequest).enqueue(new Callback() {
+ @Override
+ public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
+ try (ResponseBody responseBody = response.body()) {
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ if (response.isSuccessful()) {
+ future.complete(new BaseSchematicHttpResponse<>(
+ ObjectMappers.JSON_MAPPER.readValue(
+ responseBodyString, GetDerivedFeaturesResponse.class),
+ response));
+ return;
+ }
+ try {
+ switch (response.code()) {
+ case 401:
+ future.completeExceptionally(new UnauthorizedError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 403:
+ future.completeExceptionally(new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 404:
+ future.completeExceptionally(new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 500:
+ future.completeExceptionally(new InternalServerError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ future.completeExceptionally(new BaseSchematicApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response));
+ return;
+ } catch (JsonProcessingException e) {
+ future.completeExceptionally(
+ new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e));
+ } catch (IOException e) {
+ future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e));
+ }
+ }
+
+ @Override
+ public void onFailure(@NotNull Call call, @NotNull IOException e) {
+ future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e));
+ }
+ });
+ return future;
+ }
+
+ public CompletableFuture> getPlansInCatalog(String catalogId) {
+ return getPlansInCatalog(catalogId, null);
+ }
+
+ public CompletableFuture> getPlansInCatalog(
+ String catalogId, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("catalogs")
+ .addPathSegment(catalogId)
+ .addPathSegments("plans");
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl.build())
+ .method("GET", null)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ CompletableFuture> future = new CompletableFuture<>();
+ client.newCall(okhttpRequest).enqueue(new Callback() {
+ @Override
+ public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
+ try (ResponseBody responseBody = response.body()) {
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ if (response.isSuccessful()) {
+ future.complete(new BaseSchematicHttpResponse<>(
+ ObjectMappers.JSON_MAPPER.readValue(
+ responseBodyString, GetPlansInCatalogResponse.class),
+ response));
+ return;
+ }
+ try {
+ switch (response.code()) {
+ case 401:
+ future.completeExceptionally(new UnauthorizedError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 403:
+ future.completeExceptionally(new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 404:
+ future.completeExceptionally(new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 500:
+ future.completeExceptionally(new InternalServerError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ future.completeExceptionally(new BaseSchematicApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response));
+ return;
+ } catch (JsonProcessingException e) {
+ future.completeExceptionally(
+ new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e));
+ } catch (IOException e) {
+ future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e));
+ }
+ }
+
+ @Override
+ public void onFailure(@NotNull Call call, @NotNull IOException e) {
+ future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e));
+ }
+ });
+ return future;
+ }
+
+ public CompletableFuture> addPlan(String catalogId, String planId) {
+ return addPlan(catalogId, planId, null);
+ }
+
+ public CompletableFuture> addPlan(
+ String catalogId, String planId, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("catalogs")
+ .addPathSegment(catalogId)
+ .addPathSegments("plans")
+ .addPathSegment(planId);
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl.build())
+ .method("POST", RequestBody.create("", null))
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ CompletableFuture> future = new CompletableFuture<>();
+ client.newCall(okhttpRequest).enqueue(new Callback() {
+ @Override
+ public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
+ try (ResponseBody responseBody = response.body()) {
+ if (response.isSuccessful()) {
+ future.complete(new BaseSchematicHttpResponse<>(null, response));
+ return;
+ }
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ switch (response.code()) {
+ case 400:
+ future.completeExceptionally(new BadRequestError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 401:
+ future.completeExceptionally(new UnauthorizedError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 403:
+ future.completeExceptionally(new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 404:
+ future.completeExceptionally(new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 500:
+ future.completeExceptionally(new InternalServerError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ future.completeExceptionally(new BaseSchematicApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response));
+ return;
+ } catch (JsonProcessingException e) {
+ future.completeExceptionally(
+ new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e));
+ } catch (IOException e) {
+ future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e));
+ }
+ }
+
+ @Override
+ public void onFailure(@NotNull Call call, @NotNull IOException e) {
+ future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e));
+ }
+ });
+ return future;
+ }
+
+ public CompletableFuture> removePlan(String catalogId, String planId) {
+ return removePlan(catalogId, planId, null);
+ }
+
+ public CompletableFuture> removePlan(
+ String catalogId, String planId, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("catalogs")
+ .addPathSegment(catalogId)
+ .addPathSegments("plans")
+ .addPathSegment(planId);
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl.build())
+ .method("DELETE", null)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ CompletableFuture> future = new CompletableFuture<>();
+ client.newCall(okhttpRequest).enqueue(new Callback() {
+ @Override
+ public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
+ try (ResponseBody responseBody = response.body()) {
+ if (response.isSuccessful()) {
+ future.complete(new BaseSchematicHttpResponse<>(null, response));
+ return;
+ }
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ switch (response.code()) {
+ case 400:
+ future.completeExceptionally(new BadRequestError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 401:
+ future.completeExceptionally(new UnauthorizedError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 403:
+ future.completeExceptionally(new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 404:
+ future.completeExceptionally(new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ case 500:
+ future.completeExceptionally(new InternalServerError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class),
+ response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ future.completeExceptionally(new BaseSchematicApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response));
+ return;
+ } catch (JsonProcessingException e) {
+ future.completeExceptionally(
+ new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e));
+ } catch (IOException e) {
+ future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e));
+ }
+ }
+
+ @Override
+ public void onFailure(@NotNull Call call, @NotNull IOException e) {
+ future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e));
+ }
+ });
+ return future;
+ }
+}
diff --git a/src/main/java/com/schematic/api/resources/catalogs/CatalogsClient.java b/src/main/java/com/schematic/api/resources/catalogs/CatalogsClient.java
new file mode 100644
index 00000000..6169b106
--- /dev/null
+++ b/src/main/java/com/schematic/api/resources/catalogs/CatalogsClient.java
@@ -0,0 +1,187 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.schematic.api.resources.catalogs;
+
+import com.schematic.api.core.ClientOptions;
+import com.schematic.api.core.RequestOptions;
+import com.schematic.api.resources.catalogs.requests.CreateCatalogRequestBody;
+import com.schematic.api.resources.catalogs.requests.ListCatalogsRequest;
+import com.schematic.api.resources.catalogs.requests.UpdateCatalogConfigurationRequestBody;
+import com.schematic.api.resources.catalogs.requests.UpdateCatalogRequestBody;
+import com.schematic.api.resources.catalogs.types.CreateCatalogResponse;
+import com.schematic.api.resources.catalogs.types.DeleteCatalogResponse;
+import com.schematic.api.resources.catalogs.types.GetCatalogResponse;
+import com.schematic.api.resources.catalogs.types.GetConfigurationResponse;
+import com.schematic.api.resources.catalogs.types.GetCreditBundlesInCatalogResponse;
+import com.schematic.api.resources.catalogs.types.GetDerivedFeaturesResponse;
+import com.schematic.api.resources.catalogs.types.GetPlansInCatalogResponse;
+import com.schematic.api.resources.catalogs.types.ListCatalogsResponse;
+import com.schematic.api.resources.catalogs.types.UpdateCatalogResponse;
+import com.schematic.api.resources.catalogs.types.UpdateConfigurationResponse;
+
+public class CatalogsClient {
+ protected final ClientOptions clientOptions;
+
+ private final RawCatalogsClient rawClient;
+
+ public CatalogsClient(ClientOptions clientOptions) {
+ this.clientOptions = clientOptions;
+ this.rawClient = new RawCatalogsClient(clientOptions);
+ }
+
+ /**
+ * Get responses with HTTP metadata like headers
+ */
+ public RawCatalogsClient withRawResponse() {
+ return this.rawClient;
+ }
+
+ public ListCatalogsResponse listCatalogs() {
+ return this.rawClient.listCatalogs().body();
+ }
+
+ public ListCatalogsResponse listCatalogs(RequestOptions requestOptions) {
+ return this.rawClient.listCatalogs(requestOptions).body();
+ }
+
+ public ListCatalogsResponse listCatalogs(ListCatalogsRequest request) {
+ return this.rawClient.listCatalogs(request).body();
+ }
+
+ public ListCatalogsResponse listCatalogs(ListCatalogsRequest request, RequestOptions requestOptions) {
+ return this.rawClient.listCatalogs(request, requestOptions).body();
+ }
+
+ public CreateCatalogResponse createCatalog(CreateCatalogRequestBody request) {
+ return this.rawClient.createCatalog(request).body();
+ }
+
+ public CreateCatalogResponse createCatalog(CreateCatalogRequestBody request, RequestOptions requestOptions) {
+ return this.rawClient.createCatalog(request, requestOptions).body();
+ }
+
+ public GetCatalogResponse getCatalog(String catalogId) {
+ return this.rawClient.getCatalog(catalogId).body();
+ }
+
+ public GetCatalogResponse getCatalog(String catalogId, RequestOptions requestOptions) {
+ return this.rawClient.getCatalog(catalogId, requestOptions).body();
+ }
+
+ public UpdateCatalogResponse updateCatalog(String catalogId) {
+ return this.rawClient.updateCatalog(catalogId).body();
+ }
+
+ public UpdateCatalogResponse updateCatalog(String catalogId, RequestOptions requestOptions) {
+ return this.rawClient.updateCatalog(catalogId, requestOptions).body();
+ }
+
+ public UpdateCatalogResponse updateCatalog(String catalogId, UpdateCatalogRequestBody request) {
+ return this.rawClient.updateCatalog(catalogId, request).body();
+ }
+
+ public UpdateCatalogResponse updateCatalog(
+ String catalogId, UpdateCatalogRequestBody request, RequestOptions requestOptions) {
+ return this.rawClient.updateCatalog(catalogId, request, requestOptions).body();
+ }
+
+ public DeleteCatalogResponse deleteCatalog(String catalogId) {
+ return this.rawClient.deleteCatalog(catalogId).body();
+ }
+
+ public DeleteCatalogResponse deleteCatalog(String catalogId, RequestOptions requestOptions) {
+ return this.rawClient.deleteCatalog(catalogId, requestOptions).body();
+ }
+
+ public GetConfigurationResponse getConfiguration(String catalogId) {
+ return this.rawClient.getConfiguration(catalogId).body();
+ }
+
+ public GetConfigurationResponse getConfiguration(String catalogId, RequestOptions requestOptions) {
+ return this.rawClient.getConfiguration(catalogId, requestOptions).body();
+ }
+
+ public UpdateConfigurationResponse updateConfiguration(String catalogId) {
+ return this.rawClient.updateConfiguration(catalogId).body();
+ }
+
+ public UpdateConfigurationResponse updateConfiguration(String catalogId, RequestOptions requestOptions) {
+ return this.rawClient.updateConfiguration(catalogId, requestOptions).body();
+ }
+
+ public UpdateConfigurationResponse updateConfiguration(
+ String catalogId, UpdateCatalogConfigurationRequestBody request) {
+ return this.rawClient.updateConfiguration(catalogId, request).body();
+ }
+
+ public UpdateConfigurationResponse updateConfiguration(
+ String catalogId, UpdateCatalogConfigurationRequestBody request, RequestOptions requestOptions) {
+ return this.rawClient
+ .updateConfiguration(catalogId, request, requestOptions)
+ .body();
+ }
+
+ public GetCreditBundlesInCatalogResponse getCreditBundlesInCatalog(String catalogId) {
+ return this.rawClient.getCreditBundlesInCatalog(catalogId).body();
+ }
+
+ public GetCreditBundlesInCatalogResponse getCreditBundlesInCatalog(
+ String catalogId, RequestOptions requestOptions) {
+ return this.rawClient
+ .getCreditBundlesInCatalog(catalogId, requestOptions)
+ .body();
+ }
+
+ public void addCreditBundle(String catalogId, String creditBundleId) {
+ this.rawClient.addCreditBundle(catalogId, creditBundleId).body();
+ }
+
+ public void addCreditBundle(String catalogId, String creditBundleId, RequestOptions requestOptions) {
+ this.rawClient
+ .addCreditBundle(catalogId, creditBundleId, requestOptions)
+ .body();
+ }
+
+ public void removeCreditBundle(String catalogId, String creditBundleId) {
+ this.rawClient.removeCreditBundle(catalogId, creditBundleId).body();
+ }
+
+ public void removeCreditBundle(String catalogId, String creditBundleId, RequestOptions requestOptions) {
+ this.rawClient
+ .removeCreditBundle(catalogId, creditBundleId, requestOptions)
+ .body();
+ }
+
+ public GetDerivedFeaturesResponse getDerivedFeatures(String catalogId) {
+ return this.rawClient.getDerivedFeatures(catalogId).body();
+ }
+
+ public GetDerivedFeaturesResponse getDerivedFeatures(String catalogId, RequestOptions requestOptions) {
+ return this.rawClient.getDerivedFeatures(catalogId, requestOptions).body();
+ }
+
+ public GetPlansInCatalogResponse getPlansInCatalog(String catalogId) {
+ return this.rawClient.getPlansInCatalog(catalogId).body();
+ }
+
+ public GetPlansInCatalogResponse getPlansInCatalog(String catalogId, RequestOptions requestOptions) {
+ return this.rawClient.getPlansInCatalog(catalogId, requestOptions).body();
+ }
+
+ public void addPlan(String catalogId, String planId) {
+ this.rawClient.addPlan(catalogId, planId).body();
+ }
+
+ public void addPlan(String catalogId, String planId, RequestOptions requestOptions) {
+ this.rawClient.addPlan(catalogId, planId, requestOptions).body();
+ }
+
+ public void removePlan(String catalogId, String planId) {
+ this.rawClient.removePlan(catalogId, planId).body();
+ }
+
+ public void removePlan(String catalogId, String planId, RequestOptions requestOptions) {
+ this.rawClient.removePlan(catalogId, planId, requestOptions).body();
+ }
+}
diff --git a/src/main/java/com/schematic/api/resources/catalogs/RawCatalogsClient.java b/src/main/java/com/schematic/api/resources/catalogs/RawCatalogsClient.java
new file mode 100644
index 00000000..73be9e22
--- /dev/null
+++ b/src/main/java/com/schematic/api/resources/catalogs/RawCatalogsClient.java
@@ -0,0 +1,1123 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.schematic.api.resources.catalogs;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.schematic.api.core.BaseSchematicApiException;
+import com.schematic.api.core.BaseSchematicException;
+import com.schematic.api.core.BaseSchematicHttpResponse;
+import com.schematic.api.core.ClientOptions;
+import com.schematic.api.core.MediaTypes;
+import com.schematic.api.core.ObjectMappers;
+import com.schematic.api.core.QueryStringMapper;
+import com.schematic.api.core.RequestOptions;
+import com.schematic.api.core.RetryInterceptor;
+import com.schematic.api.errors.BadRequestError;
+import com.schematic.api.errors.ForbiddenError;
+import com.schematic.api.errors.InternalServerError;
+import com.schematic.api.errors.NotFoundError;
+import com.schematic.api.errors.UnauthorizedError;
+import com.schematic.api.resources.catalogs.requests.CreateCatalogRequestBody;
+import com.schematic.api.resources.catalogs.requests.ListCatalogsRequest;
+import com.schematic.api.resources.catalogs.requests.UpdateCatalogConfigurationRequestBody;
+import com.schematic.api.resources.catalogs.requests.UpdateCatalogRequestBody;
+import com.schematic.api.resources.catalogs.types.CreateCatalogResponse;
+import com.schematic.api.resources.catalogs.types.DeleteCatalogResponse;
+import com.schematic.api.resources.catalogs.types.GetCatalogResponse;
+import com.schematic.api.resources.catalogs.types.GetConfigurationResponse;
+import com.schematic.api.resources.catalogs.types.GetCreditBundlesInCatalogResponse;
+import com.schematic.api.resources.catalogs.types.GetDerivedFeaturesResponse;
+import com.schematic.api.resources.catalogs.types.GetPlansInCatalogResponse;
+import com.schematic.api.resources.catalogs.types.ListCatalogsResponse;
+import com.schematic.api.resources.catalogs.types.UpdateCatalogResponse;
+import com.schematic.api.resources.catalogs.types.UpdateConfigurationResponse;
+import com.schematic.api.types.ApiError;
+import java.io.IOException;
+import okhttp3.Headers;
+import okhttp3.HttpUrl;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.RequestBody;
+import okhttp3.Response;
+import okhttp3.ResponseBody;
+
+public class RawCatalogsClient {
+ protected final ClientOptions clientOptions;
+
+ public RawCatalogsClient(ClientOptions clientOptions) {
+ this.clientOptions = clientOptions;
+ }
+
+ public BaseSchematicHttpResponse listCatalogs() {
+ return listCatalogs(ListCatalogsRequest.builder().build());
+ }
+
+ public BaseSchematicHttpResponse listCatalogs(RequestOptions requestOptions) {
+ return listCatalogs(ListCatalogsRequest.builder().build(), requestOptions);
+ }
+
+ public BaseSchematicHttpResponse listCatalogs(ListCatalogsRequest request) {
+ return listCatalogs(request, null);
+ }
+
+ public BaseSchematicHttpResponse listCatalogs(
+ ListCatalogsRequest request, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("catalogs");
+ if (request.getIsDefault().isPresent()) {
+ QueryStringMapper.addQueryParameter(
+ httpUrl, "is_default", request.getIsDefault().get(), false);
+ }
+ if (request.getQ().isPresent()) {
+ QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false);
+ }
+ if (request.getLimit().isPresent()) {
+ QueryStringMapper.addQueryParameter(
+ httpUrl, "limit", request.getLimit().get(), false);
+ }
+ if (request.getOffset().isPresent()) {
+ QueryStringMapper.addQueryParameter(
+ httpUrl, "offset", request.getOffset().get(), false);
+ }
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ Request.Builder _requestBuilder = new Request.Builder()
+ .url(httpUrl.build())
+ .method("GET", null)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json");
+ Request okhttpRequest = _requestBuilder.build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ try (Response response = client.newCall(okhttpRequest).execute()) {
+ ResponseBody responseBody = response.body();
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ if (response.isSuccessful()) {
+ return new BaseSchematicHttpResponse<>(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListCatalogsResponse.class), response);
+ }
+ try {
+ switch (response.code()) {
+ case 400:
+ throw new BadRequestError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 401:
+ throw new UnauthorizedError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 403:
+ throw new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 404:
+ throw new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 500:
+ throw new InternalServerError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ throw new BaseSchematicApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response);
+ } catch (JsonProcessingException e) {
+ throw new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e);
+ } catch (IOException e) {
+ throw new BaseSchematicException("Network error executing HTTP request", e);
+ }
+ }
+
+ public BaseSchematicHttpResponse createCatalog(CreateCatalogRequestBody request) {
+ return createCatalog(request, null);
+ }
+
+ public BaseSchematicHttpResponse createCatalog(
+ CreateCatalogRequestBody request, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("catalogs");
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ RequestBody body;
+ try {
+ body = RequestBody.create(
+ ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON);
+ } catch (JsonProcessingException e) {
+ throw new BaseSchematicException("Failed to serialize request", e);
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl.build())
+ .method("POST", body)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Content-Type", "application/json")
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ try (Response response = client.newCall(okhttpRequest).execute()) {
+ ResponseBody responseBody = response.body();
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ if (response.isSuccessful()) {
+ return new BaseSchematicHttpResponse<>(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateCatalogResponse.class), response);
+ }
+ try {
+ switch (response.code()) {
+ case 400:
+ throw new BadRequestError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 401:
+ throw new UnauthorizedError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 403:
+ throw new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 404:
+ throw new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 500:
+ throw new InternalServerError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ throw new BaseSchematicApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response);
+ } catch (JsonProcessingException e) {
+ throw new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e);
+ } catch (IOException e) {
+ throw new BaseSchematicException("Network error executing HTTP request", e);
+ }
+ }
+
+ public BaseSchematicHttpResponse getCatalog(String catalogId) {
+ return getCatalog(catalogId, null);
+ }
+
+ public BaseSchematicHttpResponse getCatalog(String catalogId, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("catalogs")
+ .addPathSegment(catalogId);
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl.build())
+ .method("GET", null)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ try (Response response = client.newCall(okhttpRequest).execute()) {
+ ResponseBody responseBody = response.body();
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ if (response.isSuccessful()) {
+ return new BaseSchematicHttpResponse<>(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetCatalogResponse.class), response);
+ }
+ try {
+ switch (response.code()) {
+ case 401:
+ throw new UnauthorizedError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 403:
+ throw new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 404:
+ throw new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 500:
+ throw new InternalServerError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ throw new BaseSchematicApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response);
+ } catch (JsonProcessingException e) {
+ throw new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e);
+ } catch (IOException e) {
+ throw new BaseSchematicException("Network error executing HTTP request", e);
+ }
+ }
+
+ public BaseSchematicHttpResponse updateCatalog(String catalogId) {
+ return updateCatalog(catalogId, UpdateCatalogRequestBody.builder().build());
+ }
+
+ public BaseSchematicHttpResponse updateCatalog(
+ String catalogId, RequestOptions requestOptions) {
+ return updateCatalog(catalogId, UpdateCatalogRequestBody.builder().build(), requestOptions);
+ }
+
+ public BaseSchematicHttpResponse updateCatalog(
+ String catalogId, UpdateCatalogRequestBody request) {
+ return updateCatalog(catalogId, request, null);
+ }
+
+ public BaseSchematicHttpResponse updateCatalog(
+ String catalogId, UpdateCatalogRequestBody request, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("catalogs")
+ .addPathSegment(catalogId);
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ RequestBody body;
+ try {
+ body = RequestBody.create(
+ ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON);
+ } catch (JsonProcessingException e) {
+ throw new BaseSchematicException("Failed to serialize request", e);
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl.build())
+ .method("PUT", body)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Content-Type", "application/json")
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ try (Response response = client.newCall(okhttpRequest).execute()) {
+ ResponseBody responseBody = response.body();
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ if (response.isSuccessful()) {
+ return new BaseSchematicHttpResponse<>(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateCatalogResponse.class), response);
+ }
+ try {
+ switch (response.code()) {
+ case 400:
+ throw new BadRequestError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 401:
+ throw new UnauthorizedError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 403:
+ throw new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 404:
+ throw new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 500:
+ throw new InternalServerError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ throw new BaseSchematicApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response);
+ } catch (JsonProcessingException e) {
+ throw new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e);
+ } catch (IOException e) {
+ throw new BaseSchematicException("Network error executing HTTP request", e);
+ }
+ }
+
+ public BaseSchematicHttpResponse deleteCatalog(String catalogId) {
+ return deleteCatalog(catalogId, null);
+ }
+
+ public BaseSchematicHttpResponse deleteCatalog(
+ String catalogId, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("catalogs")
+ .addPathSegment(catalogId);
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl.build())
+ .method("DELETE", null)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ try (Response response = client.newCall(okhttpRequest).execute()) {
+ ResponseBody responseBody = response.body();
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ if (response.isSuccessful()) {
+ return new BaseSchematicHttpResponse<>(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteCatalogResponse.class), response);
+ }
+ try {
+ switch (response.code()) {
+ case 400:
+ throw new BadRequestError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 401:
+ throw new UnauthorizedError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 403:
+ throw new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 404:
+ throw new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 500:
+ throw new InternalServerError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ throw new BaseSchematicApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response);
+ } catch (JsonProcessingException e) {
+ throw new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e);
+ } catch (IOException e) {
+ throw new BaseSchematicException("Network error executing HTTP request", e);
+ }
+ }
+
+ public BaseSchematicHttpResponse getConfiguration(String catalogId) {
+ return getConfiguration(catalogId, null);
+ }
+
+ public BaseSchematicHttpResponse getConfiguration(
+ String catalogId, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("catalogs")
+ .addPathSegment(catalogId)
+ .addPathSegments("configuration");
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl.build())
+ .method("GET", null)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ try (Response response = client.newCall(okhttpRequest).execute()) {
+ ResponseBody responseBody = response.body();
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ if (response.isSuccessful()) {
+ return new BaseSchematicHttpResponse<>(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetConfigurationResponse.class),
+ response);
+ }
+ try {
+ switch (response.code()) {
+ case 401:
+ throw new UnauthorizedError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 403:
+ throw new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 404:
+ throw new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 500:
+ throw new InternalServerError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ throw new BaseSchematicApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response);
+ } catch (JsonProcessingException e) {
+ throw new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e);
+ } catch (IOException e) {
+ throw new BaseSchematicException("Network error executing HTTP request", e);
+ }
+ }
+
+ public BaseSchematicHttpResponse updateConfiguration(String catalogId) {
+ return updateConfiguration(
+ catalogId, UpdateCatalogConfigurationRequestBody.builder().build());
+ }
+
+ public BaseSchematicHttpResponse updateConfiguration(
+ String catalogId, RequestOptions requestOptions) {
+ return updateConfiguration(
+ catalogId, UpdateCatalogConfigurationRequestBody.builder().build(), requestOptions);
+ }
+
+ public BaseSchematicHttpResponse updateConfiguration(
+ String catalogId, UpdateCatalogConfigurationRequestBody request) {
+ return updateConfiguration(catalogId, request, null);
+ }
+
+ public BaseSchematicHttpResponse updateConfiguration(
+ String catalogId, UpdateCatalogConfigurationRequestBody request, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("catalogs")
+ .addPathSegment(catalogId)
+ .addPathSegments("configuration");
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ RequestBody body;
+ try {
+ body = RequestBody.create(
+ ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON);
+ } catch (JsonProcessingException e) {
+ throw new BaseSchematicException("Failed to serialize request", e);
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl.build())
+ .method("PUT", body)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Content-Type", "application/json")
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ try (Response response = client.newCall(okhttpRequest).execute()) {
+ ResponseBody responseBody = response.body();
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ if (response.isSuccessful()) {
+ return new BaseSchematicHttpResponse<>(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateConfigurationResponse.class),
+ response);
+ }
+ try {
+ switch (response.code()) {
+ case 400:
+ throw new BadRequestError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 401:
+ throw new UnauthorizedError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 403:
+ throw new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 404:
+ throw new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 500:
+ throw new InternalServerError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ throw new BaseSchematicApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response);
+ } catch (JsonProcessingException e) {
+ throw new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e);
+ } catch (IOException e) {
+ throw new BaseSchematicException("Network error executing HTTP request", e);
+ }
+ }
+
+ public BaseSchematicHttpResponse getCreditBundlesInCatalog(String catalogId) {
+ return getCreditBundlesInCatalog(catalogId, null);
+ }
+
+ public BaseSchematicHttpResponse getCreditBundlesInCatalog(
+ String catalogId, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("catalogs")
+ .addPathSegment(catalogId)
+ .addPathSegments("credit-bundles");
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl.build())
+ .method("GET", null)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ try (Response response = client.newCall(okhttpRequest).execute()) {
+ ResponseBody responseBody = response.body();
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ if (response.isSuccessful()) {
+ return new BaseSchematicHttpResponse<>(
+ ObjectMappers.JSON_MAPPER.readValue(
+ responseBodyString, GetCreditBundlesInCatalogResponse.class),
+ response);
+ }
+ try {
+ switch (response.code()) {
+ case 401:
+ throw new UnauthorizedError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 403:
+ throw new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 404:
+ throw new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 500:
+ throw new InternalServerError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ throw new BaseSchematicApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response);
+ } catch (JsonProcessingException e) {
+ throw new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e);
+ } catch (IOException e) {
+ throw new BaseSchematicException("Network error executing HTTP request", e);
+ }
+ }
+
+ public BaseSchematicHttpResponse addCreditBundle(String catalogId, String creditBundleId) {
+ return addCreditBundle(catalogId, creditBundleId, null);
+ }
+
+ public BaseSchematicHttpResponse addCreditBundle(
+ String catalogId, String creditBundleId, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("catalogs")
+ .addPathSegment(catalogId)
+ .addPathSegments("credit-bundles")
+ .addPathSegment(creditBundleId);
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl.build())
+ .method("POST", RequestBody.create("", null))
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ try (Response response = client.newCall(okhttpRequest).execute()) {
+ ResponseBody responseBody = response.body();
+ if (response.isSuccessful()) {
+ return new BaseSchematicHttpResponse<>(null, response);
+ }
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ switch (response.code()) {
+ case 400:
+ throw new BadRequestError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 401:
+ throw new UnauthorizedError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 403:
+ throw new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 404:
+ throw new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 500:
+ throw new InternalServerError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ throw new BaseSchematicApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response);
+ } catch (JsonProcessingException e) {
+ throw new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e);
+ } catch (IOException e) {
+ throw new BaseSchematicException("Network error executing HTTP request", e);
+ }
+ }
+
+ public BaseSchematicHttpResponse removeCreditBundle(String catalogId, String creditBundleId) {
+ return removeCreditBundle(catalogId, creditBundleId, null);
+ }
+
+ public BaseSchematicHttpResponse removeCreditBundle(
+ String catalogId, String creditBundleId, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("catalogs")
+ .addPathSegment(catalogId)
+ .addPathSegments("credit-bundles")
+ .addPathSegment(creditBundleId);
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl.build())
+ .method("DELETE", null)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ try (Response response = client.newCall(okhttpRequest).execute()) {
+ ResponseBody responseBody = response.body();
+ if (response.isSuccessful()) {
+ return new BaseSchematicHttpResponse<>(null, response);
+ }
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ switch (response.code()) {
+ case 400:
+ throw new BadRequestError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 401:
+ throw new UnauthorizedError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 403:
+ throw new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 404:
+ throw new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 500:
+ throw new InternalServerError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ throw new BaseSchematicApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response);
+ } catch (JsonProcessingException e) {
+ throw new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e);
+ } catch (IOException e) {
+ throw new BaseSchematicException("Network error executing HTTP request", e);
+ }
+ }
+
+ public BaseSchematicHttpResponse getDerivedFeatures(String catalogId) {
+ return getDerivedFeatures(catalogId, null);
+ }
+
+ public BaseSchematicHttpResponse getDerivedFeatures(
+ String catalogId, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("catalogs")
+ .addPathSegment(catalogId)
+ .addPathSegments("features");
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl.build())
+ .method("GET", null)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ try (Response response = client.newCall(okhttpRequest).execute()) {
+ ResponseBody responseBody = response.body();
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ if (response.isSuccessful()) {
+ return new BaseSchematicHttpResponse<>(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetDerivedFeaturesResponse.class),
+ response);
+ }
+ try {
+ switch (response.code()) {
+ case 401:
+ throw new UnauthorizedError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 403:
+ throw new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 404:
+ throw new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 500:
+ throw new InternalServerError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ throw new BaseSchematicApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response);
+ } catch (JsonProcessingException e) {
+ throw new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e);
+ } catch (IOException e) {
+ throw new BaseSchematicException("Network error executing HTTP request", e);
+ }
+ }
+
+ public BaseSchematicHttpResponse getPlansInCatalog(String catalogId) {
+ return getPlansInCatalog(catalogId, null);
+ }
+
+ public BaseSchematicHttpResponse getPlansInCatalog(
+ String catalogId, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("catalogs")
+ .addPathSegment(catalogId)
+ .addPathSegments("plans");
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl.build())
+ .method("GET", null)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ try (Response response = client.newCall(okhttpRequest).execute()) {
+ ResponseBody responseBody = response.body();
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ if (response.isSuccessful()) {
+ return new BaseSchematicHttpResponse<>(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetPlansInCatalogResponse.class),
+ response);
+ }
+ try {
+ switch (response.code()) {
+ case 401:
+ throw new UnauthorizedError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 403:
+ throw new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 404:
+ throw new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 500:
+ throw new InternalServerError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ throw new BaseSchematicApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response);
+ } catch (JsonProcessingException e) {
+ throw new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e);
+ } catch (IOException e) {
+ throw new BaseSchematicException("Network error executing HTTP request", e);
+ }
+ }
+
+ public BaseSchematicHttpResponse addPlan(String catalogId, String planId) {
+ return addPlan(catalogId, planId, null);
+ }
+
+ public BaseSchematicHttpResponse addPlan(String catalogId, String planId, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("catalogs")
+ .addPathSegment(catalogId)
+ .addPathSegments("plans")
+ .addPathSegment(planId);
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl.build())
+ .method("POST", RequestBody.create("", null))
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ try (Response response = client.newCall(okhttpRequest).execute()) {
+ ResponseBody responseBody = response.body();
+ if (response.isSuccessful()) {
+ return new BaseSchematicHttpResponse<>(null, response);
+ }
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ switch (response.code()) {
+ case 400:
+ throw new BadRequestError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 401:
+ throw new UnauthorizedError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 403:
+ throw new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 404:
+ throw new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 500:
+ throw new InternalServerError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ throw new BaseSchematicApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response);
+ } catch (JsonProcessingException e) {
+ throw new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e);
+ } catch (IOException e) {
+ throw new BaseSchematicException("Network error executing HTTP request", e);
+ }
+ }
+
+ public BaseSchematicHttpResponse removePlan(String catalogId, String planId) {
+ return removePlan(catalogId, planId, null);
+ }
+
+ public BaseSchematicHttpResponse removePlan(String catalogId, String planId, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("catalogs")
+ .addPathSegment(catalogId)
+ .addPathSegments("plans")
+ .addPathSegment(planId);
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl.build())
+ .method("DELETE", null)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ try (Response response = client.newCall(okhttpRequest).execute()) {
+ ResponseBody responseBody = response.body();
+ if (response.isSuccessful()) {
+ return new BaseSchematicHttpResponse<>(null, response);
+ }
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ switch (response.code()) {
+ case 400:
+ throw new BadRequestError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 401:
+ throw new UnauthorizedError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 403:
+ throw new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 404:
+ throw new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ case 500:
+ throw new InternalServerError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ throw new BaseSchematicApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response);
+ } catch (JsonProcessingException e) {
+ throw new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e);
+ } catch (IOException e) {
+ throw new BaseSchematicException("Network error executing HTTP request", e);
+ }
+ }
+}
diff --git a/src/main/java/com/schematic/api/resources/catalogs/requests/CreateCatalogRequestBody.java b/src/main/java/com/schematic/api/resources/catalogs/requests/CreateCatalogRequestBody.java
new file mode 100644
index 00000000..3cd18cdc
--- /dev/null
+++ b/src/main/java/com/schematic/api/resources/catalogs/requests/CreateCatalogRequestBody.java
@@ -0,0 +1,171 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.schematic.api.resources.catalogs.requests;
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonSetter;
+import com.fasterxml.jackson.annotation.Nulls;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.schematic.api.core.ObjectMappers;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import org.jetbrains.annotations.NotNull;
+
+@JsonInclude(JsonInclude.Include.NON_ABSENT)
+@JsonDeserialize(builder = CreateCatalogRequestBody.Builder.class)
+public final class CreateCatalogRequestBody {
+ private final Optional description;
+
+ private final boolean isDefault;
+
+ private final String name;
+
+ private final Map additionalProperties;
+
+ private CreateCatalogRequestBody(
+ Optional description, boolean isDefault, String name, Map additionalProperties) {
+ this.description = description;
+ this.isDefault = isDefault;
+ this.name = name;
+ this.additionalProperties = additionalProperties;
+ }
+
+ @JsonProperty("description")
+ public Optional getDescription() {
+ return description;
+ }
+
+ @JsonProperty("is_default")
+ public boolean getIsDefault() {
+ return isDefault;
+ }
+
+ @JsonProperty("name")
+ public String getName() {
+ return name;
+ }
+
+ @java.lang.Override
+ public boolean equals(Object other) {
+ if (this == other) return true;
+ return other instanceof CreateCatalogRequestBody && equalTo((CreateCatalogRequestBody) other);
+ }
+
+ @JsonAnyGetter
+ public Map getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ private boolean equalTo(CreateCatalogRequestBody other) {
+ return description.equals(other.description) && isDefault == other.isDefault && name.equals(other.name);
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ return Objects.hash(this.description, this.isDefault, this.name);
+ }
+
+ @java.lang.Override
+ public String toString() {
+ return ObjectMappers.stringify(this);
+ }
+
+ public static IsDefaultStage builder() {
+ return new Builder();
+ }
+
+ public interface IsDefaultStage {
+ NameStage isDefault(boolean isDefault);
+
+ Builder from(CreateCatalogRequestBody other);
+ }
+
+ public interface NameStage {
+ _FinalStage name(@NotNull String name);
+ }
+
+ public interface _FinalStage {
+ CreateCatalogRequestBody build();
+
+ _FinalStage additionalProperty(String key, Object value);
+
+ _FinalStage additionalProperties(Map additionalProperties);
+
+ _FinalStage description(Optional description);
+
+ _FinalStage description(String description);
+ }
+
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public static final class Builder implements IsDefaultStage, NameStage, _FinalStage {
+ private boolean isDefault;
+
+ private String name;
+
+ private Optional description = Optional.empty();
+
+ @JsonAnySetter
+ private Map additionalProperties = new HashMap<>();
+
+ private Builder() {}
+
+ @java.lang.Override
+ public Builder from(CreateCatalogRequestBody other) {
+ description(other.getDescription());
+ isDefault(other.getIsDefault());
+ name(other.getName());
+ return this;
+ }
+
+ @java.lang.Override
+ @JsonSetter("is_default")
+ public NameStage isDefault(boolean isDefault) {
+ this.isDefault = isDefault;
+ return this;
+ }
+
+ @java.lang.Override
+ @JsonSetter("name")
+ public _FinalStage name(@NotNull String name) {
+ this.name = Objects.requireNonNull(name, "name must not be null");
+ return this;
+ }
+
+ @java.lang.Override
+ public _FinalStage description(String description) {
+ this.description = Optional.ofNullable(description);
+ return this;
+ }
+
+ @java.lang.Override
+ @JsonSetter(value = "description", nulls = Nulls.SKIP)
+ public _FinalStage description(Optional description) {
+ this.description = description;
+ return this;
+ }
+
+ @java.lang.Override
+ public CreateCatalogRequestBody build() {
+ return new CreateCatalogRequestBody(description, isDefault, name, additionalProperties);
+ }
+
+ @java.lang.Override
+ public Builder additionalProperty(String key, Object value) {
+ this.additionalProperties.put(key, value);
+ return this;
+ }
+
+ @java.lang.Override
+ public Builder additionalProperties(Map additionalProperties) {
+ this.additionalProperties.putAll(additionalProperties);
+ return this;
+ }
+ }
+}
diff --git a/src/main/java/com/schematic/api/resources/catalogs/requests/ListCatalogsRequest.java b/src/main/java/com/schematic/api/resources/catalogs/requests/ListCatalogsRequest.java
new file mode 100644
index 00000000..b1dc65d7
--- /dev/null
+++ b/src/main/java/com/schematic/api/resources/catalogs/requests/ListCatalogsRequest.java
@@ -0,0 +1,197 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.schematic.api.resources.catalogs.requests;
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonSetter;
+import com.fasterxml.jackson.annotation.Nulls;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.schematic.api.core.ObjectMappers;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+
+@JsonInclude(JsonInclude.Include.NON_ABSENT)
+@JsonDeserialize(builder = ListCatalogsRequest.Builder.class)
+public final class ListCatalogsRequest {
+ private final Optional isDefault;
+
+ private final Optional q;
+
+ private final Optional limit;
+
+ private final Optional offset;
+
+ private final Map additionalProperties;
+
+ private ListCatalogsRequest(
+ Optional isDefault,
+ Optional q,
+ Optional limit,
+ Optional offset,
+ Map additionalProperties) {
+ this.isDefault = isDefault;
+ this.q = q;
+ this.limit = limit;
+ this.offset = offset;
+ this.additionalProperties = additionalProperties;
+ }
+
+ @JsonProperty("is_default")
+ public Optional getIsDefault() {
+ return isDefault;
+ }
+
+ /**
+ * @return Search by catalog name
+ */
+ @JsonProperty("q")
+ public Optional getQ() {
+ return q;
+ }
+
+ /**
+ * @return Page limit (default 100)
+ */
+ @JsonProperty("limit")
+ public Optional getLimit() {
+ return limit;
+ }
+
+ /**
+ * @return Page offset (default 0)
+ */
+ @JsonProperty("offset")
+ public Optional getOffset() {
+ return offset;
+ }
+
+ @java.lang.Override
+ public boolean equals(Object other) {
+ if (this == other) return true;
+ return other instanceof ListCatalogsRequest && equalTo((ListCatalogsRequest) other);
+ }
+
+ @JsonAnyGetter
+ public Map getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ private boolean equalTo(ListCatalogsRequest other) {
+ return isDefault.equals(other.isDefault)
+ && q.equals(other.q)
+ && limit.equals(other.limit)
+ && offset.equals(other.offset);
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ return Objects.hash(this.isDefault, this.q, this.limit, this.offset);
+ }
+
+ @java.lang.Override
+ public String toString() {
+ return ObjectMappers.stringify(this);
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public static final class Builder {
+ private Optional isDefault = Optional.empty();
+
+ private Optional q = Optional.empty();
+
+ private Optional limit = Optional.empty();
+
+ private Optional offset = Optional.empty();
+
+ @JsonAnySetter
+ private Map additionalProperties = new HashMap<>();
+
+ private Builder() {}
+
+ public Builder from(ListCatalogsRequest other) {
+ isDefault(other.getIsDefault());
+ q(other.getQ());
+ limit(other.getLimit());
+ offset(other.getOffset());
+ return this;
+ }
+
+ @JsonSetter(value = "is_default", nulls = Nulls.SKIP)
+ public Builder isDefault(Optional isDefault) {
+ this.isDefault = isDefault;
+ return this;
+ }
+
+ public Builder isDefault(Boolean isDefault) {
+ this.isDefault = Optional.ofNullable(isDefault);
+ return this;
+ }
+
+ /**
+ * Search by catalog name
+ */
+ @JsonSetter(value = "q", nulls = Nulls.SKIP)
+ public Builder q(Optional q) {
+ this.q = q;
+ return this;
+ }
+
+ public Builder q(String q) {
+ this.q = Optional.ofNullable(q);
+ return this;
+ }
+
+ /**
+ * Page limit (default 100)
+ */
+ @JsonSetter(value = "limit", nulls = Nulls.SKIP)
+ public Builder limit(Optional limit) {
+ this.limit = limit;
+ return this;
+ }
+
+ public Builder limit(Long limit) {
+ this.limit = Optional.ofNullable(limit);
+ return this;
+ }
+
+ /**
+ * Page offset (default 0)
+ */
+ @JsonSetter(value = "offset", nulls = Nulls.SKIP)
+ public Builder offset(Optional offset) {
+ this.offset = offset;
+ return this;
+ }
+
+ public Builder offset(Long offset) {
+ this.offset = Optional.ofNullable(offset);
+ return this;
+ }
+
+ public ListCatalogsRequest build() {
+ return new ListCatalogsRequest(isDefault, q, limit, offset, additionalProperties);
+ }
+
+ public Builder additionalProperty(String key, Object value) {
+ this.additionalProperties.put(key, value);
+ return this;
+ }
+
+ public Builder additionalProperties(Map additionalProperties) {
+ this.additionalProperties.putAll(additionalProperties);
+ return this;
+ }
+ }
+}
diff --git a/src/main/java/com/schematic/api/resources/catalogs/requests/UpdateCatalogConfigurationRequestBody.java b/src/main/java/com/schematic/api/resources/catalogs/requests/UpdateCatalogConfigurationRequestBody.java
new file mode 100644
index 00000000..0c400923
--- /dev/null
+++ b/src/main/java/com/schematic/api/resources/catalogs/requests/UpdateCatalogConfigurationRequestBody.java
@@ -0,0 +1,322 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.schematic.api.resources.catalogs.requests;
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonSetter;
+import com.fasterxml.jackson.annotation.Nulls;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.schematic.api.core.ObjectMappers;
+import com.schematic.api.types.CatalogConfigOrderedBundle;
+import com.schematic.api.types.CatalogConfigOrderedPlan;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+
+@JsonInclude(JsonInclude.Include.NON_ABSENT)
+@JsonDeserialize(builder = UpdateCatalogConfigurationRequestBody.Builder.class)
+public final class UpdateCatalogConfigurationRequestBody {
+ private final Optional customPlanCtaText;
+
+ private final Optional customPlanCtaUrl;
+
+ private final Optional customPlanPriceText;
+
+ private final Optional customPlansVisible;
+
+ private final Optional> orderedAddOns;
+
+ private final Optional> orderedBundles;
+
+ private final Optional> orderedPlans;
+
+ private final Optional pricingModel;
+
+ private final Optional pricingUrl;
+
+ private final Map additionalProperties;
+
+ private UpdateCatalogConfigurationRequestBody(
+ Optional customPlanCtaText,
+ Optional customPlanCtaUrl,
+ Optional customPlanPriceText,
+ Optional customPlansVisible,
+ Optional> orderedAddOns,
+ Optional> orderedBundles,
+ Optional> orderedPlans,
+ Optional pricingModel,
+ Optional pricingUrl,
+ Map additionalProperties) {
+ this.customPlanCtaText = customPlanCtaText;
+ this.customPlanCtaUrl = customPlanCtaUrl;
+ this.customPlanPriceText = customPlanPriceText;
+ this.customPlansVisible = customPlansVisible;
+ this.orderedAddOns = orderedAddOns;
+ this.orderedBundles = orderedBundles;
+ this.orderedPlans = orderedPlans;
+ this.pricingModel = pricingModel;
+ this.pricingUrl = pricingUrl;
+ this.additionalProperties = additionalProperties;
+ }
+
+ @JsonProperty("custom_plan_cta_text")
+ public Optional getCustomPlanCtaText() {
+ return customPlanCtaText;
+ }
+
+ @JsonProperty("custom_plan_cta_url")
+ public Optional getCustomPlanCtaUrl() {
+ return customPlanCtaUrl;
+ }
+
+ @JsonProperty("custom_plan_price_text")
+ public Optional getCustomPlanPriceText() {
+ return customPlanPriceText;
+ }
+
+ @JsonProperty("custom_plans_visible")
+ public Optional getCustomPlansVisible() {
+ return customPlansVisible;
+ }
+
+ @JsonProperty("ordered_add_ons")
+ public Optional> getOrderedAddOns() {
+ return orderedAddOns;
+ }
+
+ @JsonProperty("ordered_bundles")
+ public Optional> getOrderedBundles() {
+ return orderedBundles;
+ }
+
+ @JsonProperty("ordered_plans")
+ public Optional> getOrderedPlans() {
+ return orderedPlans;
+ }
+
+ @JsonProperty("pricing_model")
+ public Optional getPricingModel() {
+ return pricingModel;
+ }
+
+ @JsonProperty("pricing_url")
+ public Optional getPricingUrl() {
+ return pricingUrl;
+ }
+
+ @java.lang.Override
+ public boolean equals(Object other) {
+ if (this == other) return true;
+ return other instanceof UpdateCatalogConfigurationRequestBody
+ && equalTo((UpdateCatalogConfigurationRequestBody) other);
+ }
+
+ @JsonAnyGetter
+ public Map getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ private boolean equalTo(UpdateCatalogConfigurationRequestBody other) {
+ return customPlanCtaText.equals(other.customPlanCtaText)
+ && customPlanCtaUrl.equals(other.customPlanCtaUrl)
+ && customPlanPriceText.equals(other.customPlanPriceText)
+ && customPlansVisible.equals(other.customPlansVisible)
+ && orderedAddOns.equals(other.orderedAddOns)
+ && orderedBundles.equals(other.orderedBundles)
+ && orderedPlans.equals(other.orderedPlans)
+ && pricingModel.equals(other.pricingModel)
+ && pricingUrl.equals(other.pricingUrl);
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ return Objects.hash(
+ this.customPlanCtaText,
+ this.customPlanCtaUrl,
+ this.customPlanPriceText,
+ this.customPlansVisible,
+ this.orderedAddOns,
+ this.orderedBundles,
+ this.orderedPlans,
+ this.pricingModel,
+ this.pricingUrl);
+ }
+
+ @java.lang.Override
+ public String toString() {
+ return ObjectMappers.stringify(this);
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public static final class Builder {
+ private Optional customPlanCtaText = Optional.empty();
+
+ private Optional customPlanCtaUrl = Optional.empty();
+
+ private Optional customPlanPriceText = Optional.empty();
+
+ private Optional customPlansVisible = Optional.empty();
+
+ private Optional> orderedAddOns = Optional.empty();
+
+ private Optional> orderedBundles = Optional.empty();
+
+ private Optional> orderedPlans = Optional.empty();
+
+ private Optional pricingModel = Optional.empty();
+
+ private Optional pricingUrl = Optional.empty();
+
+ @JsonAnySetter
+ private Map additionalProperties = new HashMap<>();
+
+ private Builder() {}
+
+ public Builder from(UpdateCatalogConfigurationRequestBody other) {
+ customPlanCtaText(other.getCustomPlanCtaText());
+ customPlanCtaUrl(other.getCustomPlanCtaUrl());
+ customPlanPriceText(other.getCustomPlanPriceText());
+ customPlansVisible(other.getCustomPlansVisible());
+ orderedAddOns(other.getOrderedAddOns());
+ orderedBundles(other.getOrderedBundles());
+ orderedPlans(other.getOrderedPlans());
+ pricingModel(other.getPricingModel());
+ pricingUrl(other.getPricingUrl());
+ return this;
+ }
+
+ @JsonSetter(value = "custom_plan_cta_text", nulls = Nulls.SKIP)
+ public Builder customPlanCtaText(Optional customPlanCtaText) {
+ this.customPlanCtaText = customPlanCtaText;
+ return this;
+ }
+
+ public Builder customPlanCtaText(String customPlanCtaText) {
+ this.customPlanCtaText = Optional.ofNullable(customPlanCtaText);
+ return this;
+ }
+
+ @JsonSetter(value = "custom_plan_cta_url", nulls = Nulls.SKIP)
+ public Builder customPlanCtaUrl(Optional customPlanCtaUrl) {
+ this.customPlanCtaUrl = customPlanCtaUrl;
+ return this;
+ }
+
+ public Builder customPlanCtaUrl(String customPlanCtaUrl) {
+ this.customPlanCtaUrl = Optional.ofNullable(customPlanCtaUrl);
+ return this;
+ }
+
+ @JsonSetter(value = "custom_plan_price_text", nulls = Nulls.SKIP)
+ public Builder customPlanPriceText(Optional customPlanPriceText) {
+ this.customPlanPriceText = customPlanPriceText;
+ return this;
+ }
+
+ public Builder customPlanPriceText(String customPlanPriceText) {
+ this.customPlanPriceText = Optional.ofNullable(customPlanPriceText);
+ return this;
+ }
+
+ @JsonSetter(value = "custom_plans_visible", nulls = Nulls.SKIP)
+ public Builder customPlansVisible(Optional customPlansVisible) {
+ this.customPlansVisible = customPlansVisible;
+ return this;
+ }
+
+ public Builder customPlansVisible(Boolean customPlansVisible) {
+ this.customPlansVisible = Optional.ofNullable(customPlansVisible);
+ return this;
+ }
+
+ @JsonSetter(value = "ordered_add_ons", nulls = Nulls.SKIP)
+ public Builder orderedAddOns(Optional> orderedAddOns) {
+ this.orderedAddOns = orderedAddOns;
+ return this;
+ }
+
+ public Builder orderedAddOns(List orderedAddOns) {
+ this.orderedAddOns = Optional.ofNullable(orderedAddOns);
+ return this;
+ }
+
+ @JsonSetter(value = "ordered_bundles", nulls = Nulls.SKIP)
+ public Builder orderedBundles(Optional> orderedBundles) {
+ this.orderedBundles = orderedBundles;
+ return this;
+ }
+
+ public Builder orderedBundles(List orderedBundles) {
+ this.orderedBundles = Optional.ofNullable(orderedBundles);
+ return this;
+ }
+
+ @JsonSetter(value = "ordered_plans", nulls = Nulls.SKIP)
+ public Builder orderedPlans(Optional> orderedPlans) {
+ this.orderedPlans = orderedPlans;
+ return this;
+ }
+
+ public Builder orderedPlans(List orderedPlans) {
+ this.orderedPlans = Optional.ofNullable(orderedPlans);
+ return this;
+ }
+
+ @JsonSetter(value = "pricing_model", nulls = Nulls.SKIP)
+ public Builder pricingModel(Optional pricingModel) {
+ this.pricingModel = pricingModel;
+ return this;
+ }
+
+ public Builder pricingModel(String pricingModel) {
+ this.pricingModel = Optional.ofNullable(pricingModel);
+ return this;
+ }
+
+ @JsonSetter(value = "pricing_url", nulls = Nulls.SKIP)
+ public Builder pricingUrl(Optional pricingUrl) {
+ this.pricingUrl = pricingUrl;
+ return this;
+ }
+
+ public Builder pricingUrl(String pricingUrl) {
+ this.pricingUrl = Optional.ofNullable(pricingUrl);
+ return this;
+ }
+
+ public UpdateCatalogConfigurationRequestBody build() {
+ return new UpdateCatalogConfigurationRequestBody(
+ customPlanCtaText,
+ customPlanCtaUrl,
+ customPlanPriceText,
+ customPlansVisible,
+ orderedAddOns,
+ orderedBundles,
+ orderedPlans,
+ pricingModel,
+ pricingUrl,
+ additionalProperties);
+ }
+
+ public Builder additionalProperty(String key, Object value) {
+ this.additionalProperties.put(key, value);
+ return this;
+ }
+
+ public Builder additionalProperties(Map additionalProperties) {
+ this.additionalProperties.putAll(additionalProperties);
+ return this;
+ }
+ }
+}
diff --git a/src/main/java/com/schematic/api/resources/catalogs/requests/UpdateCatalogRequestBody.java b/src/main/java/com/schematic/api/resources/catalogs/requests/UpdateCatalogRequestBody.java
new file mode 100644
index 00000000..24dff51c
--- /dev/null
+++ b/src/main/java/com/schematic/api/resources/catalogs/requests/UpdateCatalogRequestBody.java
@@ -0,0 +1,153 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.schematic.api.resources.catalogs.requests;
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonSetter;
+import com.fasterxml.jackson.annotation.Nulls;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.schematic.api.core.ObjectMappers;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+
+@JsonInclude(JsonInclude.Include.NON_ABSENT)
+@JsonDeserialize(builder = UpdateCatalogRequestBody.Builder.class)
+public final class UpdateCatalogRequestBody {
+ private final Optional description;
+
+ private final Optional isDefault;
+
+ private final Optional name;
+
+ private final Map additionalProperties;
+
+ private UpdateCatalogRequestBody(
+ Optional description,
+ Optional isDefault,
+ Optional name,
+ Map additionalProperties) {
+ this.description = description;
+ this.isDefault = isDefault;
+ this.name = name;
+ this.additionalProperties = additionalProperties;
+ }
+
+ @JsonProperty("description")
+ public Optional getDescription() {
+ return description;
+ }
+
+ @JsonProperty("is_default")
+ public Optional getIsDefault() {
+ return isDefault;
+ }
+
+ @JsonProperty("name")
+ public Optional getName() {
+ return name;
+ }
+
+ @java.lang.Override
+ public boolean equals(Object other) {
+ if (this == other) return true;
+ return other instanceof UpdateCatalogRequestBody && equalTo((UpdateCatalogRequestBody) other);
+ }
+
+ @JsonAnyGetter
+ public Map getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ private boolean equalTo(UpdateCatalogRequestBody other) {
+ return description.equals(other.description) && isDefault.equals(other.isDefault) && name.equals(other.name);
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ return Objects.hash(this.description, this.isDefault, this.name);
+ }
+
+ @java.lang.Override
+ public String toString() {
+ return ObjectMappers.stringify(this);
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public static final class Builder {
+ private Optional description = Optional.empty();
+
+ private Optional isDefault = Optional.empty();
+
+ private Optional name = Optional.empty();
+
+ @JsonAnySetter
+ private Map additionalProperties = new HashMap<>();
+
+ private Builder() {}
+
+ public Builder from(UpdateCatalogRequestBody other) {
+ description(other.getDescription());
+ isDefault(other.getIsDefault());
+ name(other.getName());
+ return this;
+ }
+
+ @JsonSetter(value = "description", nulls = Nulls.SKIP)
+ public Builder description(Optional description) {
+ this.description = description;
+ return this;
+ }
+
+ public Builder description(String description) {
+ this.description = Optional.ofNullable(description);
+ return this;
+ }
+
+ @JsonSetter(value = "is_default", nulls = Nulls.SKIP)
+ public Builder isDefault(Optional isDefault) {
+ this.isDefault = isDefault;
+ return this;
+ }
+
+ public Builder isDefault(Boolean isDefault) {
+ this.isDefault = Optional.ofNullable(isDefault);
+ return this;
+ }
+
+ @JsonSetter(value = "name", nulls = Nulls.SKIP)
+ public Builder name(Optional name) {
+ this.name = name;
+ return this;
+ }
+
+ public Builder name(String name) {
+ this.name = Optional.ofNullable(name);
+ return this;
+ }
+
+ public UpdateCatalogRequestBody build() {
+ return new UpdateCatalogRequestBody(description, isDefault, name, additionalProperties);
+ }
+
+ public Builder additionalProperty(String key, Object value) {
+ this.additionalProperties.put(key, value);
+ return this;
+ }
+
+ public Builder additionalProperties(Map additionalProperties) {
+ this.additionalProperties.putAll(additionalProperties);
+ return this;
+ }
+ }
+}
diff --git a/src/main/java/com/schematic/api/resources/catalogs/types/CreateCatalogResponse.java b/src/main/java/com/schematic/api/resources/catalogs/types/CreateCatalogResponse.java
new file mode 100644
index 00000000..32088023
--- /dev/null
+++ b/src/main/java/com/schematic/api/resources/catalogs/types/CreateCatalogResponse.java
@@ -0,0 +1,181 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.schematic.api.resources.catalogs.types;
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonSetter;
+import com.fasterxml.jackson.annotation.Nulls;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.schematic.api.core.ObjectMappers;
+import com.schematic.api.types.CatalogResponseData;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Objects;
+import org.jetbrains.annotations.NotNull;
+
+@JsonInclude(JsonInclude.Include.NON_ABSENT)
+@JsonDeserialize(builder = CreateCatalogResponse.Builder.class)
+public final class CreateCatalogResponse {
+ private final CatalogResponseData data;
+
+ private final Map params;
+
+ private final Map additionalProperties;
+
+ private CreateCatalogResponse(
+ CatalogResponseData data, Map params, Map additionalProperties) {
+ this.data = data;
+ this.params = params;
+ this.additionalProperties = additionalProperties;
+ }
+
+ @JsonProperty("data")
+ public CatalogResponseData getData() {
+ return data;
+ }
+
+ /**
+ * @return Input parameters
+ */
+ @JsonProperty("params")
+ public Map getParams() {
+ return params;
+ }
+
+ @java.lang.Override
+ public boolean equals(Object other) {
+ if (this == other) return true;
+ return other instanceof CreateCatalogResponse && equalTo((CreateCatalogResponse) other);
+ }
+
+ @JsonAnyGetter
+ public Map getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ private boolean equalTo(CreateCatalogResponse other) {
+ return data.equals(other.data) && params.equals(other.params);
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ return Objects.hash(this.data, this.params);
+ }
+
+ @java.lang.Override
+ public String toString() {
+ return ObjectMappers.stringify(this);
+ }
+
+ public static DataStage builder() {
+ return new Builder();
+ }
+
+ public interface DataStage {
+ _FinalStage data(@NotNull CatalogResponseData data);
+
+ Builder from(CreateCatalogResponse other);
+ }
+
+ public interface _FinalStage {
+ CreateCatalogResponse build();
+
+ _FinalStage additionalProperty(String key, Object value);
+
+ _FinalStage additionalProperties(Map additionalProperties);
+
+ /**
+ * Input parameters
+ */
+ _FinalStage params(Map params);
+
+ _FinalStage putAllParams(Map params);
+
+ _FinalStage params(String key, JsonNode value);
+ }
+
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public static final class Builder implements DataStage, _FinalStage {
+ private CatalogResponseData data;
+
+ private Map params = new LinkedHashMap<>();
+
+ @JsonAnySetter
+ private Map additionalProperties = new HashMap<>();
+
+ private Builder() {}
+
+ @java.lang.Override
+ public Builder from(CreateCatalogResponse other) {
+ data(other.getData());
+ params(other.getParams());
+ return this;
+ }
+
+ @java.lang.Override
+ @JsonSetter("data")
+ public _FinalStage data(@NotNull CatalogResponseData data) {
+ this.data = Objects.requireNonNull(data, "data must not be null");
+ return this;
+ }
+
+ /**
+ * Input parameters
+ * @return Reference to {@code this} so that method calls can be chained together.
+ */
+ @java.lang.Override
+ public _FinalStage params(String key, JsonNode value) {
+ this.params.put(key, value);
+ return this;
+ }
+
+ /**
+ * Input parameters
+ * @return Reference to {@code this} so that method calls can be chained together.
+ */
+ @java.lang.Override
+ public _FinalStage putAllParams(Map params) {
+ if (params != null) {
+ this.params.putAll(params);
+ }
+ return this;
+ }
+
+ /**
+ * Input parameters
+ */
+ @java.lang.Override
+ @JsonSetter(value = "params", nulls = Nulls.SKIP)
+ public _FinalStage params(Map params) {
+ this.params.clear();
+ if (params != null) {
+ this.params.putAll(params);
+ }
+ return this;
+ }
+
+ @java.lang.Override
+ public CreateCatalogResponse build() {
+ return new CreateCatalogResponse(data, params, additionalProperties);
+ }
+
+ @java.lang.Override
+ public Builder additionalProperty(String key, Object value) {
+ this.additionalProperties.put(key, value);
+ return this;
+ }
+
+ @java.lang.Override
+ public Builder additionalProperties(Map additionalProperties) {
+ this.additionalProperties.putAll(additionalProperties);
+ return this;
+ }
+ }
+}
diff --git a/src/main/java/com/schematic/api/resources/catalogs/types/DeleteCatalogResponse.java b/src/main/java/com/schematic/api/resources/catalogs/types/DeleteCatalogResponse.java
new file mode 100644
index 00000000..76cadcac
--- /dev/null
+++ b/src/main/java/com/schematic/api/resources/catalogs/types/DeleteCatalogResponse.java
@@ -0,0 +1,181 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.schematic.api.resources.catalogs.types;
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonSetter;
+import com.fasterxml.jackson.annotation.Nulls;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.schematic.api.core.ObjectMappers;
+import com.schematic.api.types.DeleteResponse;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Objects;
+import org.jetbrains.annotations.NotNull;
+
+@JsonInclude(JsonInclude.Include.NON_ABSENT)
+@JsonDeserialize(builder = DeleteCatalogResponse.Builder.class)
+public final class DeleteCatalogResponse {
+ private final DeleteResponse data;
+
+ private final Map params;
+
+ private final Map additionalProperties;
+
+ private DeleteCatalogResponse(
+ DeleteResponse data, Map params, Map