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/.fern/replay.lock b/.fern/replay.lock index 425912e1..058ad905 100644 --- a/.fern/replay.lock +++ b/.fern/replay.lock @@ -12,5 +12,11 @@ generations: cli_version: unknown generator_versions: fernapi/fern-java-sdk: 4.11.1 -current_generation: 6f0570857c48dde6c3e66bba48c4846907746994 + - commit_sha: 87b3adbf90d3b4093f69cfd08816d754d3d328ef + tree_hash: f2a16eb5a8000df1cfa8c21ed0b481aa72d46437 + timestamp: 2026-07-22T19:43:42.611Z + cli_version: unknown + generator_versions: + fernapi/fern-java-sdk: 4.11.1 +current_generation: 87b3adbf90d3b4093f69cfd08816d754d3d328ef patches: [] 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 additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public DeleteResponse 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 DeleteCatalogResponse && equalTo((DeleteCatalogResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteCatalogResponse 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 DeleteResponse data); + + Builder from(DeleteCatalogResponse other); + } + + public interface _FinalStage { + DeleteCatalogResponse 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 DeleteResponse data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeleteCatalogResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull DeleteResponse 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 DeleteCatalogResponse build() { + return new DeleteCatalogResponse(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/GetCatalogResponse.java b/src/main/java/com/schematic/api/resources/catalogs/types/GetCatalogResponse.java new file mode 100644 index 00000000..98c2ab22 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/catalogs/types/GetCatalogResponse.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 = GetCatalogResponse.Builder.class) +public final class GetCatalogResponse { + private final CatalogResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private GetCatalogResponse( + 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 GetCatalogResponse && equalTo((GetCatalogResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetCatalogResponse 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(GetCatalogResponse other); + } + + public interface _FinalStage { + GetCatalogResponse 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(GetCatalogResponse 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 GetCatalogResponse build() { + return new GetCatalogResponse(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/GetConfigurationResponse.java b/src/main/java/com/schematic/api/resources/catalogs/types/GetConfigurationResponse.java new file mode 100644 index 00000000..26e61830 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/catalogs/types/GetConfigurationResponse.java @@ -0,0 +1,183 @@ +/** + * 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.CatalogConfigurationResponseData; +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 = GetConfigurationResponse.Builder.class) +public final class GetConfigurationResponse { + private final CatalogConfigurationResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private GetConfigurationResponse( + CatalogConfigurationResponseData data, + Map params, + Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public CatalogConfigurationResponseData 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 GetConfigurationResponse && equalTo((GetConfigurationResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetConfigurationResponse 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 CatalogConfigurationResponseData data); + + Builder from(GetConfigurationResponse other); + } + + public interface _FinalStage { + GetConfigurationResponse 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 CatalogConfigurationResponseData data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetConfigurationResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull CatalogConfigurationResponseData 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 GetConfigurationResponse build() { + return new GetConfigurationResponse(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/GetCreditBundlesInCatalogResponse.java b/src/main/java/com/schematic/api/resources/catalogs/types/GetCreditBundlesInCatalogResponse.java new file mode 100644 index 00000000..a61d1ac0 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/catalogs/types/GetCreditBundlesInCatalogResponse.java @@ -0,0 +1,183 @@ +/** + * 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.CatalogCreditBundleIDsResponseData; +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 = GetCreditBundlesInCatalogResponse.Builder.class) +public final class GetCreditBundlesInCatalogResponse { + private final CatalogCreditBundleIDsResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private GetCreditBundlesInCatalogResponse( + CatalogCreditBundleIDsResponseData data, + Map params, + Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public CatalogCreditBundleIDsResponseData 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 GetCreditBundlesInCatalogResponse && equalTo((GetCreditBundlesInCatalogResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetCreditBundlesInCatalogResponse 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 CatalogCreditBundleIDsResponseData data); + + Builder from(GetCreditBundlesInCatalogResponse other); + } + + public interface _FinalStage { + GetCreditBundlesInCatalogResponse 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 CatalogCreditBundleIDsResponseData data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetCreditBundlesInCatalogResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull CatalogCreditBundleIDsResponseData 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 GetCreditBundlesInCatalogResponse build() { + return new GetCreditBundlesInCatalogResponse(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/GetDerivedFeaturesResponse.java b/src/main/java/com/schematic/api/resources/catalogs/types/GetDerivedFeaturesResponse.java new file mode 100644 index 00000000..a48b4893 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/catalogs/types/GetDerivedFeaturesResponse.java @@ -0,0 +1,183 @@ +/** + * 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.CatalogDerivedFeaturesResponseData; +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 = GetDerivedFeaturesResponse.Builder.class) +public final class GetDerivedFeaturesResponse { + private final CatalogDerivedFeaturesResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private GetDerivedFeaturesResponse( + CatalogDerivedFeaturesResponseData data, + Map params, + Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public CatalogDerivedFeaturesResponseData 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 GetDerivedFeaturesResponse && equalTo((GetDerivedFeaturesResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetDerivedFeaturesResponse 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 CatalogDerivedFeaturesResponseData data); + + Builder from(GetDerivedFeaturesResponse other); + } + + public interface _FinalStage { + GetDerivedFeaturesResponse 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 CatalogDerivedFeaturesResponseData data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetDerivedFeaturesResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull CatalogDerivedFeaturesResponseData 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 GetDerivedFeaturesResponse build() { + return new GetDerivedFeaturesResponse(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/GetPlansInCatalogResponse.java b/src/main/java/com/schematic/api/resources/catalogs/types/GetPlansInCatalogResponse.java new file mode 100644 index 00000000..23e97258 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/catalogs/types/GetPlansInCatalogResponse.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.CatalogPlanIDsResponseData; +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 = GetPlansInCatalogResponse.Builder.class) +public final class GetPlansInCatalogResponse { + private final CatalogPlanIDsResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private GetPlansInCatalogResponse( + CatalogPlanIDsResponseData data, Map params, Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public CatalogPlanIDsResponseData 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 GetPlansInCatalogResponse && equalTo((GetPlansInCatalogResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetPlansInCatalogResponse 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 CatalogPlanIDsResponseData data); + + Builder from(GetPlansInCatalogResponse other); + } + + public interface _FinalStage { + GetPlansInCatalogResponse 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 CatalogPlanIDsResponseData data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetPlansInCatalogResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull CatalogPlanIDsResponseData 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 GetPlansInCatalogResponse build() { + return new GetPlansInCatalogResponse(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/ListCatalogsParams.java b/src/main/java/com/schematic/api/resources/catalogs/types/ListCatalogsParams.java new file mode 100644 index 00000000..d93aa6df --- /dev/null +++ b/src/main/java/com/schematic/api/resources/catalogs/types/ListCatalogsParams.java @@ -0,0 +1,197 @@ +/** + * 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.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 = ListCatalogsParams.Builder.class) +public final class ListCatalogsParams { + private final Optional isDefault; + + private final Optional limit; + + private final Optional offset; + + private final Optional q; + + private final Map additionalProperties; + + private ListCatalogsParams( + Optional isDefault, + Optional limit, + Optional offset, + Optional q, + Map additionalProperties) { + this.isDefault = isDefault; + this.limit = limit; + this.offset = offset; + this.q = q; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("is_default") + public Optional getIsDefault() { + return isDefault; + } + + /** + * @return Page limit (default 100) + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return Page offset (default 0) + */ + @JsonProperty("offset") + public Optional getOffset() { + return offset; + } + + /** + * @return Search by catalog name + */ + @JsonProperty("q") + public Optional getQ() { + return q; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCatalogsParams && equalTo((ListCatalogsParams) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCatalogsParams other) { + return isDefault.equals(other.isDefault) + && limit.equals(other.limit) + && offset.equals(other.offset) + && q.equals(other.q); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.isDefault, this.limit, this.offset, this.q); + } + + @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 limit = Optional.empty(); + + private Optional offset = Optional.empty(); + + private Optional q = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListCatalogsParams other) { + isDefault(other.getIsDefault()); + limit(other.getLimit()); + offset(other.getOffset()); + q(other.getQ()); + 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; + } + + /** + *

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; + } + + /** + *

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; + } + + public ListCatalogsParams build() { + return new ListCatalogsParams(isDefault, limit, offset, q, 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/ListCatalogsResponse.java b/src/main/java/com/schematic/api/resources/catalogs/types/ListCatalogsResponse.java new file mode 100644 index 00000000..38575bb3 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/catalogs/types/ListCatalogsResponse.java @@ -0,0 +1,174 @@ +/** + * 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.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.CatalogResponseData; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListCatalogsResponse.Builder.class) +public final class ListCatalogsResponse { + private final List data; + + private final ListCatalogsParams params; + + private final Map additionalProperties; + + private ListCatalogsResponse( + List data, ListCatalogsParams params, Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Input parameters + */ + @JsonProperty("params") + public ListCatalogsParams getParams() { + return params; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCatalogsResponse && equalTo((ListCatalogsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCatalogsResponse 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 ParamsStage builder() { + return new Builder(); + } + + public interface ParamsStage { + /** + *

Input parameters

+ */ + _FinalStage params(@NotNull ListCatalogsParams params); + + Builder from(ListCatalogsResponse other); + } + + public interface _FinalStage { + ListCatalogsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(CatalogResponseData data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ParamsStage, _FinalStage { + private ListCatalogsParams params; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListCatalogsResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + /** + *

Input parameters

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("params") + public _FinalStage params(@NotNull ListCatalogsParams params) { + this.params = Objects.requireNonNull(params, "params must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(CatalogResponseData data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListCatalogsResponse build() { + return new ListCatalogsResponse(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/UpdateCatalogResponse.java b/src/main/java/com/schematic/api/resources/catalogs/types/UpdateCatalogResponse.java new file mode 100644 index 00000000..f68960f7 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/catalogs/types/UpdateCatalogResponse.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 = UpdateCatalogResponse.Builder.class) +public final class UpdateCatalogResponse { + private final CatalogResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private UpdateCatalogResponse( + 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 UpdateCatalogResponse && equalTo((UpdateCatalogResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateCatalogResponse 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(UpdateCatalogResponse other); + } + + public interface _FinalStage { + UpdateCatalogResponse 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(UpdateCatalogResponse 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 UpdateCatalogResponse build() { + return new UpdateCatalogResponse(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/UpdateConfigurationResponse.java b/src/main/java/com/schematic/api/resources/catalogs/types/UpdateConfigurationResponse.java new file mode 100644 index 00000000..bcf3aeea --- /dev/null +++ b/src/main/java/com/schematic/api/resources/catalogs/types/UpdateConfigurationResponse.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 = UpdateConfigurationResponse.Builder.class) +public final class UpdateConfigurationResponse { + private final CatalogResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private UpdateConfigurationResponse( + 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 UpdateConfigurationResponse && equalTo((UpdateConfigurationResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateConfigurationResponse 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(UpdateConfigurationResponse other); + } + + public interface _FinalStage { + UpdateConfigurationResponse 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(UpdateConfigurationResponse 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 UpdateConfigurationResponse build() { + return new UpdateConfigurationResponse(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/checkout/AsyncCheckoutClient.java b/src/main/java/com/schematic/api/resources/checkout/AsyncCheckoutClient.java index b47818d6..fd712702 100644 --- a/src/main/java/com/schematic/api/resources/checkout/AsyncCheckoutClient.java +++ b/src/main/java/com/schematic/api/resources/checkout/AsyncCheckoutClient.java @@ -7,13 +7,16 @@ import com.schematic.api.core.RequestOptions; import com.schematic.api.resources.checkout.requests.CancelSubscriptionRequest; import com.schematic.api.resources.checkout.requests.CheckoutDataRequestBody; +import com.schematic.api.resources.checkout.requests.UpdateCompanyBillingDetailsRequestBody; import com.schematic.api.resources.checkout.requests.UpdateTrialEndRequestBody; import com.schematic.api.resources.checkout.types.CancelSubscriptionResponse; import com.schematic.api.resources.checkout.types.CheckoutInternalResponse; import com.schematic.api.resources.checkout.types.GetCheckoutDataResponse; +import com.schematic.api.resources.checkout.types.GetCompanyBillingDetailsResponse; import com.schematic.api.resources.checkout.types.ManagePlanResponse; import com.schematic.api.resources.checkout.types.PreviewCheckoutInternalResponse; import com.schematic.api.resources.checkout.types.PreviewManagePlanResponse; +import com.schematic.api.resources.checkout.types.UpdateCompanyBillingDetailsResponse; import com.schematic.api.resources.checkout.types.UpdateCustomerSubscriptionTrialEndResponse; import com.schematic.api.types.ChangeSubscriptionInternalRequestBody; import com.schematic.api.types.ManagePlanRequest; @@ -64,6 +67,29 @@ public CompletableFuture previewCheckoutInterna return this.rawClient.previewCheckoutInternal(request, requestOptions).thenApply(response -> response.body()); } + public CompletableFuture getCompanyBillingDetails(String companyId) { + return this.rawClient.getCompanyBillingDetails(companyId).thenApply(response -> response.body()); + } + + public CompletableFuture getCompanyBillingDetails( + String companyId, RequestOptions requestOptions) { + return this.rawClient + .getCompanyBillingDetails(companyId, requestOptions) + .thenApply(response -> response.body()); + } + + public CompletableFuture updateCompanyBillingDetails( + String companyId, UpdateCompanyBillingDetailsRequestBody request) { + return this.rawClient.updateCompanyBillingDetails(companyId, request).thenApply(response -> response.body()); + } + + public CompletableFuture updateCompanyBillingDetails( + String companyId, UpdateCompanyBillingDetailsRequestBody request, RequestOptions requestOptions) { + return this.rawClient + .updateCompanyBillingDetails(companyId, request, requestOptions) + .thenApply(response -> response.body()); + } + public CompletableFuture managePlan(ManagePlanRequest request) { return this.rawClient.managePlan(request).thenApply(response -> response.body()); } diff --git a/src/main/java/com/schematic/api/resources/checkout/AsyncRawCheckoutClient.java b/src/main/java/com/schematic/api/resources/checkout/AsyncRawCheckoutClient.java index 32d9ba20..d4e224dc 100644 --- a/src/main/java/com/schematic/api/resources/checkout/AsyncRawCheckoutClient.java +++ b/src/main/java/com/schematic/api/resources/checkout/AsyncRawCheckoutClient.java @@ -19,13 +19,16 @@ import com.schematic.api.errors.UnauthorizedError; import com.schematic.api.resources.checkout.requests.CancelSubscriptionRequest; import com.schematic.api.resources.checkout.requests.CheckoutDataRequestBody; +import com.schematic.api.resources.checkout.requests.UpdateCompanyBillingDetailsRequestBody; import com.schematic.api.resources.checkout.requests.UpdateTrialEndRequestBody; import com.schematic.api.resources.checkout.types.CancelSubscriptionResponse; import com.schematic.api.resources.checkout.types.CheckoutInternalResponse; import com.schematic.api.resources.checkout.types.GetCheckoutDataResponse; +import com.schematic.api.resources.checkout.types.GetCompanyBillingDetailsResponse; import com.schematic.api.resources.checkout.types.ManagePlanResponse; import com.schematic.api.resources.checkout.types.PreviewCheckoutInternalResponse; import com.schematic.api.resources.checkout.types.PreviewManagePlanResponse; +import com.schematic.api.resources.checkout.types.UpdateCompanyBillingDetailsResponse; import com.schematic.api.resources.checkout.types.UpdateCustomerSubscriptionTrialEndResponse; import com.schematic.api.types.ApiError; import com.schematic.api.types.ChangeSubscriptionInternalRequestBody; @@ -367,6 +370,212 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } + public CompletableFuture> getCompanyBillingDetails( + String companyId) { + return getCompanyBillingDetails(companyId, null); + } + + public CompletableFuture> getCompanyBillingDetails( + String companyId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("companies") + .addPathSegment(companyId) + .addPathSegments("billing-details"); + 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, GetCompanyBillingDetailsResponse.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> + updateCompanyBillingDetails(String companyId, UpdateCompanyBillingDetailsRequestBody request) { + return updateCompanyBillingDetails(companyId, request, null); + } + + public CompletableFuture> + updateCompanyBillingDetails( + String companyId, UpdateCompanyBillingDetailsRequestBody request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("companies") + .addPathSegment(companyId) + .addPathSegments("billing-details"); + 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, UpdateCompanyBillingDetailsResponse.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> managePlan(ManagePlanRequest request) { return managePlan(request, null); } diff --git a/src/main/java/com/schematic/api/resources/checkout/CheckoutClient.java b/src/main/java/com/schematic/api/resources/checkout/CheckoutClient.java index 7ff3fe22..0308874a 100644 --- a/src/main/java/com/schematic/api/resources/checkout/CheckoutClient.java +++ b/src/main/java/com/schematic/api/resources/checkout/CheckoutClient.java @@ -7,13 +7,16 @@ import com.schematic.api.core.RequestOptions; import com.schematic.api.resources.checkout.requests.CancelSubscriptionRequest; import com.schematic.api.resources.checkout.requests.CheckoutDataRequestBody; +import com.schematic.api.resources.checkout.requests.UpdateCompanyBillingDetailsRequestBody; import com.schematic.api.resources.checkout.requests.UpdateTrialEndRequestBody; import com.schematic.api.resources.checkout.types.CancelSubscriptionResponse; import com.schematic.api.resources.checkout.types.CheckoutInternalResponse; import com.schematic.api.resources.checkout.types.GetCheckoutDataResponse; +import com.schematic.api.resources.checkout.types.GetCompanyBillingDetailsResponse; import com.schematic.api.resources.checkout.types.ManagePlanResponse; import com.schematic.api.resources.checkout.types.PreviewCheckoutInternalResponse; import com.schematic.api.resources.checkout.types.PreviewManagePlanResponse; +import com.schematic.api.resources.checkout.types.UpdateCompanyBillingDetailsResponse; import com.schematic.api.resources.checkout.types.UpdateCustomerSubscriptionTrialEndResponse; import com.schematic.api.types.ChangeSubscriptionInternalRequestBody; import com.schematic.api.types.ManagePlanRequest; @@ -61,6 +64,28 @@ public PreviewCheckoutInternalResponse previewCheckoutInternal( return this.rawClient.previewCheckoutInternal(request, requestOptions).body(); } + public GetCompanyBillingDetailsResponse getCompanyBillingDetails(String companyId) { + return this.rawClient.getCompanyBillingDetails(companyId).body(); + } + + public GetCompanyBillingDetailsResponse getCompanyBillingDetails(String companyId, RequestOptions requestOptions) { + return this.rawClient + .getCompanyBillingDetails(companyId, requestOptions) + .body(); + } + + public UpdateCompanyBillingDetailsResponse updateCompanyBillingDetails( + String companyId, UpdateCompanyBillingDetailsRequestBody request) { + return this.rawClient.updateCompanyBillingDetails(companyId, request).body(); + } + + public UpdateCompanyBillingDetailsResponse updateCompanyBillingDetails( + String companyId, UpdateCompanyBillingDetailsRequestBody request, RequestOptions requestOptions) { + return this.rawClient + .updateCompanyBillingDetails(companyId, request, requestOptions) + .body(); + } + public ManagePlanResponse managePlan(ManagePlanRequest request) { return this.rawClient.managePlan(request).body(); } diff --git a/src/main/java/com/schematic/api/resources/checkout/RawCheckoutClient.java b/src/main/java/com/schematic/api/resources/checkout/RawCheckoutClient.java index 2ff09bf5..873559e8 100644 --- a/src/main/java/com/schematic/api/resources/checkout/RawCheckoutClient.java +++ b/src/main/java/com/schematic/api/resources/checkout/RawCheckoutClient.java @@ -19,13 +19,16 @@ import com.schematic.api.errors.UnauthorizedError; import com.schematic.api.resources.checkout.requests.CancelSubscriptionRequest; import com.schematic.api.resources.checkout.requests.CheckoutDataRequestBody; +import com.schematic.api.resources.checkout.requests.UpdateCompanyBillingDetailsRequestBody; import com.schematic.api.resources.checkout.requests.UpdateTrialEndRequestBody; import com.schematic.api.resources.checkout.types.CancelSubscriptionResponse; import com.schematic.api.resources.checkout.types.CheckoutInternalResponse; import com.schematic.api.resources.checkout.types.GetCheckoutDataResponse; +import com.schematic.api.resources.checkout.types.GetCompanyBillingDetailsResponse; import com.schematic.api.resources.checkout.types.ManagePlanResponse; import com.schematic.api.resources.checkout.types.PreviewCheckoutInternalResponse; import com.schematic.api.resources.checkout.types.PreviewManagePlanResponse; +import com.schematic.api.resources.checkout.types.UpdateCompanyBillingDetailsResponse; import com.schematic.api.resources.checkout.types.UpdateCustomerSubscriptionTrialEndResponse; import com.schematic.api.types.ApiError; import com.schematic.api.types.ChangeSubscriptionInternalRequestBody; @@ -287,6 +290,161 @@ public BaseSchematicHttpResponse previewCheckou } } + public BaseSchematicHttpResponse getCompanyBillingDetails(String companyId) { + return getCompanyBillingDetails(companyId, null); + } + + public BaseSchematicHttpResponse getCompanyBillingDetails( + String companyId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("companies") + .addPathSegment(companyId) + .addPathSegments("billing-details"); + 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, GetCompanyBillingDetailsResponse.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 updateCompanyBillingDetails( + String companyId, UpdateCompanyBillingDetailsRequestBody request) { + return updateCompanyBillingDetails(companyId, request, null); + } + + public BaseSchematicHttpResponse updateCompanyBillingDetails( + String companyId, UpdateCompanyBillingDetailsRequestBody request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("companies") + .addPathSegment(companyId) + .addPathSegments("billing-details"); + 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, UpdateCompanyBillingDetailsResponse.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 managePlan(ManagePlanRequest request) { return managePlan(request, null); } diff --git a/src/main/java/com/schematic/api/resources/checkout/requests/UpdateCompanyBillingDetailsRequestBody.java b/src/main/java/com/schematic/api/resources/checkout/requests/UpdateCompanyBillingDetailsRequestBody.java new file mode 100644 index 00000000..afa4bcc0 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/checkout/requests/UpdateCompanyBillingDetailsRequestBody.java @@ -0,0 +1,194 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.checkout.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.CheckoutFieldValue; +import com.schematic.api.types.CustomerBillingAddress; +import java.util.ArrayList; +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 = UpdateCompanyBillingDetailsRequestBody.Builder.class) +public final class UpdateCompanyBillingDetailsRequestBody { + private final Optional address; + + private final Optional email; + + private final Optional phone; + + private final List values; + + private final Map additionalProperties; + + private UpdateCompanyBillingDetailsRequestBody( + Optional address, + Optional email, + Optional phone, + List values, + Map additionalProperties) { + this.address = address; + this.email = email; + this.phone = phone; + this.values = values; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("address") + public Optional getAddress() { + return address; + } + + @JsonProperty("email") + public Optional getEmail() { + return email; + } + + @JsonProperty("phone") + public Optional getPhone() { + return phone; + } + + @JsonProperty("values") + public List getValues() { + return values; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateCompanyBillingDetailsRequestBody + && equalTo((UpdateCompanyBillingDetailsRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateCompanyBillingDetailsRequestBody other) { + return address.equals(other.address) + && email.equals(other.email) + && phone.equals(other.phone) + && values.equals(other.values); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.address, this.email, this.phone, this.values); + } + + @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 address = Optional.empty(); + + private Optional email = Optional.empty(); + + private Optional phone = Optional.empty(); + + private List values = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateCompanyBillingDetailsRequestBody other) { + address(other.getAddress()); + email(other.getEmail()); + phone(other.getPhone()); + values(other.getValues()); + return this; + } + + @JsonSetter(value = "address", nulls = Nulls.SKIP) + public Builder address(Optional address) { + this.address = address; + return this; + } + + public Builder address(CustomerBillingAddress address) { + this.address = Optional.ofNullable(address); + return this; + } + + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public Builder email(Optional email) { + this.email = email; + return this; + } + + public Builder email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + @JsonSetter(value = "phone", nulls = Nulls.SKIP) + public Builder phone(Optional phone) { + this.phone = phone; + return this; + } + + public Builder phone(String phone) { + this.phone = Optional.ofNullable(phone); + return this; + } + + @JsonSetter(value = "values", nulls = Nulls.SKIP) + public Builder values(List values) { + this.values.clear(); + if (values != null) { + this.values.addAll(values); + } + return this; + } + + public Builder addValues(CheckoutFieldValue values) { + this.values.add(values); + return this; + } + + public Builder addAllValues(List values) { + if (values != null) { + this.values.addAll(values); + } + return this; + } + + public UpdateCompanyBillingDetailsRequestBody build() { + return new UpdateCompanyBillingDetailsRequestBody(address, email, phone, values, 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/checkout/types/GetCompanyBillingDetailsResponse.java b/src/main/java/com/schematic/api/resources/checkout/types/GetCompanyBillingDetailsResponse.java new file mode 100644 index 00000000..f42e7823 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/checkout/types/GetCompanyBillingDetailsResponse.java @@ -0,0 +1,183 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.checkout.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.CompanyBillingDetailsResponseData; +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 = GetCompanyBillingDetailsResponse.Builder.class) +public final class GetCompanyBillingDetailsResponse { + private final CompanyBillingDetailsResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private GetCompanyBillingDetailsResponse( + CompanyBillingDetailsResponseData data, + Map params, + Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public CompanyBillingDetailsResponseData 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 GetCompanyBillingDetailsResponse && equalTo((GetCompanyBillingDetailsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetCompanyBillingDetailsResponse 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 CompanyBillingDetailsResponseData data); + + Builder from(GetCompanyBillingDetailsResponse other); + } + + public interface _FinalStage { + GetCompanyBillingDetailsResponse 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 CompanyBillingDetailsResponseData data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetCompanyBillingDetailsResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull CompanyBillingDetailsResponseData 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 GetCompanyBillingDetailsResponse build() { + return new GetCompanyBillingDetailsResponse(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/checkout/types/UpdateCompanyBillingDetailsResponse.java b/src/main/java/com/schematic/api/resources/checkout/types/UpdateCompanyBillingDetailsResponse.java new file mode 100644 index 00000000..d915bd65 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/checkout/types/UpdateCompanyBillingDetailsResponse.java @@ -0,0 +1,184 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.checkout.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.CompanyBillingDetailsResponseData; +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 = UpdateCompanyBillingDetailsResponse.Builder.class) +public final class UpdateCompanyBillingDetailsResponse { + private final CompanyBillingDetailsResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private UpdateCompanyBillingDetailsResponse( + CompanyBillingDetailsResponseData data, + Map params, + Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public CompanyBillingDetailsResponseData 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 UpdateCompanyBillingDetailsResponse + && equalTo((UpdateCompanyBillingDetailsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateCompanyBillingDetailsResponse 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 CompanyBillingDetailsResponseData data); + + Builder from(UpdateCompanyBillingDetailsResponse other); + } + + public interface _FinalStage { + UpdateCompanyBillingDetailsResponse 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 CompanyBillingDetailsResponseData data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateCompanyBillingDetailsResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull CompanyBillingDetailsResponseData 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 UpdateCompanyBillingDetailsResponse build() { + return new UpdateCompanyBillingDetailsResponse(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/components/AsyncComponentsClient.java b/src/main/java/com/schematic/api/resources/components/AsyncComponentsClient.java index b4a88ae6..b9455b81 100644 --- a/src/main/java/com/schematic/api/resources/components/AsyncComponentsClient.java +++ b/src/main/java/com/schematic/api/resources/components/AsyncComponentsClient.java @@ -5,11 +5,13 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.RequestOptions; +import com.schematic.api.resources.components.requests.BindCatalogRequestBody; import com.schematic.api.resources.components.requests.CountComponentsRequest; import com.schematic.api.resources.components.requests.CreateComponentRequestBody; import com.schematic.api.resources.components.requests.ListComponentsRequest; import com.schematic.api.resources.components.requests.PreviewComponentDataRequest; import com.schematic.api.resources.components.requests.UpdateComponentRequestBody; +import com.schematic.api.resources.components.types.BindCatalogResponse; import com.schematic.api.resources.components.types.CountComponentsResponse; import com.schematic.api.resources.components.types.CreateComponentResponse; import com.schematic.api.resources.components.types.DeleteComponentResponse; @@ -100,6 +102,23 @@ public CompletableFuture deleteComponent( return this.rawClient.deleteComponent(componentId, requestOptions).thenApply(response -> response.body()); } + public CompletableFuture bindCatalog(String componentId) { + return this.rawClient.bindCatalog(componentId).thenApply(response -> response.body()); + } + + public CompletableFuture bindCatalog(String componentId, RequestOptions requestOptions) { + return this.rawClient.bindCatalog(componentId, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture bindCatalog(String componentId, BindCatalogRequestBody request) { + return this.rawClient.bindCatalog(componentId, request).thenApply(response -> response.body()); + } + + public CompletableFuture bindCatalog( + String componentId, BindCatalogRequestBody request, RequestOptions requestOptions) { + return this.rawClient.bindCatalog(componentId, request, requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture countComponents() { return this.rawClient.countComponents().thenApply(response -> response.body()); } diff --git a/src/main/java/com/schematic/api/resources/components/AsyncRawComponentsClient.java b/src/main/java/com/schematic/api/resources/components/AsyncRawComponentsClient.java index b1c992aa..5d230843 100644 --- a/src/main/java/com/schematic/api/resources/components/AsyncRawComponentsClient.java +++ b/src/main/java/com/schematic/api/resources/components/AsyncRawComponentsClient.java @@ -18,11 +18,13 @@ import com.schematic.api.errors.InternalServerError; import com.schematic.api.errors.NotFoundError; import com.schematic.api.errors.UnauthorizedError; +import com.schematic.api.resources.components.requests.BindCatalogRequestBody; import com.schematic.api.resources.components.requests.CountComponentsRequest; import com.schematic.api.resources.components.requests.CreateComponentRequestBody; import com.schematic.api.resources.components.requests.ListComponentsRequest; import com.schematic.api.resources.components.requests.PreviewComponentDataRequest; import com.schematic.api.resources.components.requests.UpdateComponentRequestBody; +import com.schematic.api.resources.components.types.BindCatalogResponse; import com.schematic.api.resources.components.types.CountComponentsResponse; import com.schematic.api.resources.components.types.CreateComponentResponse; import com.schematic.api.resources.components.types.DeleteComponentResponse; @@ -577,6 +579,122 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } + public CompletableFuture> bindCatalog(String componentId) { + return bindCatalog(componentId, BindCatalogRequestBody.builder().build()); + } + + public CompletableFuture> bindCatalog( + String componentId, RequestOptions requestOptions) { + return bindCatalog(componentId, BindCatalogRequestBody.builder().build(), requestOptions); + } + + public CompletableFuture> bindCatalog( + String componentId, BindCatalogRequestBody request) { + return bindCatalog(componentId, request, null); + } + + public CompletableFuture> bindCatalog( + String componentId, BindCatalogRequestBody request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("components") + .addPathSegment(componentId) + .addPathSegments("catalog"); + 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, BindCatalogResponse.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> countComponents() { return countComponents(CountComponentsRequest.builder().build()); } diff --git a/src/main/java/com/schematic/api/resources/components/ComponentsClient.java b/src/main/java/com/schematic/api/resources/components/ComponentsClient.java index b74cc6ec..3efb25ce 100644 --- a/src/main/java/com/schematic/api/resources/components/ComponentsClient.java +++ b/src/main/java/com/schematic/api/resources/components/ComponentsClient.java @@ -5,11 +5,13 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.RequestOptions; +import com.schematic.api.resources.components.requests.BindCatalogRequestBody; import com.schematic.api.resources.components.requests.CountComponentsRequest; import com.schematic.api.resources.components.requests.CreateComponentRequestBody; import com.schematic.api.resources.components.requests.ListComponentsRequest; import com.schematic.api.resources.components.requests.PreviewComponentDataRequest; import com.schematic.api.resources.components.requests.UpdateComponentRequestBody; +import com.schematic.api.resources.components.types.BindCatalogResponse; import com.schematic.api.resources.components.types.CountComponentsResponse; import com.schematic.api.resources.components.types.CreateComponentResponse; import com.schematic.api.resources.components.types.DeleteComponentResponse; @@ -94,6 +96,23 @@ public DeleteComponentResponse deleteComponent(String componentId, RequestOption return this.rawClient.deleteComponent(componentId, requestOptions).body(); } + public BindCatalogResponse bindCatalog(String componentId) { + return this.rawClient.bindCatalog(componentId).body(); + } + + public BindCatalogResponse bindCatalog(String componentId, RequestOptions requestOptions) { + return this.rawClient.bindCatalog(componentId, requestOptions).body(); + } + + public BindCatalogResponse bindCatalog(String componentId, BindCatalogRequestBody request) { + return this.rawClient.bindCatalog(componentId, request).body(); + } + + public BindCatalogResponse bindCatalog( + String componentId, BindCatalogRequestBody request, RequestOptions requestOptions) { + return this.rawClient.bindCatalog(componentId, request, requestOptions).body(); + } + public CountComponentsResponse countComponents() { return this.rawClient.countComponents().body(); } diff --git a/src/main/java/com/schematic/api/resources/components/RawComponentsClient.java b/src/main/java/com/schematic/api/resources/components/RawComponentsClient.java index 2ba1f055..0f45b884 100644 --- a/src/main/java/com/schematic/api/resources/components/RawComponentsClient.java +++ b/src/main/java/com/schematic/api/resources/components/RawComponentsClient.java @@ -18,11 +18,13 @@ import com.schematic.api.errors.InternalServerError; import com.schematic.api.errors.NotFoundError; import com.schematic.api.errors.UnauthorizedError; +import com.schematic.api.resources.components.requests.BindCatalogRequestBody; import com.schematic.api.resources.components.requests.CountComponentsRequest; import com.schematic.api.resources.components.requests.CreateComponentRequestBody; import com.schematic.api.resources.components.requests.ListComponentsRequest; import com.schematic.api.resources.components.requests.PreviewComponentDataRequest; import com.schematic.api.resources.components.requests.UpdateComponentRequestBody; +import com.schematic.api.resources.components.types.BindCatalogResponse; import com.schematic.api.resources.components.types.CountComponentsResponse; import com.schematic.api.resources.components.types.CreateComponentResponse; import com.schematic.api.resources.components.types.DeleteComponentResponse; @@ -451,6 +453,97 @@ public BaseSchematicHttpResponse deleteComponent( } } + public BaseSchematicHttpResponse bindCatalog(String componentId) { + return bindCatalog(componentId, BindCatalogRequestBody.builder().build()); + } + + public BaseSchematicHttpResponse bindCatalog( + String componentId, RequestOptions requestOptions) { + return bindCatalog(componentId, BindCatalogRequestBody.builder().build(), requestOptions); + } + + public BaseSchematicHttpResponse bindCatalog( + String componentId, BindCatalogRequestBody request) { + return bindCatalog(componentId, request, null); + } + + public BaseSchematicHttpResponse bindCatalog( + String componentId, BindCatalogRequestBody request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("components") + .addPathSegment(componentId) + .addPathSegments("catalog"); + 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, BindCatalogResponse.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 countComponents() { return countComponents(CountComponentsRequest.builder().build()); } diff --git a/src/main/java/com/schematic/api/resources/components/requests/BindCatalogRequestBody.java b/src/main/java/com/schematic/api/resources/components/requests/BindCatalogRequestBody.java new file mode 100644 index 00000000..cb8e0fcb --- /dev/null +++ b/src/main/java/com/schematic/api/resources/components/requests/BindCatalogRequestBody.java @@ -0,0 +1,105 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.components.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 = BindCatalogRequestBody.Builder.class) +public final class BindCatalogRequestBody { + private final Optional catalogId; + + private final Map additionalProperties; + + private BindCatalogRequestBody(Optional catalogId, Map additionalProperties) { + this.catalogId = catalogId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("catalog_id") + public Optional getCatalogId() { + return catalogId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BindCatalogRequestBody && equalTo((BindCatalogRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BindCatalogRequestBody other) { + return catalogId.equals(other.catalogId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.catalogId); + } + + @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 catalogId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(BindCatalogRequestBody other) { + catalogId(other.getCatalogId()); + return this; + } + + @JsonSetter(value = "catalog_id", nulls = Nulls.SKIP) + public Builder catalogId(Optional catalogId) { + this.catalogId = catalogId; + return this; + } + + public Builder catalogId(String catalogId) { + this.catalogId = Optional.ofNullable(catalogId); + return this; + } + + public BindCatalogRequestBody build() { + return new BindCatalogRequestBody(catalogId, 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/components/types/BindCatalogResponse.java b/src/main/java/com/schematic/api/resources/components/types/BindCatalogResponse.java new file mode 100644 index 00000000..a0fa0e17 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/components/types/BindCatalogResponse.java @@ -0,0 +1,181 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.components.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.ComponentResponseData; +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 = BindCatalogResponse.Builder.class) +public final class BindCatalogResponse { + private final ComponentResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private BindCatalogResponse( + ComponentResponseData data, Map params, Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public ComponentResponseData 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 BindCatalogResponse && equalTo((BindCatalogResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BindCatalogResponse 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 ComponentResponseData data); + + Builder from(BindCatalogResponse other); + } + + public interface _FinalStage { + BindCatalogResponse 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 ComponentResponseData data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(BindCatalogResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull ComponentResponseData 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 BindCatalogResponse build() { + return new BindCatalogResponse(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/dataexports/AsyncDataexportsClient.java b/src/main/java/com/schematic/api/resources/dataexports/AsyncDataexportsClient.java index 98d913b8..a121d39d 100644 --- a/src/main/java/com/schematic/api/resources/dataexports/AsyncDataexportsClient.java +++ b/src/main/java/com/schematic/api/resources/dataexports/AsyncDataexportsClient.java @@ -6,7 +6,10 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.RequestOptions; import com.schematic.api.resources.dataexports.requests.CreateDataExportRequestBody; +import com.schematic.api.resources.dataexports.requests.ListDataExportsRequest; import com.schematic.api.resources.dataexports.types.CreateDataExportResponse; +import com.schematic.api.resources.dataexports.types.GetDataExportResponse; +import com.schematic.api.resources.dataexports.types.ListDataExportsResponse; import java.io.InputStream; import java.util.concurrent.CompletableFuture; @@ -27,6 +30,23 @@ public AsyncRawDataexportsClient withRawResponse() { return this.rawClient; } + public CompletableFuture listDataExports() { + return this.rawClient.listDataExports().thenApply(response -> response.body()); + } + + public CompletableFuture listDataExports(RequestOptions requestOptions) { + return this.rawClient.listDataExports(requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture listDataExports(ListDataExportsRequest request) { + return this.rawClient.listDataExports(request).thenApply(response -> response.body()); + } + + public CompletableFuture listDataExports( + ListDataExportsRequest request, RequestOptions requestOptions) { + return this.rawClient.listDataExports(request, requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture createDataExport(CreateDataExportRequestBody request) { return this.rawClient.createDataExport(request).thenApply(response -> response.body()); } @@ -36,6 +56,14 @@ public CompletableFuture createDataExport( return this.rawClient.createDataExport(request, requestOptions).thenApply(response -> response.body()); } + public CompletableFuture getDataExport(String dataExportId) { + return this.rawClient.getDataExport(dataExportId).thenApply(response -> response.body()); + } + + public CompletableFuture getDataExport(String dataExportId, RequestOptions requestOptions) { + return this.rawClient.getDataExport(dataExportId, requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture getDataExportArtifact(String dataExportId) { return this.rawClient.getDataExportArtifact(dataExportId).thenApply(response -> response.body()); } diff --git a/src/main/java/com/schematic/api/resources/dataexports/AsyncRawDataexportsClient.java b/src/main/java/com/schematic/api/resources/dataexports/AsyncRawDataexportsClient.java index 25b21261..00b9f774 100644 --- a/src/main/java/com/schematic/api/resources/dataexports/AsyncRawDataexportsClient.java +++ b/src/main/java/com/schematic/api/resources/dataexports/AsyncRawDataexportsClient.java @@ -10,6 +10,7 @@ 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.ResponseBodyInputStream; import com.schematic.api.core.RetryInterceptor; @@ -19,7 +20,10 @@ import com.schematic.api.errors.NotFoundError; import com.schematic.api.errors.UnauthorizedError; import com.schematic.api.resources.dataexports.requests.CreateDataExportRequestBody; +import com.schematic.api.resources.dataexports.requests.ListDataExportsRequest; import com.schematic.api.resources.dataexports.types.CreateDataExportResponse; +import com.schematic.api.resources.dataexports.types.GetDataExportResponse; +import com.schematic.api.resources.dataexports.types.ListDataExportsResponse; import com.schematic.api.types.ApiError; import java.io.IOException; import java.io.InputStream; @@ -42,6 +46,128 @@ public AsyncRawDataexportsClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } + public CompletableFuture> listDataExports() { + return listDataExports(ListDataExportsRequest.builder().build()); + } + + public CompletableFuture> listDataExports( + RequestOptions requestOptions) { + return listDataExports(ListDataExportsRequest.builder().build(), requestOptions); + } + + public CompletableFuture> listDataExports( + ListDataExportsRequest request) { + return listDataExports(request, null); + } + + public CompletableFuture> listDataExports( + ListDataExportsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("data-exports"); + if (request.getExportType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "export_type", request.getExportType().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().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, ListDataExportsResponse.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> createDataExport( CreateDataExportRequestBody request) { return createDataExport(request, null); @@ -147,6 +273,98 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } + public CompletableFuture> getDataExport(String dataExportId) { + return getDataExport(dataExportId, null); + } + + public CompletableFuture> getDataExport( + String dataExportId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("data-exports") + .addPathSegment(dataExportId); + 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, GetDataExportResponse.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> getDataExportArtifact(String dataExportId) { return getDataExportArtifact(dataExportId, null); } diff --git a/src/main/java/com/schematic/api/resources/dataexports/DataexportsClient.java b/src/main/java/com/schematic/api/resources/dataexports/DataexportsClient.java index 4b95499d..87f7ed14 100644 --- a/src/main/java/com/schematic/api/resources/dataexports/DataexportsClient.java +++ b/src/main/java/com/schematic/api/resources/dataexports/DataexportsClient.java @@ -6,7 +6,10 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.RequestOptions; import com.schematic.api.resources.dataexports.requests.CreateDataExportRequestBody; +import com.schematic.api.resources.dataexports.requests.ListDataExportsRequest; import com.schematic.api.resources.dataexports.types.CreateDataExportResponse; +import com.schematic.api.resources.dataexports.types.GetDataExportResponse; +import com.schematic.api.resources.dataexports.types.ListDataExportsResponse; import java.io.InputStream; public class DataexportsClient { @@ -26,6 +29,22 @@ public RawDataexportsClient withRawResponse() { return this.rawClient; } + public ListDataExportsResponse listDataExports() { + return this.rawClient.listDataExports().body(); + } + + public ListDataExportsResponse listDataExports(RequestOptions requestOptions) { + return this.rawClient.listDataExports(requestOptions).body(); + } + + public ListDataExportsResponse listDataExports(ListDataExportsRequest request) { + return this.rawClient.listDataExports(request).body(); + } + + public ListDataExportsResponse listDataExports(ListDataExportsRequest request, RequestOptions requestOptions) { + return this.rawClient.listDataExports(request, requestOptions).body(); + } + public CreateDataExportResponse createDataExport(CreateDataExportRequestBody request) { return this.rawClient.createDataExport(request).body(); } @@ -35,6 +54,14 @@ public CreateDataExportResponse createDataExport( return this.rawClient.createDataExport(request, requestOptions).body(); } + public GetDataExportResponse getDataExport(String dataExportId) { + return this.rawClient.getDataExport(dataExportId).body(); + } + + public GetDataExportResponse getDataExport(String dataExportId, RequestOptions requestOptions) { + return this.rawClient.getDataExport(dataExportId, requestOptions).body(); + } + public InputStream getDataExportArtifact(String dataExportId) { return this.rawClient.getDataExportArtifact(dataExportId).body(); } diff --git a/src/main/java/com/schematic/api/resources/dataexports/RawDataexportsClient.java b/src/main/java/com/schematic/api/resources/dataexports/RawDataexportsClient.java index 0d70095b..1a4bb357 100644 --- a/src/main/java/com/schematic/api/resources/dataexports/RawDataexportsClient.java +++ b/src/main/java/com/schematic/api/resources/dataexports/RawDataexportsClient.java @@ -10,6 +10,7 @@ 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.ResponseBodyInputStream; import com.schematic.api.core.RetryInterceptor; @@ -19,7 +20,10 @@ import com.schematic.api.errors.NotFoundError; import com.schematic.api.errors.UnauthorizedError; import com.schematic.api.resources.dataexports.requests.CreateDataExportRequestBody; +import com.schematic.api.resources.dataexports.requests.ListDataExportsRequest; import com.schematic.api.resources.dataexports.types.CreateDataExportResponse; +import com.schematic.api.resources.dataexports.types.GetDataExportResponse; +import com.schematic.api.resources.dataexports.types.ListDataExportsResponse; import com.schematic.api.types.ApiError; import java.io.IOException; import java.io.InputStream; @@ -38,6 +42,102 @@ public RawDataexportsClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } + public BaseSchematicHttpResponse listDataExports() { + return listDataExports(ListDataExportsRequest.builder().build()); + } + + public BaseSchematicHttpResponse listDataExports(RequestOptions requestOptions) { + return listDataExports(ListDataExportsRequest.builder().build(), requestOptions); + } + + public BaseSchematicHttpResponse listDataExports(ListDataExportsRequest request) { + return listDataExports(request, null); + } + + public BaseSchematicHttpResponse listDataExports( + ListDataExportsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("data-exports"); + if (request.getExportType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "export_type", request.getExportType().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().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, ListDataExportsResponse.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 createDataExport(CreateDataExportRequestBody request) { return createDataExport(request, null); } @@ -118,6 +218,75 @@ public BaseSchematicHttpResponse createDataExport( } } + public BaseSchematicHttpResponse getDataExport(String dataExportId) { + return getDataExport(dataExportId, null); + } + + public BaseSchematicHttpResponse getDataExport( + String dataExportId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("data-exports") + .addPathSegment(dataExportId); + 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, GetDataExportResponse.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 getDataExportArtifact(String dataExportId) { return getDataExportArtifact(dataExportId, null); } diff --git a/src/main/java/com/schematic/api/resources/dataexports/requests/CreateDataExportRequestBody.java b/src/main/java/com/schematic/api/resources/dataexports/requests/CreateDataExportRequestBody.java index 0602b6a3..da5a7df7 100644 --- a/src/main/java/com/schematic/api/resources/dataexports/requests/CreateDataExportRequestBody.java +++ b/src/main/java/com/schematic/api/resources/dataexports/requests/CreateDataExportRequestBody.java @@ -9,26 +9,34 @@ 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.DataExportMetadata; +import com.schematic.api.types.DataExportOutputFileType; +import com.schematic.api.types.DataExportType; 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 = CreateDataExportRequestBody.Builder.class) public final class CreateDataExportRequestBody { - private final String exportType; + private final DataExportType exportType; - private final String metadata; + private final Optional metadata; - private final String outputFileType; + private final DataExportOutputFileType outputFileType; private final Map additionalProperties; private CreateDataExportRequestBody( - String exportType, String metadata, String outputFileType, Map additionalProperties) { + DataExportType exportType, + Optional metadata, + DataExportOutputFileType outputFileType, + Map additionalProperties) { this.exportType = exportType; this.metadata = metadata; this.outputFileType = outputFileType; @@ -36,17 +44,17 @@ private CreateDataExportRequestBody( } @JsonProperty("export_type") - public String getExportType() { + public DataExportType getExportType() { return exportType; } @JsonProperty("metadata") - public String getMetadata() { + public Optional getMetadata() { return metadata; } @JsonProperty("output_file_type") - public String getOutputFileType() { + public DataExportOutputFileType getOutputFileType() { return outputFileType; } @@ -82,17 +90,13 @@ public static ExportTypeStage builder() { } public interface ExportTypeStage { - MetadataStage exportType(@NotNull String exportType); + OutputFileTypeStage exportType(@NotNull DataExportType exportType); Builder from(CreateDataExportRequestBody other); } - public interface MetadataStage { - OutputFileTypeStage metadata(@NotNull String metadata); - } - public interface OutputFileTypeStage { - _FinalStage outputFileType(@NotNull String outputFileType); + _FinalStage outputFileType(@NotNull DataExportOutputFileType outputFileType); } public interface _FinalStage { @@ -101,15 +105,19 @@ public interface _FinalStage { _FinalStage additionalProperty(String key, Object value); _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage metadata(Optional metadata); + + _FinalStage metadata(DataExportMetadata metadata); } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ExportTypeStage, MetadataStage, OutputFileTypeStage, _FinalStage { - private String exportType; + public static final class Builder implements ExportTypeStage, OutputFileTypeStage, _FinalStage { + private DataExportType exportType; - private String metadata; + private DataExportOutputFileType outputFileType; - private String outputFileType; + private Optional metadata = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -126,22 +134,28 @@ public Builder from(CreateDataExportRequestBody other) { @java.lang.Override @JsonSetter("export_type") - public MetadataStage exportType(@NotNull String exportType) { + public OutputFileTypeStage exportType(@NotNull DataExportType exportType) { this.exportType = Objects.requireNonNull(exportType, "exportType must not be null"); return this; } @java.lang.Override - @JsonSetter("metadata") - public OutputFileTypeStage metadata(@NotNull String metadata) { - this.metadata = Objects.requireNonNull(metadata, "metadata must not be null"); + @JsonSetter("output_file_type") + public _FinalStage outputFileType(@NotNull DataExportOutputFileType outputFileType) { + this.outputFileType = Objects.requireNonNull(outputFileType, "outputFileType must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage metadata(DataExportMetadata metadata) { + this.metadata = Optional.ofNullable(metadata); return this; } @java.lang.Override - @JsonSetter("output_file_type") - public _FinalStage outputFileType(@NotNull String outputFileType) { - this.outputFileType = Objects.requireNonNull(outputFileType, "outputFileType must not be null"); + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional metadata) { + this.metadata = metadata; return this; } diff --git a/src/main/java/com/schematic/api/resources/dataexports/requests/ListDataExportsRequest.java b/src/main/java/com/schematic/api/resources/dataexports/requests/ListDataExportsRequest.java new file mode 100644 index 00000000..1384ecd2 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/dataexports/requests/ListDataExportsRequest.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.dataexports.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.DataExportStatus; +import com.schematic.api.types.DataExportType; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListDataExportsRequest.Builder.class) +public final class ListDataExportsRequest { + private final Optional exportType; + + private final Optional status; + + private final Optional limit; + + private final Optional offset; + + private final Map additionalProperties; + + private ListDataExportsRequest( + Optional exportType, + Optional status, + Optional limit, + Optional offset, + Map additionalProperties) { + this.exportType = exportType; + this.status = status; + this.limit = limit; + this.offset = offset; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("export_type") + public Optional getExportType() { + return exportType; + } + + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @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 ListDataExportsRequest && equalTo((ListDataExportsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListDataExportsRequest other) { + return exportType.equals(other.exportType) + && status.equals(other.status) + && limit.equals(other.limit) + && offset.equals(other.offset); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.exportType, this.status, 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 exportType = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional offset = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListDataExportsRequest other) { + exportType(other.getExportType()); + status(other.getStatus()); + limit(other.getLimit()); + offset(other.getOffset()); + return this; + } + + @JsonSetter(value = "export_type", nulls = Nulls.SKIP) + public Builder exportType(Optional exportType) { + this.exportType = exportType; + return this; + } + + public Builder exportType(DataExportType exportType) { + this.exportType = Optional.ofNullable(exportType); + return this; + } + + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(DataExportStatus status) { + this.status = Optional.ofNullable(status); + 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 ListDataExportsRequest build() { + return new ListDataExportsRequest(exportType, status, 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/dataexports/types/GetDataExportResponse.java b/src/main/java/com/schematic/api/resources/dataexports/types/GetDataExportResponse.java new file mode 100644 index 00000000..121f8261 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/dataexports/types/GetDataExportResponse.java @@ -0,0 +1,181 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.dataexports.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.DataExportResponseData; +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 = GetDataExportResponse.Builder.class) +public final class GetDataExportResponse { + private final DataExportResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private GetDataExportResponse( + DataExportResponseData data, Map params, Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public DataExportResponseData 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 GetDataExportResponse && equalTo((GetDataExportResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetDataExportResponse 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 DataExportResponseData data); + + Builder from(GetDataExportResponse other); + } + + public interface _FinalStage { + GetDataExportResponse 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 DataExportResponseData data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetDataExportResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull DataExportResponseData 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 GetDataExportResponse build() { + return new GetDataExportResponse(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/dataexports/types/ListDataExportsParams.java b/src/main/java/com/schematic/api/resources/dataexports/types/ListDataExportsParams.java new file mode 100644 index 00000000..f054f00c --- /dev/null +++ b/src/main/java/com/schematic/api/resources/dataexports/types/ListDataExportsParams.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.dataexports.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.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.DataExportStatus; +import com.schematic.api.types.DataExportType; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListDataExportsParams.Builder.class) +public final class ListDataExportsParams { + private final Optional exportType; + + private final Optional limit; + + private final Optional offset; + + private final Optional status; + + private final Map additionalProperties; + + private ListDataExportsParams( + Optional exportType, + Optional limit, + Optional offset, + Optional status, + Map additionalProperties) { + this.exportType = exportType; + this.limit = limit; + this.offset = offset; + this.status = status; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("export_type") + public Optional getExportType() { + return exportType; + } + + /** + * @return Page limit (default 100) + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return Page offset (default 0) + */ + @JsonProperty("offset") + public Optional getOffset() { + return offset; + } + + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListDataExportsParams && equalTo((ListDataExportsParams) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListDataExportsParams other) { + return exportType.equals(other.exportType) + && limit.equals(other.limit) + && offset.equals(other.offset) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.exportType, this.limit, this.offset, this.status); + } + + @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 exportType = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional offset = Optional.empty(); + + private Optional status = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListDataExportsParams other) { + exportType(other.getExportType()); + limit(other.getLimit()); + offset(other.getOffset()); + status(other.getStatus()); + return this; + } + + @JsonSetter(value = "export_type", nulls = Nulls.SKIP) + public Builder exportType(Optional exportType) { + this.exportType = exportType; + return this; + } + + public Builder exportType(DataExportType exportType) { + this.exportType = Optional.ofNullable(exportType); + 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; + } + + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(DataExportStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + public ListDataExportsParams build() { + return new ListDataExportsParams(exportType, limit, offset, status, 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/dataexports/types/ListDataExportsResponse.java b/src/main/java/com/schematic/api/resources/dataexports/types/ListDataExportsResponse.java new file mode 100644 index 00000000..636f424d --- /dev/null +++ b/src/main/java/com/schematic/api/resources/dataexports/types/ListDataExportsResponse.java @@ -0,0 +1,174 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.dataexports.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.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.DataExportResponseData; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListDataExportsResponse.Builder.class) +public final class ListDataExportsResponse { + private final List data; + + private final ListDataExportsParams params; + + private final Map additionalProperties; + + private ListDataExportsResponse( + List data, ListDataExportsParams params, Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Input parameters + */ + @JsonProperty("params") + public ListDataExportsParams getParams() { + return params; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListDataExportsResponse && equalTo((ListDataExportsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListDataExportsResponse 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 ParamsStage builder() { + return new Builder(); + } + + public interface ParamsStage { + /** + *

Input parameters

+ */ + _FinalStage params(@NotNull ListDataExportsParams params); + + Builder from(ListDataExportsResponse other); + } + + public interface _FinalStage { + ListDataExportsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(DataExportResponseData data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ParamsStage, _FinalStage { + private ListDataExportsParams params; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListDataExportsResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + /** + *

Input parameters

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("params") + public _FinalStage params(@NotNull ListDataExportsParams params) { + this.params = Objects.requireNonNull(params, "params must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(DataExportResponseData data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListDataExportsResponse build() { + return new ListDataExportsResponse(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/planbundle/requests/CreateCustomPlanBundleRequestBody.java b/src/main/java/com/schematic/api/resources/planbundle/requests/CreateCustomPlanBundleRequestBody.java index e918c728..368c067d 100644 --- a/src/main/java/com/schematic/api/resources/planbundle/requests/CreateCustomPlanBundleRequestBody.java +++ b/src/main/java/com/schematic/api/resources/planbundle/requests/CreateCustomPlanBundleRequestBody.java @@ -13,6 +13,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; import com.schematic.api.types.CreateCustomPlanBundlePlanRequestBody; +import com.schematic.api.types.PlanBundleCreditGrantRequestBody; import com.schematic.api.types.PlanBundleEntitlementRequestBody; import com.schematic.api.types.UpsertBillingProductRequestBody; import java.util.ArrayList; @@ -27,6 +28,8 @@ public final class CreateCustomPlanBundleRequestBody { private final Optional billingProduct; + private final Optional> creditGrants; + private final List entitlements; private final Optional plan; @@ -35,10 +38,12 @@ public final class CreateCustomPlanBundleRequestBody { private CreateCustomPlanBundleRequestBody( Optional billingProduct, + Optional> creditGrants, List entitlements, Optional plan, Map additionalProperties) { this.billingProduct = billingProduct; + this.creditGrants = creditGrants; this.entitlements = entitlements; this.plan = plan; this.additionalProperties = additionalProperties; @@ -49,6 +54,11 @@ public Optional getBillingProduct() { return billingProduct; } + @JsonProperty("credit_grants") + public Optional> getCreditGrants() { + return creditGrants; + } + @JsonProperty("entitlements") public List getEntitlements() { return entitlements; @@ -72,13 +82,14 @@ public Map getAdditionalProperties() { private boolean equalTo(CreateCustomPlanBundleRequestBody other) { return billingProduct.equals(other.billingProduct) + && creditGrants.equals(other.creditGrants) && entitlements.equals(other.entitlements) && plan.equals(other.plan); } @java.lang.Override public int hashCode() { - return Objects.hash(this.billingProduct, this.entitlements, this.plan); + return Objects.hash(this.billingProduct, this.creditGrants, this.entitlements, this.plan); } @java.lang.Override @@ -94,6 +105,8 @@ public static Builder builder() { public static final class Builder { private Optional billingProduct = Optional.empty(); + private Optional> creditGrants = Optional.empty(); + private List entitlements = new ArrayList<>(); private Optional plan = Optional.empty(); @@ -105,6 +118,7 @@ private Builder() {} public Builder from(CreateCustomPlanBundleRequestBody other) { billingProduct(other.getBillingProduct()); + creditGrants(other.getCreditGrants()); entitlements(other.getEntitlements()); plan(other.getPlan()); return this; @@ -121,6 +135,17 @@ public Builder billingProduct(UpsertBillingProductRequestBody billingProduct) { return this; } + @JsonSetter(value = "credit_grants", nulls = Nulls.SKIP) + public Builder creditGrants(Optional> creditGrants) { + this.creditGrants = creditGrants; + return this; + } + + public Builder creditGrants(List creditGrants) { + this.creditGrants = Optional.ofNullable(creditGrants); + return this; + } + @JsonSetter(value = "entitlements", nulls = Nulls.SKIP) public Builder entitlements(List entitlements) { this.entitlements.clear(); @@ -154,7 +179,8 @@ public Builder plan(CreateCustomPlanBundlePlanRequestBody plan) { } public CreateCustomPlanBundleRequestBody build() { - return new CreateCustomPlanBundleRequestBody(billingProduct, entitlements, plan, additionalProperties); + return new CreateCustomPlanBundleRequestBody( + billingProduct, creditGrants, entitlements, plan, additionalProperties); } public Builder additionalProperty(String key, Object value) { diff --git a/src/main/java/com/schematic/api/types/AuditLogExportMetadata.java b/src/main/java/com/schematic/api/types/AuditLogExportMetadata.java new file mode 100644 index 00000000..18959010 --- /dev/null +++ b/src/main/java/com/schematic/api/types/AuditLogExportMetadata.java @@ -0,0 +1,239 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.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.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.time.OffsetDateTime; +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 = AuditLogExportMetadata.Builder.class) +public final class AuditLogExportMetadata { + private final Optional actorType; + + private final Optional endTime; + + private final Optional> notificationEmailRecipientEmailAddresses; + + private final Optional q; + + private final Optional startTime; + + private final Map additionalProperties; + + private AuditLogExportMetadata( + Optional actorType, + Optional endTime, + Optional> notificationEmailRecipientEmailAddresses, + Optional q, + Optional startTime, + Map additionalProperties) { + this.actorType = actorType; + this.endTime = endTime; + this.notificationEmailRecipientEmailAddresses = notificationEmailRecipientEmailAddresses; + this.q = q; + this.startTime = startTime; + this.additionalProperties = additionalProperties; + } + + /** + * @return Restrict the export to audit log entries from this actor type + */ + @JsonProperty("actor_type") + public Optional getActorType() { + return actorType; + } + + /** + * @return Restrict the export to audit log entries that started before this time + */ + @JsonProperty("end_time") + public Optional getEndTime() { + return endTime; + } + + /** + * @return Account member emails to notify when the export completes; empty means the artifact is only retrievable via the API + */ + @JsonProperty("notification_email_recipient_email_addresses") + public Optional> getNotificationEmailRecipientEmailAddresses() { + return notificationEmailRecipientEmailAddresses; + } + + /** + * @return Free-text search over audit log entries + */ + @JsonProperty("q") + public Optional getQ() { + return q; + } + + /** + * @return Restrict the export to audit log entries that started at or after this time + */ + @JsonProperty("start_time") + public Optional getStartTime() { + return startTime; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AuditLogExportMetadata && equalTo((AuditLogExportMetadata) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AuditLogExportMetadata other) { + return actorType.equals(other.actorType) + && endTime.equals(other.endTime) + && notificationEmailRecipientEmailAddresses.equals(other.notificationEmailRecipientEmailAddresses) + && q.equals(other.q) + && startTime.equals(other.startTime); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.actorType, this.endTime, this.notificationEmailRecipientEmailAddresses, this.q, this.startTime); + } + + @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 actorType = Optional.empty(); + + private Optional endTime = Optional.empty(); + + private Optional> notificationEmailRecipientEmailAddresses = Optional.empty(); + + private Optional q = Optional.empty(); + + private Optional startTime = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AuditLogExportMetadata other) { + actorType(other.getActorType()); + endTime(other.getEndTime()); + notificationEmailRecipientEmailAddresses(other.getNotificationEmailRecipientEmailAddresses()); + q(other.getQ()); + startTime(other.getStartTime()); + return this; + } + + /** + *

Restrict the export to audit log entries from this actor type

+ */ + @JsonSetter(value = "actor_type", nulls = Nulls.SKIP) + public Builder actorType(Optional actorType) { + this.actorType = actorType; + return this; + } + + public Builder actorType(String actorType) { + this.actorType = Optional.ofNullable(actorType); + return this; + } + + /** + *

Restrict the export to audit log entries that started before this time

+ */ + @JsonSetter(value = "end_time", nulls = Nulls.SKIP) + public Builder endTime(Optional endTime) { + this.endTime = endTime; + return this; + } + + public Builder endTime(OffsetDateTime endTime) { + this.endTime = Optional.ofNullable(endTime); + return this; + } + + /** + *

Account member emails to notify when the export completes; empty means the artifact is only retrievable via the API

+ */ + @JsonSetter(value = "notification_email_recipient_email_addresses", nulls = Nulls.SKIP) + public Builder notificationEmailRecipientEmailAddresses( + Optional> notificationEmailRecipientEmailAddresses) { + this.notificationEmailRecipientEmailAddresses = notificationEmailRecipientEmailAddresses; + return this; + } + + public Builder notificationEmailRecipientEmailAddresses(List notificationEmailRecipientEmailAddresses) { + this.notificationEmailRecipientEmailAddresses = + Optional.ofNullable(notificationEmailRecipientEmailAddresses); + return this; + } + + /** + *

Free-text search over audit log entries

+ */ + @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; + } + + /** + *

Restrict the export to audit log entries that started at or after this time

+ */ + @JsonSetter(value = "start_time", nulls = Nulls.SKIP) + public Builder startTime(Optional startTime) { + this.startTime = startTime; + return this; + } + + public Builder startTime(OffsetDateTime startTime) { + this.startTime = Optional.ofNullable(startTime); + return this; + } + + public AuditLogExportMetadata build() { + return new AuditLogExportMetadata( + actorType, endTime, notificationEmailRecipientEmailAddresses, q, startTime, 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/types/CatalogConfigOrderedBundle.java b/src/main/java/com/schematic/api/types/CatalogConfigOrderedBundle.java new file mode 100644 index 00000000..6b078f62 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CatalogConfigOrderedBundle.java @@ -0,0 +1,118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.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.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CatalogConfigOrderedBundle.Builder.class) +public final class CatalogConfigOrderedBundle { + private final String bundleId; + + private final Map additionalProperties; + + private CatalogConfigOrderedBundle(String bundleId, Map additionalProperties) { + this.bundleId = bundleId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("bundle_id") + public String getBundleId() { + return bundleId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CatalogConfigOrderedBundle && equalTo((CatalogConfigOrderedBundle) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CatalogConfigOrderedBundle other) { + return bundleId.equals(other.bundleId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.bundleId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BundleIdStage builder() { + return new Builder(); + } + + public interface BundleIdStage { + _FinalStage bundleId(@NotNull String bundleId); + + Builder from(CatalogConfigOrderedBundle other); + } + + public interface _FinalStage { + CatalogConfigOrderedBundle build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BundleIdStage, _FinalStage { + private String bundleId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CatalogConfigOrderedBundle other) { + bundleId(other.getBundleId()); + return this; + } + + @java.lang.Override + @JsonSetter("bundle_id") + public _FinalStage bundleId(@NotNull String bundleId) { + this.bundleId = Objects.requireNonNull(bundleId, "bundleId must not be null"); + return this; + } + + @java.lang.Override + public CatalogConfigOrderedBundle build() { + return new CatalogConfigOrderedBundle(bundleId, 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/types/CatalogConfigOrderedBundleResponseData.java b/src/main/java/com/schematic/api/types/CatalogConfigOrderedBundleResponseData.java new file mode 100644 index 00000000..97251015 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CatalogConfigOrderedBundleResponseData.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.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.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CatalogConfigOrderedBundleResponseData.Builder.class) +public final class CatalogConfigOrderedBundleResponseData { + private final String bundleId; + + private final Map additionalProperties; + + private CatalogConfigOrderedBundleResponseData(String bundleId, Map additionalProperties) { + this.bundleId = bundleId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("bundle_id") + public String getBundleId() { + return bundleId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CatalogConfigOrderedBundleResponseData + && equalTo((CatalogConfigOrderedBundleResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CatalogConfigOrderedBundleResponseData other) { + return bundleId.equals(other.bundleId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.bundleId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BundleIdStage builder() { + return new Builder(); + } + + public interface BundleIdStage { + _FinalStage bundleId(@NotNull String bundleId); + + Builder from(CatalogConfigOrderedBundleResponseData other); + } + + public interface _FinalStage { + CatalogConfigOrderedBundleResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BundleIdStage, _FinalStage { + private String bundleId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CatalogConfigOrderedBundleResponseData other) { + bundleId(other.getBundleId()); + return this; + } + + @java.lang.Override + @JsonSetter("bundle_id") + public _FinalStage bundleId(@NotNull String bundleId) { + this.bundleId = Objects.requireNonNull(bundleId, "bundleId must not be null"); + return this; + } + + @java.lang.Override + public CatalogConfigOrderedBundleResponseData build() { + return new CatalogConfigOrderedBundleResponseData(bundleId, 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/types/CatalogConfigOrderedEntitlement.java b/src/main/java/com/schematic/api/types/CatalogConfigOrderedEntitlement.java new file mode 100644 index 00000000..84921031 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CatalogConfigOrderedEntitlement.java @@ -0,0 +1,149 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.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.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 = CatalogConfigOrderedEntitlement.Builder.class) +public final class CatalogConfigOrderedEntitlement { + private final String planEntitlementId; + + private final Optional visible; + + private final Map additionalProperties; + + private CatalogConfigOrderedEntitlement( + String planEntitlementId, Optional visible, Map additionalProperties) { + this.planEntitlementId = planEntitlementId; + this.visible = visible; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("plan_entitlement_id") + public String getPlanEntitlementId() { + return planEntitlementId; + } + + @JsonProperty("visible") + public Optional getVisible() { + return visible; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CatalogConfigOrderedEntitlement && equalTo((CatalogConfigOrderedEntitlement) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CatalogConfigOrderedEntitlement other) { + return planEntitlementId.equals(other.planEntitlementId) && visible.equals(other.visible); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.planEntitlementId, this.visible); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PlanEntitlementIdStage builder() { + return new Builder(); + } + + public interface PlanEntitlementIdStage { + _FinalStage planEntitlementId(@NotNull String planEntitlementId); + + Builder from(CatalogConfigOrderedEntitlement other); + } + + public interface _FinalStage { + CatalogConfigOrderedEntitlement build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage visible(Optional visible); + + _FinalStage visible(Boolean visible); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PlanEntitlementIdStage, _FinalStage { + private String planEntitlementId; + + private Optional visible = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CatalogConfigOrderedEntitlement other) { + planEntitlementId(other.getPlanEntitlementId()); + visible(other.getVisible()); + return this; + } + + @java.lang.Override + @JsonSetter("plan_entitlement_id") + public _FinalStage planEntitlementId(@NotNull String planEntitlementId) { + this.planEntitlementId = Objects.requireNonNull(planEntitlementId, "planEntitlementId must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage visible(Boolean visible) { + this.visible = Optional.ofNullable(visible); + return this; + } + + @java.lang.Override + @JsonSetter(value = "visible", nulls = Nulls.SKIP) + public _FinalStage visible(Optional visible) { + this.visible = visible; + return this; + } + + @java.lang.Override + public CatalogConfigOrderedEntitlement build() { + return new CatalogConfigOrderedEntitlement(planEntitlementId, visible, 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/types/CatalogConfigOrderedEntitlementResponseData.java b/src/main/java/com/schematic/api/types/CatalogConfigOrderedEntitlementResponseData.java new file mode 100644 index 00000000..59f12f59 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CatalogConfigOrderedEntitlementResponseData.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.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.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CatalogConfigOrderedEntitlementResponseData.Builder.class) +public final class CatalogConfigOrderedEntitlementResponseData { + private final String planEntitlementId; + + private final boolean visible; + + private final Map additionalProperties; + + private CatalogConfigOrderedEntitlementResponseData( + String planEntitlementId, boolean visible, Map additionalProperties) { + this.planEntitlementId = planEntitlementId; + this.visible = visible; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("plan_entitlement_id") + public String getPlanEntitlementId() { + return planEntitlementId; + } + + @JsonProperty("visible") + public boolean getVisible() { + return visible; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CatalogConfigOrderedEntitlementResponseData + && equalTo((CatalogConfigOrderedEntitlementResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CatalogConfigOrderedEntitlementResponseData other) { + return planEntitlementId.equals(other.planEntitlementId) && visible == other.visible; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.planEntitlementId, this.visible); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PlanEntitlementIdStage builder() { + return new Builder(); + } + + public interface PlanEntitlementIdStage { + VisibleStage planEntitlementId(@NotNull String planEntitlementId); + + Builder from(CatalogConfigOrderedEntitlementResponseData other); + } + + public interface VisibleStage { + _FinalStage visible(boolean visible); + } + + public interface _FinalStage { + CatalogConfigOrderedEntitlementResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PlanEntitlementIdStage, VisibleStage, _FinalStage { + private String planEntitlementId; + + private boolean visible; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CatalogConfigOrderedEntitlementResponseData other) { + planEntitlementId(other.getPlanEntitlementId()); + visible(other.getVisible()); + return this; + } + + @java.lang.Override + @JsonSetter("plan_entitlement_id") + public VisibleStage planEntitlementId(@NotNull String planEntitlementId) { + this.planEntitlementId = Objects.requireNonNull(planEntitlementId, "planEntitlementId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("visible") + public _FinalStage visible(boolean visible) { + this.visible = visible; + return this; + } + + @java.lang.Override + public CatalogConfigOrderedEntitlementResponseData build() { + return new CatalogConfigOrderedEntitlementResponseData(planEntitlementId, visible, 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/types/CatalogConfigOrderedPlan.java b/src/main/java/com/schematic/api/types/CatalogConfigOrderedPlan.java new file mode 100644 index 00000000..9ef4cc37 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CatalogConfigOrderedPlan.java @@ -0,0 +1,152 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.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.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CatalogConfigOrderedPlan.Builder.class) +public final class CatalogConfigOrderedPlan { + private final Optional> entitlements; + + private final String planId; + + private final Map additionalProperties; + + private CatalogConfigOrderedPlan( + Optional> entitlements, + String planId, + Map additionalProperties) { + this.entitlements = entitlements; + this.planId = planId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("entitlements") + public Optional> getEntitlements() { + return entitlements; + } + + @JsonProperty("plan_id") + public String getPlanId() { + return planId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CatalogConfigOrderedPlan && equalTo((CatalogConfigOrderedPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CatalogConfigOrderedPlan other) { + return entitlements.equals(other.entitlements) && planId.equals(other.planId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.entitlements, this.planId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PlanIdStage builder() { + return new Builder(); + } + + public interface PlanIdStage { + _FinalStage planId(@NotNull String planId); + + Builder from(CatalogConfigOrderedPlan other); + } + + public interface _FinalStage { + CatalogConfigOrderedPlan build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage entitlements(Optional> entitlements); + + _FinalStage entitlements(List entitlements); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PlanIdStage, _FinalStage { + private String planId; + + private Optional> entitlements = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CatalogConfigOrderedPlan other) { + entitlements(other.getEntitlements()); + planId(other.getPlanId()); + return this; + } + + @java.lang.Override + @JsonSetter("plan_id") + public _FinalStage planId(@NotNull String planId) { + this.planId = Objects.requireNonNull(planId, "planId must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage entitlements(List entitlements) { + this.entitlements = Optional.ofNullable(entitlements); + return this; + } + + @java.lang.Override + @JsonSetter(value = "entitlements", nulls = Nulls.SKIP) + public _FinalStage entitlements(Optional> entitlements) { + this.entitlements = entitlements; + return this; + } + + @java.lang.Override + public CatalogConfigOrderedPlan build() { + return new CatalogConfigOrderedPlan(entitlements, planId, 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/types/CatalogConfigOrderedPlanResponseData.java b/src/main/java/com/schematic/api/types/CatalogConfigOrderedPlanResponseData.java new file mode 100644 index 00000000..9ded0b14 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CatalogConfigOrderedPlanResponseData.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.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.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CatalogConfigOrderedPlanResponseData.Builder.class) +public final class CatalogConfigOrderedPlanResponseData { + private final List entitlements; + + private final String planId; + + private final Map additionalProperties; + + private CatalogConfigOrderedPlanResponseData( + List entitlements, + String planId, + Map additionalProperties) { + this.entitlements = entitlements; + this.planId = planId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("entitlements") + public List getEntitlements() { + return entitlements; + } + + @JsonProperty("plan_id") + public String getPlanId() { + return planId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CatalogConfigOrderedPlanResponseData + && equalTo((CatalogConfigOrderedPlanResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CatalogConfigOrderedPlanResponseData other) { + return entitlements.equals(other.entitlements) && planId.equals(other.planId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.entitlements, this.planId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PlanIdStage builder() { + return new Builder(); + } + + public interface PlanIdStage { + _FinalStage planId(@NotNull String planId); + + Builder from(CatalogConfigOrderedPlanResponseData other); + } + + public interface _FinalStage { + CatalogConfigOrderedPlanResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage entitlements(List entitlements); + + _FinalStage addEntitlements(CatalogConfigOrderedEntitlementResponseData entitlements); + + _FinalStage addAllEntitlements(List entitlements); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PlanIdStage, _FinalStage { + private String planId; + + private List entitlements = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CatalogConfigOrderedPlanResponseData other) { + entitlements(other.getEntitlements()); + planId(other.getPlanId()); + return this; + } + + @java.lang.Override + @JsonSetter("plan_id") + public _FinalStage planId(@NotNull String planId) { + this.planId = Objects.requireNonNull(planId, "planId must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllEntitlements(List entitlements) { + if (entitlements != null) { + this.entitlements.addAll(entitlements); + } + return this; + } + + @java.lang.Override + public _FinalStage addEntitlements(CatalogConfigOrderedEntitlementResponseData entitlements) { + this.entitlements.add(entitlements); + return this; + } + + @java.lang.Override + @JsonSetter(value = "entitlements", nulls = Nulls.SKIP) + public _FinalStage entitlements(List entitlements) { + this.entitlements.clear(); + if (entitlements != null) { + this.entitlements.addAll(entitlements); + } + return this; + } + + @java.lang.Override + public CatalogConfigOrderedPlanResponseData build() { + return new CatalogConfigOrderedPlanResponseData(entitlements, planId, 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/types/CatalogConfigurationResponseData.java b/src/main/java/com/schematic/api/types/CatalogConfigurationResponseData.java new file mode 100644 index 00000000..c8b802f2 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CatalogConfigurationResponseData.java @@ -0,0 +1,511 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.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.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.ArrayList; +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 = CatalogConfigurationResponseData.Builder.class) +public final class CatalogConfigurationResponseData { + private final List addOns; + + private final Optional customPlanCtaText; + + private final Optional customPlanCtaUrl; + + private final Optional customPlanPriceText; + + private final boolean customPlansVisible; + + private final List orderedAddOns; + + private final List orderedBundles; + + private final List orderedPlans; + + private final List plans; + + private final Optional pricingModel; + + private final Optional pricingUrl; + + private final Map additionalProperties; + + private CatalogConfigurationResponseData( + List addOns, + Optional customPlanCtaText, + Optional customPlanCtaUrl, + Optional customPlanPriceText, + boolean customPlansVisible, + List orderedAddOns, + List orderedBundles, + List orderedPlans, + List plans, + Optional pricingModel, + Optional pricingUrl, + Map additionalProperties) { + this.addOns = addOns; + this.customPlanCtaText = customPlanCtaText; + this.customPlanCtaUrl = customPlanCtaUrl; + this.customPlanPriceText = customPlanPriceText; + this.customPlansVisible = customPlansVisible; + this.orderedAddOns = orderedAddOns; + this.orderedBundles = orderedBundles; + this.orderedPlans = orderedPlans; + this.plans = plans; + this.pricingModel = pricingModel; + this.pricingUrl = pricingUrl; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("add_ons") + public List getAddOns() { + return addOns; + } + + @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 boolean getCustomPlansVisible() { + return customPlansVisible; + } + + @JsonProperty("ordered_add_ons") + public List getOrderedAddOns() { + return orderedAddOns; + } + + @JsonProperty("ordered_bundles") + public List getOrderedBundles() { + return orderedBundles; + } + + @JsonProperty("ordered_plans") + public List getOrderedPlans() { + return orderedPlans; + } + + @JsonProperty("plans") + public List getPlans() { + return plans; + } + + @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 CatalogConfigurationResponseData && equalTo((CatalogConfigurationResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CatalogConfigurationResponseData other) { + return addOns.equals(other.addOns) + && customPlanCtaText.equals(other.customPlanCtaText) + && customPlanCtaUrl.equals(other.customPlanCtaUrl) + && customPlanPriceText.equals(other.customPlanPriceText) + && customPlansVisible == other.customPlansVisible + && orderedAddOns.equals(other.orderedAddOns) + && orderedBundles.equals(other.orderedBundles) + && orderedPlans.equals(other.orderedPlans) + && plans.equals(other.plans) + && pricingModel.equals(other.pricingModel) + && pricingUrl.equals(other.pricingUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.addOns, + this.customPlanCtaText, + this.customPlanCtaUrl, + this.customPlanPriceText, + this.customPlansVisible, + this.orderedAddOns, + this.orderedBundles, + this.orderedPlans, + this.plans, + this.pricingModel, + this.pricingUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CustomPlansVisibleStage builder() { + return new Builder(); + } + + public interface CustomPlansVisibleStage { + _FinalStage customPlansVisible(boolean customPlansVisible); + + Builder from(CatalogConfigurationResponseData other); + } + + public interface _FinalStage { + CatalogConfigurationResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage addOns(List addOns); + + _FinalStage addAddOns(PlanGroupPlanDetailResponseData addOns); + + _FinalStage addAllAddOns(List addOns); + + _FinalStage customPlanCtaText(Optional customPlanCtaText); + + _FinalStage customPlanCtaText(String customPlanCtaText); + + _FinalStage customPlanCtaUrl(Optional customPlanCtaUrl); + + _FinalStage customPlanCtaUrl(String customPlanCtaUrl); + + _FinalStage customPlanPriceText(Optional customPlanPriceText); + + _FinalStage customPlanPriceText(String customPlanPriceText); + + _FinalStage orderedAddOns(List orderedAddOns); + + _FinalStage addOrderedAddOns(CatalogConfigOrderedPlanResponseData orderedAddOns); + + _FinalStage addAllOrderedAddOns(List orderedAddOns); + + _FinalStage orderedBundles(List orderedBundles); + + _FinalStage addOrderedBundles(CatalogConfigOrderedBundleResponseData orderedBundles); + + _FinalStage addAllOrderedBundles(List orderedBundles); + + _FinalStage orderedPlans(List orderedPlans); + + _FinalStage addOrderedPlans(CatalogConfigOrderedPlanResponseData orderedPlans); + + _FinalStage addAllOrderedPlans(List orderedPlans); + + _FinalStage plans(List plans); + + _FinalStage addPlans(PlanGroupPlanDetailResponseData plans); + + _FinalStage addAllPlans(List plans); + + _FinalStage pricingModel(Optional pricingModel); + + _FinalStage pricingModel(String pricingModel); + + _FinalStage pricingUrl(Optional pricingUrl); + + _FinalStage pricingUrl(String pricingUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CustomPlansVisibleStage, _FinalStage { + private boolean customPlansVisible; + + private Optional pricingUrl = Optional.empty(); + + private Optional pricingModel = Optional.empty(); + + private List plans = new ArrayList<>(); + + private List orderedPlans = new ArrayList<>(); + + private List orderedBundles = new ArrayList<>(); + + private List orderedAddOns = new ArrayList<>(); + + private Optional customPlanPriceText = Optional.empty(); + + private Optional customPlanCtaUrl = Optional.empty(); + + private Optional customPlanCtaText = Optional.empty(); + + private List addOns = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CatalogConfigurationResponseData other) { + addOns(other.getAddOns()); + customPlanCtaText(other.getCustomPlanCtaText()); + customPlanCtaUrl(other.getCustomPlanCtaUrl()); + customPlanPriceText(other.getCustomPlanPriceText()); + customPlansVisible(other.getCustomPlansVisible()); + orderedAddOns(other.getOrderedAddOns()); + orderedBundles(other.getOrderedBundles()); + orderedPlans(other.getOrderedPlans()); + plans(other.getPlans()); + pricingModel(other.getPricingModel()); + pricingUrl(other.getPricingUrl()); + return this; + } + + @java.lang.Override + @JsonSetter("custom_plans_visible") + public _FinalStage customPlansVisible(boolean customPlansVisible) { + this.customPlansVisible = customPlansVisible; + return this; + } + + @java.lang.Override + public _FinalStage pricingUrl(String pricingUrl) { + this.pricingUrl = Optional.ofNullable(pricingUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "pricing_url", nulls = Nulls.SKIP) + public _FinalStage pricingUrl(Optional pricingUrl) { + this.pricingUrl = pricingUrl; + return this; + } + + @java.lang.Override + public _FinalStage pricingModel(String pricingModel) { + this.pricingModel = Optional.ofNullable(pricingModel); + return this; + } + + @java.lang.Override + @JsonSetter(value = "pricing_model", nulls = Nulls.SKIP) + public _FinalStage pricingModel(Optional pricingModel) { + this.pricingModel = pricingModel; + return this; + } + + @java.lang.Override + public _FinalStage addAllPlans(List plans) { + if (plans != null) { + this.plans.addAll(plans); + } + return this; + } + + @java.lang.Override + public _FinalStage addPlans(PlanGroupPlanDetailResponseData plans) { + this.plans.add(plans); + return this; + } + + @java.lang.Override + @JsonSetter(value = "plans", nulls = Nulls.SKIP) + public _FinalStage plans(List plans) { + this.plans.clear(); + if (plans != null) { + this.plans.addAll(plans); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllOrderedPlans(List orderedPlans) { + if (orderedPlans != null) { + this.orderedPlans.addAll(orderedPlans); + } + return this; + } + + @java.lang.Override + public _FinalStage addOrderedPlans(CatalogConfigOrderedPlanResponseData orderedPlans) { + this.orderedPlans.add(orderedPlans); + return this; + } + + @java.lang.Override + @JsonSetter(value = "ordered_plans", nulls = Nulls.SKIP) + public _FinalStage orderedPlans(List orderedPlans) { + this.orderedPlans.clear(); + if (orderedPlans != null) { + this.orderedPlans.addAll(orderedPlans); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllOrderedBundles(List orderedBundles) { + if (orderedBundles != null) { + this.orderedBundles.addAll(orderedBundles); + } + return this; + } + + @java.lang.Override + public _FinalStage addOrderedBundles(CatalogConfigOrderedBundleResponseData orderedBundles) { + this.orderedBundles.add(orderedBundles); + return this; + } + + @java.lang.Override + @JsonSetter(value = "ordered_bundles", nulls = Nulls.SKIP) + public _FinalStage orderedBundles(List orderedBundles) { + this.orderedBundles.clear(); + if (orderedBundles != null) { + this.orderedBundles.addAll(orderedBundles); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllOrderedAddOns(List orderedAddOns) { + if (orderedAddOns != null) { + this.orderedAddOns.addAll(orderedAddOns); + } + return this; + } + + @java.lang.Override + public _FinalStage addOrderedAddOns(CatalogConfigOrderedPlanResponseData orderedAddOns) { + this.orderedAddOns.add(orderedAddOns); + return this; + } + + @java.lang.Override + @JsonSetter(value = "ordered_add_ons", nulls = Nulls.SKIP) + public _FinalStage orderedAddOns(List orderedAddOns) { + this.orderedAddOns.clear(); + if (orderedAddOns != null) { + this.orderedAddOns.addAll(orderedAddOns); + } + return this; + } + + @java.lang.Override + public _FinalStage customPlanPriceText(String customPlanPriceText) { + this.customPlanPriceText = Optional.ofNullable(customPlanPriceText); + return this; + } + + @java.lang.Override + @JsonSetter(value = "custom_plan_price_text", nulls = Nulls.SKIP) + public _FinalStage customPlanPriceText(Optional customPlanPriceText) { + this.customPlanPriceText = customPlanPriceText; + return this; + } + + @java.lang.Override + public _FinalStage customPlanCtaUrl(String customPlanCtaUrl) { + this.customPlanCtaUrl = Optional.ofNullable(customPlanCtaUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "custom_plan_cta_url", nulls = Nulls.SKIP) + public _FinalStage customPlanCtaUrl(Optional customPlanCtaUrl) { + this.customPlanCtaUrl = customPlanCtaUrl; + return this; + } + + @java.lang.Override + public _FinalStage customPlanCtaText(String customPlanCtaText) { + this.customPlanCtaText = Optional.ofNullable(customPlanCtaText); + return this; + } + + @java.lang.Override + @JsonSetter(value = "custom_plan_cta_text", nulls = Nulls.SKIP) + public _FinalStage customPlanCtaText(Optional customPlanCtaText) { + this.customPlanCtaText = customPlanCtaText; + return this; + } + + @java.lang.Override + public _FinalStage addAllAddOns(List addOns) { + if (addOns != null) { + this.addOns.addAll(addOns); + } + return this; + } + + @java.lang.Override + public _FinalStage addAddOns(PlanGroupPlanDetailResponseData addOns) { + this.addOns.add(addOns); + return this; + } + + @java.lang.Override + @JsonSetter(value = "add_ons", nulls = Nulls.SKIP) + public _FinalStage addOns(List addOns) { + this.addOns.clear(); + if (addOns != null) { + this.addOns.addAll(addOns); + } + return this; + } + + @java.lang.Override + public CatalogConfigurationResponseData build() { + return new CatalogConfigurationResponseData( + addOns, + customPlanCtaText, + customPlanCtaUrl, + customPlanPriceText, + customPlansVisible, + orderedAddOns, + orderedBundles, + orderedPlans, + plans, + pricingModel, + pricingUrl, + 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/types/CatalogCreditBundleIDsResponseData.java b/src/main/java/com/schematic/api/types/CatalogCreditBundleIDsResponseData.java new file mode 100644 index 00000000..2baff9c8 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CatalogCreditBundleIDsResponseData.java @@ -0,0 +1,117 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.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.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CatalogCreditBundleIDsResponseData.Builder.class) +public final class CatalogCreditBundleIDsResponseData { + private final List creditBundleIds; + + private final Map additionalProperties; + + private CatalogCreditBundleIDsResponseData(List creditBundleIds, Map additionalProperties) { + this.creditBundleIds = creditBundleIds; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("credit_bundle_ids") + public List getCreditBundleIds() { + return creditBundleIds; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CatalogCreditBundleIDsResponseData + && equalTo((CatalogCreditBundleIDsResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CatalogCreditBundleIDsResponseData other) { + return creditBundleIds.equals(other.creditBundleIds); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.creditBundleIds); + } + + @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 List creditBundleIds = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CatalogCreditBundleIDsResponseData other) { + creditBundleIds(other.getCreditBundleIds()); + return this; + } + + @JsonSetter(value = "credit_bundle_ids", nulls = Nulls.SKIP) + public Builder creditBundleIds(List creditBundleIds) { + this.creditBundleIds.clear(); + if (creditBundleIds != null) { + this.creditBundleIds.addAll(creditBundleIds); + } + return this; + } + + public Builder addCreditBundleIds(String creditBundleIds) { + this.creditBundleIds.add(creditBundleIds); + return this; + } + + public Builder addAllCreditBundleIds(List creditBundleIds) { + if (creditBundleIds != null) { + this.creditBundleIds.addAll(creditBundleIds); + } + return this; + } + + public CatalogCreditBundleIDsResponseData build() { + return new CatalogCreditBundleIDsResponseData(creditBundleIds, 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/types/CatalogDerivedFeatureResponseData.java b/src/main/java/com/schematic/api/types/CatalogDerivedFeatureResponseData.java new file mode 100644 index 00000000..8720b3cc --- /dev/null +++ b/src/main/java/com/schematic/api/types/CatalogDerivedFeatureResponseData.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.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.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CatalogDerivedFeatureResponseData.Builder.class) +public final class CatalogDerivedFeatureResponseData { + private final String icon; + + private final String id; + + private final String name; + + private final Map additionalProperties; + + private CatalogDerivedFeatureResponseData( + String icon, String id, String name, Map additionalProperties) { + this.icon = icon; + this.id = id; + this.name = name; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("icon") + public String getIcon() { + return icon; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CatalogDerivedFeatureResponseData && equalTo((CatalogDerivedFeatureResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CatalogDerivedFeatureResponseData other) { + return icon.equals(other.icon) && id.equals(other.id) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.icon, this.id, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IconStage builder() { + return new Builder(); + } + + public interface IconStage { + IdStage icon(@NotNull String icon); + + Builder from(CatalogDerivedFeatureResponseData other); + } + + public interface IdStage { + NameStage id(@NotNull String id); + } + + public interface NameStage { + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + CatalogDerivedFeatureResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IconStage, IdStage, NameStage, _FinalStage { + private String icon; + + private String id; + + private String name; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CatalogDerivedFeatureResponseData other) { + icon(other.getIcon()); + id(other.getId()); + name(other.getName()); + return this; + } + + @java.lang.Override + @JsonSetter("icon") + public IdStage icon(@NotNull String icon) { + this.icon = Objects.requireNonNull(icon, "icon must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + 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 CatalogDerivedFeatureResponseData build() { + return new CatalogDerivedFeatureResponseData(icon, id, 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/types/CatalogDerivedFeaturesResponseData.java b/src/main/java/com/schematic/api/types/CatalogDerivedFeaturesResponseData.java new file mode 100644 index 00000000..fccd5d13 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CatalogDerivedFeaturesResponseData.java @@ -0,0 +1,118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.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.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CatalogDerivedFeaturesResponseData.Builder.class) +public final class CatalogDerivedFeaturesResponseData { + private final List features; + + private final Map additionalProperties; + + private CatalogDerivedFeaturesResponseData( + List features, Map additionalProperties) { + this.features = features; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("features") + public List getFeatures() { + return features; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CatalogDerivedFeaturesResponseData + && equalTo((CatalogDerivedFeaturesResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CatalogDerivedFeaturesResponseData other) { + return features.equals(other.features); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.features); + } + + @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 List features = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CatalogDerivedFeaturesResponseData other) { + features(other.getFeatures()); + return this; + } + + @JsonSetter(value = "features", nulls = Nulls.SKIP) + public Builder features(List features) { + this.features.clear(); + if (features != null) { + this.features.addAll(features); + } + return this; + } + + public Builder addFeatures(CatalogDerivedFeatureResponseData features) { + this.features.add(features); + return this; + } + + public Builder addAllFeatures(List features) { + if (features != null) { + this.features.addAll(features); + } + return this; + } + + public CatalogDerivedFeaturesResponseData build() { + return new CatalogDerivedFeaturesResponseData(features, 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/types/CatalogPlanIDsResponseData.java b/src/main/java/com/schematic/api/types/CatalogPlanIDsResponseData.java new file mode 100644 index 00000000..2b6e999e --- /dev/null +++ b/src/main/java/com/schematic/api/types/CatalogPlanIDsResponseData.java @@ -0,0 +1,116 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.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.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CatalogPlanIDsResponseData.Builder.class) +public final class CatalogPlanIDsResponseData { + private final List planIds; + + private final Map additionalProperties; + + private CatalogPlanIDsResponseData(List planIds, Map additionalProperties) { + this.planIds = planIds; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("plan_ids") + public List getPlanIds() { + return planIds; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CatalogPlanIDsResponseData && equalTo((CatalogPlanIDsResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CatalogPlanIDsResponseData other) { + return planIds.equals(other.planIds); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.planIds); + } + + @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 List planIds = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CatalogPlanIDsResponseData other) { + planIds(other.getPlanIds()); + return this; + } + + @JsonSetter(value = "plan_ids", nulls = Nulls.SKIP) + public Builder planIds(List planIds) { + this.planIds.clear(); + if (planIds != null) { + this.planIds.addAll(planIds); + } + return this; + } + + public Builder addPlanIds(String planIds) { + this.planIds.add(planIds); + return this; + } + + public Builder addAllPlanIds(List planIds) { + if (planIds != null) { + this.planIds.addAll(planIds); + } + return this; + } + + public CatalogPlanIDsResponseData build() { + return new CatalogPlanIDsResponseData(planIds, 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/types/CatalogResponseData.java b/src/main/java/com/schematic/api/types/CatalogResponseData.java new file mode 100644 index 00000000..c4bde291 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CatalogResponseData.java @@ -0,0 +1,509 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.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.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.time.OffsetDateTime; +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 = CatalogResponseData.Builder.class) +public final class CatalogResponseData { + private final String accountId; + + private final OffsetDateTime createdAt; + + private final Optional customPlanCtaText; + + private final Optional customPlanCtaUrl; + + private final Optional customPlanPriceText; + + private final boolean customPlansVisible; + + private final Optional description; + + private final String environmentId; + + private final String id; + + private final boolean isDefault; + + private final String name; + + private final Optional pricingModel; + + private final Optional pricingUrl; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private CatalogResponseData( + String accountId, + OffsetDateTime createdAt, + Optional customPlanCtaText, + Optional customPlanCtaUrl, + Optional customPlanPriceText, + boolean customPlansVisible, + Optional description, + String environmentId, + String id, + boolean isDefault, + String name, + Optional pricingModel, + Optional pricingUrl, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.accountId = accountId; + this.createdAt = createdAt; + this.customPlanCtaText = customPlanCtaText; + this.customPlanCtaUrl = customPlanCtaUrl; + this.customPlanPriceText = customPlanPriceText; + this.customPlansVisible = customPlansVisible; + this.description = description; + this.environmentId = environmentId; + this.id = id; + this.isDefault = isDefault; + this.name = name; + this.pricingModel = pricingModel; + this.pricingUrl = pricingUrl; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @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 boolean getCustomPlansVisible() { + return customPlansVisible; + } + + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @JsonProperty("environment_id") + public String getEnvironmentId() { + return environmentId; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("is_default") + public boolean getIsDefault() { + return isDefault; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("pricing_model") + public Optional getPricingModel() { + return pricingModel; + } + + @JsonProperty("pricing_url") + public Optional getPricingUrl() { + return pricingUrl; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CatalogResponseData && equalTo((CatalogResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CatalogResponseData other) { + return accountId.equals(other.accountId) + && createdAt.equals(other.createdAt) + && customPlanCtaText.equals(other.customPlanCtaText) + && customPlanCtaUrl.equals(other.customPlanCtaUrl) + && customPlanPriceText.equals(other.customPlanPriceText) + && customPlansVisible == other.customPlansVisible + && description.equals(other.description) + && environmentId.equals(other.environmentId) + && id.equals(other.id) + && isDefault == other.isDefault + && name.equals(other.name) + && pricingModel.equals(other.pricingModel) + && pricingUrl.equals(other.pricingUrl) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.createdAt, + this.customPlanCtaText, + this.customPlanCtaUrl, + this.customPlanPriceText, + this.customPlansVisible, + this.description, + this.environmentId, + this.id, + this.isDefault, + this.name, + this.pricingModel, + this.pricingUrl, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + CreatedAtStage accountId(@NotNull String accountId); + + Builder from(CatalogResponseData other); + } + + public interface CreatedAtStage { + CustomPlansVisibleStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CustomPlansVisibleStage { + EnvironmentIdStage customPlansVisible(boolean customPlansVisible); + } + + public interface EnvironmentIdStage { + IdStage environmentId(@NotNull String environmentId); + } + + public interface IdStage { + IsDefaultStage id(@NotNull String id); + } + + public interface IsDefaultStage { + NameStage isDefault(boolean isDefault); + } + + public interface NameStage { + UpdatedAtStage name(@NotNull String name); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + CatalogResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage customPlanCtaText(Optional customPlanCtaText); + + _FinalStage customPlanCtaText(String customPlanCtaText); + + _FinalStage customPlanCtaUrl(Optional customPlanCtaUrl); + + _FinalStage customPlanCtaUrl(String customPlanCtaUrl); + + _FinalStage customPlanPriceText(Optional customPlanPriceText); + + _FinalStage customPlanPriceText(String customPlanPriceText); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage pricingModel(Optional pricingModel); + + _FinalStage pricingModel(String pricingModel); + + _FinalStage pricingUrl(Optional pricingUrl); + + _FinalStage pricingUrl(String pricingUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AccountIdStage, + CreatedAtStage, + CustomPlansVisibleStage, + EnvironmentIdStage, + IdStage, + IsDefaultStage, + NameStage, + UpdatedAtStage, + _FinalStage { + private String accountId; + + private OffsetDateTime createdAt; + + private boolean customPlansVisible; + + private String environmentId; + + private String id; + + private boolean isDefault; + + private String name; + + private OffsetDateTime updatedAt; + + private Optional pricingUrl = Optional.empty(); + + private Optional pricingModel = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional customPlanPriceText = Optional.empty(); + + private Optional customPlanCtaUrl = Optional.empty(); + + private Optional customPlanCtaText = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CatalogResponseData other) { + accountId(other.getAccountId()); + createdAt(other.getCreatedAt()); + customPlanCtaText(other.getCustomPlanCtaText()); + customPlanCtaUrl(other.getCustomPlanCtaUrl()); + customPlanPriceText(other.getCustomPlanPriceText()); + customPlansVisible(other.getCustomPlansVisible()); + description(other.getDescription()); + environmentId(other.getEnvironmentId()); + id(other.getId()); + isDefault(other.getIsDefault()); + name(other.getName()); + pricingModel(other.getPricingModel()); + pricingUrl(other.getPricingUrl()); + updatedAt(other.getUpdatedAt()); + return this; + } + + @java.lang.Override + @JsonSetter("account_id") + public CreatedAtStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public CustomPlansVisibleStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("custom_plans_visible") + public EnvironmentIdStage customPlansVisible(boolean customPlansVisible) { + this.customPlansVisible = customPlansVisible; + return this; + } + + @java.lang.Override + @JsonSetter("environment_id") + public IdStage environmentId(@NotNull String environmentId) { + this.environmentId = Objects.requireNonNull(environmentId, "environmentId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public IsDefaultStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("is_default") + public NameStage isDefault(boolean isDefault) { + this.isDefault = isDefault; + return this; + } + + @java.lang.Override + @JsonSetter("name") + public UpdatedAtStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage pricingUrl(String pricingUrl) { + this.pricingUrl = Optional.ofNullable(pricingUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "pricing_url", nulls = Nulls.SKIP) + public _FinalStage pricingUrl(Optional pricingUrl) { + this.pricingUrl = pricingUrl; + return this; + } + + @java.lang.Override + public _FinalStage pricingModel(String pricingModel) { + this.pricingModel = Optional.ofNullable(pricingModel); + return this; + } + + @java.lang.Override + @JsonSetter(value = "pricing_model", nulls = Nulls.SKIP) + public _FinalStage pricingModel(Optional pricingModel) { + this.pricingModel = pricingModel; + 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 _FinalStage customPlanPriceText(String customPlanPriceText) { + this.customPlanPriceText = Optional.ofNullable(customPlanPriceText); + return this; + } + + @java.lang.Override + @JsonSetter(value = "custom_plan_price_text", nulls = Nulls.SKIP) + public _FinalStage customPlanPriceText(Optional customPlanPriceText) { + this.customPlanPriceText = customPlanPriceText; + return this; + } + + @java.lang.Override + public _FinalStage customPlanCtaUrl(String customPlanCtaUrl) { + this.customPlanCtaUrl = Optional.ofNullable(customPlanCtaUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "custom_plan_cta_url", nulls = Nulls.SKIP) + public _FinalStage customPlanCtaUrl(Optional customPlanCtaUrl) { + this.customPlanCtaUrl = customPlanCtaUrl; + return this; + } + + @java.lang.Override + public _FinalStage customPlanCtaText(String customPlanCtaText) { + this.customPlanCtaText = Optional.ofNullable(customPlanCtaText); + return this; + } + + @java.lang.Override + @JsonSetter(value = "custom_plan_cta_text", nulls = Nulls.SKIP) + public _FinalStage customPlanCtaText(Optional customPlanCtaText) { + this.customPlanCtaText = customPlanCtaText; + return this; + } + + @java.lang.Override + public CatalogResponseData build() { + return new CatalogResponseData( + accountId, + createdAt, + customPlanCtaText, + customPlanCtaUrl, + customPlanPriceText, + customPlansVisible, + description, + environmentId, + id, + isDefault, + name, + pricingModel, + pricingUrl, + updatedAt, + 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/types/CompanyBillingAddressView.java b/src/main/java/com/schematic/api/types/CompanyBillingAddressView.java new file mode 100644 index 00000000..f5e67928 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CompanyBillingAddressView.java @@ -0,0 +1,241 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.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.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CompanyBillingAddressView.Builder.class) +public final class CompanyBillingAddressView { + private final String city; + + private final String country; + + private final String line1; + + private final String line2; + + private final String postalCode; + + private final String state; + + private final Map additionalProperties; + + private CompanyBillingAddressView( + String city, + String country, + String line1, + String line2, + String postalCode, + String state, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.state = state; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("city") + public String getCity() { + return city; + } + + @JsonProperty("country") + public String getCountry() { + return country; + } + + @JsonProperty("line1") + public String getLine1() { + return line1; + } + + @JsonProperty("line2") + public String getLine2() { + return line2; + } + + @JsonProperty("postal_code") + public String getPostalCode() { + return postalCode; + } + + @JsonProperty("state") + public String getState() { + return state; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyBillingAddressView && equalTo((CompanyBillingAddressView) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CompanyBillingAddressView other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && postalCode.equals(other.postalCode) + && state.equals(other.state); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.line1, this.line2, this.postalCode, this.state); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CityStage builder() { + return new Builder(); + } + + public interface CityStage { + CountryStage city(@NotNull String city); + + Builder from(CompanyBillingAddressView other); + } + + public interface CountryStage { + Line1Stage country(@NotNull String country); + } + + public interface Line1Stage { + Line2Stage line1(@NotNull String line1); + } + + public interface Line2Stage { + PostalCodeStage line2(@NotNull String line2); + } + + public interface PostalCodeStage { + StateStage postalCode(@NotNull String postalCode); + } + + public interface StateStage { + _FinalStage state(@NotNull String state); + } + + public interface _FinalStage { + CompanyBillingAddressView build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CityStage, CountryStage, Line1Stage, Line2Stage, PostalCodeStage, StateStage, _FinalStage { + private String city; + + private String country; + + private String line1; + + private String line2; + + private String postalCode; + + private String state; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CompanyBillingAddressView other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + postalCode(other.getPostalCode()); + state(other.getState()); + return this; + } + + @java.lang.Override + @JsonSetter("city") + public CountryStage city(@NotNull String city) { + this.city = Objects.requireNonNull(city, "city must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("country") + public Line1Stage country(@NotNull String country) { + this.country = Objects.requireNonNull(country, "country must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("line1") + public Line2Stage line1(@NotNull String line1) { + this.line1 = Objects.requireNonNull(line1, "line1 must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("line2") + public PostalCodeStage line2(@NotNull String line2) { + this.line2 = Objects.requireNonNull(line2, "line2 must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("postal_code") + public StateStage postalCode(@NotNull String postalCode) { + this.postalCode = Objects.requireNonNull(postalCode, "postalCode must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("state") + public _FinalStage state(@NotNull String state) { + this.state = Objects.requireNonNull(state, "state must not be null"); + return this; + } + + @java.lang.Override + public CompanyBillingAddressView build() { + return new CompanyBillingAddressView(city, country, line1, line2, postalCode, state, 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/types/CompanyBillingCheckoutSettings.java b/src/main/java/com/schematic/api/types/CompanyBillingCheckoutSettings.java new file mode 100644 index 00000000..f350d684 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CompanyBillingCheckoutSettings.java @@ -0,0 +1,168 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.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.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CompanyBillingCheckoutSettings.Builder.class) +public final class CompanyBillingCheckoutSettings { + private final boolean collectAddress; + + private final boolean collectEmail; + + private final boolean collectPhone; + + private final Map additionalProperties; + + private CompanyBillingCheckoutSettings( + boolean collectAddress, + boolean collectEmail, + boolean collectPhone, + Map additionalProperties) { + this.collectAddress = collectAddress; + this.collectEmail = collectEmail; + this.collectPhone = collectPhone; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("collect_address") + public boolean getCollectAddress() { + return collectAddress; + } + + @JsonProperty("collect_email") + public boolean getCollectEmail() { + return collectEmail; + } + + @JsonProperty("collect_phone") + public boolean getCollectPhone() { + return collectPhone; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyBillingCheckoutSettings && equalTo((CompanyBillingCheckoutSettings) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CompanyBillingCheckoutSettings other) { + return collectAddress == other.collectAddress + && collectEmail == other.collectEmail + && collectPhone == other.collectPhone; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.collectAddress, this.collectEmail, this.collectPhone); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CollectAddressStage builder() { + return new Builder(); + } + + public interface CollectAddressStage { + CollectEmailStage collectAddress(boolean collectAddress); + + Builder from(CompanyBillingCheckoutSettings other); + } + + public interface CollectEmailStage { + CollectPhoneStage collectEmail(boolean collectEmail); + } + + public interface CollectPhoneStage { + _FinalStage collectPhone(boolean collectPhone); + } + + public interface _FinalStage { + CompanyBillingCheckoutSettings build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CollectAddressStage, CollectEmailStage, CollectPhoneStage, _FinalStage { + private boolean collectAddress; + + private boolean collectEmail; + + private boolean collectPhone; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CompanyBillingCheckoutSettings other) { + collectAddress(other.getCollectAddress()); + collectEmail(other.getCollectEmail()); + collectPhone(other.getCollectPhone()); + return this; + } + + @java.lang.Override + @JsonSetter("collect_address") + public CollectEmailStage collectAddress(boolean collectAddress) { + this.collectAddress = collectAddress; + return this; + } + + @java.lang.Override + @JsonSetter("collect_email") + public CollectPhoneStage collectEmail(boolean collectEmail) { + this.collectEmail = collectEmail; + return this; + } + + @java.lang.Override + @JsonSetter("collect_phone") + public _FinalStage collectPhone(boolean collectPhone) { + this.collectPhone = collectPhone; + return this; + } + + @java.lang.Override + public CompanyBillingCheckoutSettings build() { + return new CompanyBillingCheckoutSettings(collectAddress, collectEmail, collectPhone, 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/types/CompanyBillingDetailsResponseData.java b/src/main/java/com/schematic/api/types/CompanyBillingDetailsResponseData.java new file mode 100644 index 00000000..33d1aaee --- /dev/null +++ b/src/main/java/com/schematic/api/types/CompanyBillingDetailsResponseData.java @@ -0,0 +1,258 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.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.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CompanyBillingDetailsResponseData.Builder.class) +public final class CompanyBillingDetailsResponseData { + private final Optional address; + + private final CompanyBillingCheckoutSettings checkoutSettings; + + private final List customFields; + + private final Optional email; + + private final Optional phone; + + private final Map additionalProperties; + + private CompanyBillingDetailsResponseData( + Optional address, + CompanyBillingCheckoutSettings checkoutSettings, + List customFields, + Optional email, + Optional phone, + Map additionalProperties) { + this.address = address; + this.checkoutSettings = checkoutSettings; + this.customFields = customFields; + this.email = email; + this.phone = phone; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("address") + public Optional getAddress() { + return address; + } + + @JsonProperty("checkout_settings") + public CompanyBillingCheckoutSettings getCheckoutSettings() { + return checkoutSettings; + } + + @JsonProperty("custom_fields") + public List getCustomFields() { + return customFields; + } + + @JsonProperty("email") + public Optional getEmail() { + return email; + } + + @JsonProperty("phone") + public Optional getPhone() { + return phone; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyBillingDetailsResponseData && equalTo((CompanyBillingDetailsResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CompanyBillingDetailsResponseData other) { + return address.equals(other.address) + && checkoutSettings.equals(other.checkoutSettings) + && customFields.equals(other.customFields) + && email.equals(other.email) + && phone.equals(other.phone); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.address, this.checkoutSettings, this.customFields, this.email, this.phone); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CheckoutSettingsStage builder() { + return new Builder(); + } + + public interface CheckoutSettingsStage { + _FinalStage checkoutSettings(@NotNull CompanyBillingCheckoutSettings checkoutSettings); + + Builder from(CompanyBillingDetailsResponseData other); + } + + public interface _FinalStage { + CompanyBillingDetailsResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage address(Optional address); + + _FinalStage address(CompanyBillingAddressView address); + + _FinalStage customFields(List customFields); + + _FinalStage addCustomFields(CheckoutFieldWithValue customFields); + + _FinalStage addAllCustomFields(List customFields); + + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage phone(Optional phone); + + _FinalStage phone(String phone); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CheckoutSettingsStage, _FinalStage { + private CompanyBillingCheckoutSettings checkoutSettings; + + private Optional phone = Optional.empty(); + + private Optional email = Optional.empty(); + + private List customFields = new ArrayList<>(); + + private Optional address = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CompanyBillingDetailsResponseData other) { + address(other.getAddress()); + checkoutSettings(other.getCheckoutSettings()); + customFields(other.getCustomFields()); + email(other.getEmail()); + phone(other.getPhone()); + return this; + } + + @java.lang.Override + @JsonSetter("checkout_settings") + public _FinalStage checkoutSettings(@NotNull CompanyBillingCheckoutSettings checkoutSettings) { + this.checkoutSettings = Objects.requireNonNull(checkoutSettings, "checkoutSettings must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage phone(String phone) { + this.phone = Optional.ofNullable(phone); + return this; + } + + @java.lang.Override + @JsonSetter(value = "phone", nulls = Nulls.SKIP) + public _FinalStage phone(Optional phone) { + this.phone = phone; + return this; + } + + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + @java.lang.Override + public _FinalStage addAllCustomFields(List customFields) { + if (customFields != null) { + this.customFields.addAll(customFields); + } + return this; + } + + @java.lang.Override + public _FinalStage addCustomFields(CheckoutFieldWithValue customFields) { + this.customFields.add(customFields); + return this; + } + + @java.lang.Override + @JsonSetter(value = "custom_fields", nulls = Nulls.SKIP) + public _FinalStage customFields(List customFields) { + this.customFields.clear(); + if (customFields != null) { + this.customFields.addAll(customFields); + } + return this; + } + + @java.lang.Override + public _FinalStage address(CompanyBillingAddressView address) { + this.address = Optional.ofNullable(address); + return this; + } + + @java.lang.Override + @JsonSetter(value = "address", nulls = Nulls.SKIP) + public _FinalStage address(Optional address) { + this.address = address; + return this; + } + + @java.lang.Override + public CompanyBillingDetailsResponseData build() { + return new CompanyBillingDetailsResponseData( + address, checkoutSettings, customFields, email, phone, 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/types/CompanyBillingDetailsView.java b/src/main/java/com/schematic/api/types/CompanyBillingDetailsView.java new file mode 100644 index 00000000..be7e8031 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CompanyBillingDetailsView.java @@ -0,0 +1,258 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.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.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CompanyBillingDetailsView.Builder.class) +public final class CompanyBillingDetailsView { + private final Optional address; + + private final CompanyBillingCheckoutSettings checkoutSettings; + + private final List customFields; + + private final Optional email; + + private final Optional phone; + + private final Map additionalProperties; + + private CompanyBillingDetailsView( + Optional address, + CompanyBillingCheckoutSettings checkoutSettings, + List customFields, + Optional email, + Optional phone, + Map additionalProperties) { + this.address = address; + this.checkoutSettings = checkoutSettings; + this.customFields = customFields; + this.email = email; + this.phone = phone; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("address") + public Optional getAddress() { + return address; + } + + @JsonProperty("checkout_settings") + public CompanyBillingCheckoutSettings getCheckoutSettings() { + return checkoutSettings; + } + + @JsonProperty("custom_fields") + public List getCustomFields() { + return customFields; + } + + @JsonProperty("email") + public Optional getEmail() { + return email; + } + + @JsonProperty("phone") + public Optional getPhone() { + return phone; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyBillingDetailsView && equalTo((CompanyBillingDetailsView) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CompanyBillingDetailsView other) { + return address.equals(other.address) + && checkoutSettings.equals(other.checkoutSettings) + && customFields.equals(other.customFields) + && email.equals(other.email) + && phone.equals(other.phone); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.address, this.checkoutSettings, this.customFields, this.email, this.phone); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CheckoutSettingsStage builder() { + return new Builder(); + } + + public interface CheckoutSettingsStage { + _FinalStage checkoutSettings(@NotNull CompanyBillingCheckoutSettings checkoutSettings); + + Builder from(CompanyBillingDetailsView other); + } + + public interface _FinalStage { + CompanyBillingDetailsView build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage address(Optional address); + + _FinalStage address(CompanyBillingAddressView address); + + _FinalStage customFields(List customFields); + + _FinalStage addCustomFields(CheckoutFieldWithValue customFields); + + _FinalStage addAllCustomFields(List customFields); + + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage phone(Optional phone); + + _FinalStage phone(String phone); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CheckoutSettingsStage, _FinalStage { + private CompanyBillingCheckoutSettings checkoutSettings; + + private Optional phone = Optional.empty(); + + private Optional email = Optional.empty(); + + private List customFields = new ArrayList<>(); + + private Optional address = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CompanyBillingDetailsView other) { + address(other.getAddress()); + checkoutSettings(other.getCheckoutSettings()); + customFields(other.getCustomFields()); + email(other.getEmail()); + phone(other.getPhone()); + return this; + } + + @java.lang.Override + @JsonSetter("checkout_settings") + public _FinalStage checkoutSettings(@NotNull CompanyBillingCheckoutSettings checkoutSettings) { + this.checkoutSettings = Objects.requireNonNull(checkoutSettings, "checkoutSettings must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage phone(String phone) { + this.phone = Optional.ofNullable(phone); + return this; + } + + @java.lang.Override + @JsonSetter(value = "phone", nulls = Nulls.SKIP) + public _FinalStage phone(Optional phone) { + this.phone = phone; + return this; + } + + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + @java.lang.Override + public _FinalStage addAllCustomFields(List customFields) { + if (customFields != null) { + this.customFields.addAll(customFields); + } + return this; + } + + @java.lang.Override + public _FinalStage addCustomFields(CheckoutFieldWithValue customFields) { + this.customFields.add(customFields); + return this; + } + + @java.lang.Override + @JsonSetter(value = "custom_fields", nulls = Nulls.SKIP) + public _FinalStage customFields(List customFields) { + this.customFields.clear(); + if (customFields != null) { + this.customFields.addAll(customFields); + } + return this; + } + + @java.lang.Override + public _FinalStage address(CompanyBillingAddressView address) { + this.address = Optional.ofNullable(address); + return this; + } + + @java.lang.Override + @JsonSetter(value = "address", nulls = Nulls.SKIP) + public _FinalStage address(Optional address) { + this.address = address; + return this; + } + + @java.lang.Override + public CompanyBillingDetailsView build() { + return new CompanyBillingDetailsView( + address, checkoutSettings, customFields, email, phone, 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/types/CompanyFeatureUsageExportMetadata.java b/src/main/java/com/schematic/api/types/CompanyFeatureUsageExportMetadata.java new file mode 100644 index 00000000..fc767791 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CompanyFeatureUsageExportMetadata.java @@ -0,0 +1,642 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.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.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.ArrayList; +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 = CompanyFeatureUsageExportMetadata.Builder.class) +public final class CompanyFeatureUsageExportMetadata { + private final Optional> companyIds; + + private final Optional> creditTypeIds; + + private final List featureIds; + + private final Optional hasScheduledDowngrade; + + private final Optional monetizedSubscriptions; + + private final Optional> notificationEmailRecipientEmailAddresses; + + private final Optional planId; + + private final Optional> planIds; + + private final Optional planVersionId; + + private final Optional q; + + private final Optional> subscriptionStatuses; + + private final Optional> subscriptionTypes; + + private final Optional withEntitlementFor; + + private final Optional withSubscription; + + private final Optional withoutFeatureOverrideFor; + + private final Optional withoutPlan; + + private final Optional withoutSubscription; + + private final Map additionalProperties; + + private CompanyFeatureUsageExportMetadata( + Optional> companyIds, + Optional> creditTypeIds, + List featureIds, + Optional hasScheduledDowngrade, + Optional monetizedSubscriptions, + Optional> notificationEmailRecipientEmailAddresses, + Optional planId, + Optional> planIds, + Optional planVersionId, + Optional q, + Optional> subscriptionStatuses, + Optional> subscriptionTypes, + Optional withEntitlementFor, + Optional withSubscription, + Optional withoutFeatureOverrideFor, + Optional withoutPlan, + Optional withoutSubscription, + Map additionalProperties) { + this.companyIds = companyIds; + this.creditTypeIds = creditTypeIds; + this.featureIds = featureIds; + this.hasScheduledDowngrade = hasScheduledDowngrade; + this.monetizedSubscriptions = monetizedSubscriptions; + this.notificationEmailRecipientEmailAddresses = notificationEmailRecipientEmailAddresses; + this.planId = planId; + this.planIds = planIds; + this.planVersionId = planVersionId; + this.q = q; + this.subscriptionStatuses = subscriptionStatuses; + this.subscriptionTypes = subscriptionTypes; + this.withEntitlementFor = withEntitlementFor; + this.withSubscription = withSubscription; + this.withoutFeatureOverrideFor = withoutFeatureOverrideFor; + this.withoutPlan = withoutPlan; + this.withoutSubscription = withoutSubscription; + this.additionalProperties = additionalProperties; + } + + /** + * @return Restrict the export to these Schematic company IDs (starting with 'comp_') + */ + @JsonProperty("company_ids") + public Optional> getCompanyIds() { + return companyIds; + } + + /** + * @return Restrict the export to companies with these billing credit type IDs + */ + @JsonProperty("credit_type_ids") + public Optional> getCreditTypeIds() { + return creditTypeIds; + } + + /** + * @return Schematic feature IDs (starting with 'feat_') to include as usage columns; at least one is required + */ + @JsonProperty("feature_ids") + public List getFeatureIds() { + return featureIds; + } + + /** + * @return Restrict the export to companies that do (or do not) have a scheduled downgrade + */ + @JsonProperty("has_scheduled_downgrade") + public Optional getHasScheduledDowngrade() { + return hasScheduledDowngrade; + } + + /** + * @return Restrict the export to companies with (or without) a monetized subscription + */ + @JsonProperty("monetized_subscriptions") + public Optional getMonetizedSubscriptions() { + return monetizedSubscriptions; + } + + /** + * @return Account member emails to notify when the export completes; empty means the artifact is only retrievable via the API + */ + @JsonProperty("notification_email_recipient_email_addresses") + public Optional> getNotificationEmailRecipientEmailAddresses() { + return notificationEmailRecipientEmailAddresses; + } + + /** + * @return Restrict the export to companies on this plan ID (starting with 'plan_') + */ + @JsonProperty("plan_id") + public Optional getPlanId() { + return planId; + } + + /** + * @return Restrict the export to companies on any of these plan IDs + */ + @JsonProperty("plan_ids") + public Optional> getPlanIds() { + return planIds; + } + + /** + * @return Restrict the export to companies on this plan version ID + */ + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + + /** + * @return Free-text search over company name and keys + */ + @JsonProperty("q") + public Optional getQ() { + return q; + } + + /** + * @return Restrict the export to companies whose subscription has one of these statuses + */ + @JsonProperty("subscription_statuses") + public Optional> getSubscriptionStatuses() { + return subscriptionStatuses; + } + + /** + * @return Restrict the export to companies whose subscription has one of these types + */ + @JsonProperty("subscription_types") + public Optional> getSubscriptionTypes() { + return subscriptionTypes; + } + + /** + * @return Restrict the export to companies that have an entitlement for this feature ID + */ + @JsonProperty("with_entitlement_for") + public Optional getWithEntitlementFor() { + return withEntitlementFor; + } + + /** + * @return Restrict the export to companies with a subscription + */ + @JsonProperty("with_subscription") + public Optional getWithSubscription() { + return withSubscription; + } + + /** + * @return Restrict the export to companies without a company-level override for this feature ID + */ + @JsonProperty("without_feature_override_for") + public Optional getWithoutFeatureOverrideFor() { + return withoutFeatureOverrideFor; + } + + /** + * @return Restrict the export to companies without a plan + */ + @JsonProperty("without_plan") + public Optional getWithoutPlan() { + return withoutPlan; + } + + /** + * @return Restrict the export to companies without a subscription + */ + @JsonProperty("without_subscription") + public Optional getWithoutSubscription() { + return withoutSubscription; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyFeatureUsageExportMetadata && equalTo((CompanyFeatureUsageExportMetadata) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CompanyFeatureUsageExportMetadata other) { + return companyIds.equals(other.companyIds) + && creditTypeIds.equals(other.creditTypeIds) + && featureIds.equals(other.featureIds) + && hasScheduledDowngrade.equals(other.hasScheduledDowngrade) + && monetizedSubscriptions.equals(other.monetizedSubscriptions) + && notificationEmailRecipientEmailAddresses.equals(other.notificationEmailRecipientEmailAddresses) + && planId.equals(other.planId) + && planIds.equals(other.planIds) + && planVersionId.equals(other.planVersionId) + && q.equals(other.q) + && subscriptionStatuses.equals(other.subscriptionStatuses) + && subscriptionTypes.equals(other.subscriptionTypes) + && withEntitlementFor.equals(other.withEntitlementFor) + && withSubscription.equals(other.withSubscription) + && withoutFeatureOverrideFor.equals(other.withoutFeatureOverrideFor) + && withoutPlan.equals(other.withoutPlan) + && withoutSubscription.equals(other.withoutSubscription); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.companyIds, + this.creditTypeIds, + this.featureIds, + this.hasScheduledDowngrade, + this.monetizedSubscriptions, + this.notificationEmailRecipientEmailAddresses, + this.planId, + this.planIds, + this.planVersionId, + this.q, + this.subscriptionStatuses, + this.subscriptionTypes, + this.withEntitlementFor, + this.withSubscription, + this.withoutFeatureOverrideFor, + this.withoutPlan, + this.withoutSubscription); + } + + @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> companyIds = Optional.empty(); + + private Optional> creditTypeIds = Optional.empty(); + + private List featureIds = new ArrayList<>(); + + private Optional hasScheduledDowngrade = Optional.empty(); + + private Optional monetizedSubscriptions = Optional.empty(); + + private Optional> notificationEmailRecipientEmailAddresses = Optional.empty(); + + private Optional planId = Optional.empty(); + + private Optional> planIds = Optional.empty(); + + private Optional planVersionId = Optional.empty(); + + private Optional q = Optional.empty(); + + private Optional> subscriptionStatuses = Optional.empty(); + + private Optional> subscriptionTypes = Optional.empty(); + + private Optional withEntitlementFor = Optional.empty(); + + private Optional withSubscription = Optional.empty(); + + private Optional withoutFeatureOverrideFor = Optional.empty(); + + private Optional withoutPlan = Optional.empty(); + + private Optional withoutSubscription = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CompanyFeatureUsageExportMetadata other) { + companyIds(other.getCompanyIds()); + creditTypeIds(other.getCreditTypeIds()); + featureIds(other.getFeatureIds()); + hasScheduledDowngrade(other.getHasScheduledDowngrade()); + monetizedSubscriptions(other.getMonetizedSubscriptions()); + notificationEmailRecipientEmailAddresses(other.getNotificationEmailRecipientEmailAddresses()); + planId(other.getPlanId()); + planIds(other.getPlanIds()); + planVersionId(other.getPlanVersionId()); + q(other.getQ()); + subscriptionStatuses(other.getSubscriptionStatuses()); + subscriptionTypes(other.getSubscriptionTypes()); + withEntitlementFor(other.getWithEntitlementFor()); + withSubscription(other.getWithSubscription()); + withoutFeatureOverrideFor(other.getWithoutFeatureOverrideFor()); + withoutPlan(other.getWithoutPlan()); + withoutSubscription(other.getWithoutSubscription()); + return this; + } + + /** + *

Restrict the export to these Schematic company IDs (starting with 'comp_')

+ */ + @JsonSetter(value = "company_ids", nulls = Nulls.SKIP) + public Builder companyIds(Optional> companyIds) { + this.companyIds = companyIds; + return this; + } + + public Builder companyIds(List companyIds) { + this.companyIds = Optional.ofNullable(companyIds); + return this; + } + + /** + *

Restrict the export to companies with these billing credit type IDs

+ */ + @JsonSetter(value = "credit_type_ids", nulls = Nulls.SKIP) + public Builder creditTypeIds(Optional> creditTypeIds) { + this.creditTypeIds = creditTypeIds; + return this; + } + + public Builder creditTypeIds(List creditTypeIds) { + this.creditTypeIds = Optional.ofNullable(creditTypeIds); + return this; + } + + /** + *

Schematic feature IDs (starting with 'feat_') to include as usage columns; at least one is required

+ */ + @JsonSetter(value = "feature_ids", nulls = Nulls.SKIP) + public Builder featureIds(List featureIds) { + this.featureIds.clear(); + if (featureIds != null) { + this.featureIds.addAll(featureIds); + } + return this; + } + + public Builder addFeatureIds(String featureIds) { + this.featureIds.add(featureIds); + return this; + } + + public Builder addAllFeatureIds(List featureIds) { + if (featureIds != null) { + this.featureIds.addAll(featureIds); + } + return this; + } + + /** + *

Restrict the export to companies that do (or do not) have a scheduled downgrade

+ */ + @JsonSetter(value = "has_scheduled_downgrade", nulls = Nulls.SKIP) + public Builder hasScheduledDowngrade(Optional hasScheduledDowngrade) { + this.hasScheduledDowngrade = hasScheduledDowngrade; + return this; + } + + public Builder hasScheduledDowngrade(Boolean hasScheduledDowngrade) { + this.hasScheduledDowngrade = Optional.ofNullable(hasScheduledDowngrade); + return this; + } + + /** + *

Restrict the export to companies with (or without) a monetized subscription

+ */ + @JsonSetter(value = "monetized_subscriptions", nulls = Nulls.SKIP) + public Builder monetizedSubscriptions(Optional monetizedSubscriptions) { + this.monetizedSubscriptions = monetizedSubscriptions; + return this; + } + + public Builder monetizedSubscriptions(Boolean monetizedSubscriptions) { + this.monetizedSubscriptions = Optional.ofNullable(monetizedSubscriptions); + return this; + } + + /** + *

Account member emails to notify when the export completes; empty means the artifact is only retrievable via the API

+ */ + @JsonSetter(value = "notification_email_recipient_email_addresses", nulls = Nulls.SKIP) + public Builder notificationEmailRecipientEmailAddresses( + Optional> notificationEmailRecipientEmailAddresses) { + this.notificationEmailRecipientEmailAddresses = notificationEmailRecipientEmailAddresses; + return this; + } + + public Builder notificationEmailRecipientEmailAddresses(List notificationEmailRecipientEmailAddresses) { + this.notificationEmailRecipientEmailAddresses = + Optional.ofNullable(notificationEmailRecipientEmailAddresses); + return this; + } + + /** + *

Restrict the export to companies on this plan ID (starting with 'plan_')

+ */ + @JsonSetter(value = "plan_id", nulls = Nulls.SKIP) + public Builder planId(Optional planId) { + this.planId = planId; + return this; + } + + public Builder planId(String planId) { + this.planId = Optional.ofNullable(planId); + return this; + } + + /** + *

Restrict the export to companies on any of these plan IDs

+ */ + @JsonSetter(value = "plan_ids", nulls = Nulls.SKIP) + public Builder planIds(Optional> planIds) { + this.planIds = planIds; + return this; + } + + public Builder planIds(List planIds) { + this.planIds = Optional.ofNullable(planIds); + return this; + } + + /** + *

Restrict the export to companies on this plan version ID

+ */ + @JsonSetter(value = "plan_version_id", nulls = Nulls.SKIP) + public Builder planVersionId(Optional planVersionId) { + this.planVersionId = planVersionId; + return this; + } + + public Builder planVersionId(String planVersionId) { + this.planVersionId = Optional.ofNullable(planVersionId); + return this; + } + + /** + *

Free-text search over company name and keys

+ */ + @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; + } + + /** + *

Restrict the export to companies whose subscription has one of these statuses

+ */ + @JsonSetter(value = "subscription_statuses", nulls = Nulls.SKIP) + public Builder subscriptionStatuses(Optional> subscriptionStatuses) { + this.subscriptionStatuses = subscriptionStatuses; + return this; + } + + public Builder subscriptionStatuses(List subscriptionStatuses) { + this.subscriptionStatuses = Optional.ofNullable(subscriptionStatuses); + return this; + } + + /** + *

Restrict the export to companies whose subscription has one of these types

+ */ + @JsonSetter(value = "subscription_types", nulls = Nulls.SKIP) + public Builder subscriptionTypes(Optional> subscriptionTypes) { + this.subscriptionTypes = subscriptionTypes; + return this; + } + + public Builder subscriptionTypes(List subscriptionTypes) { + this.subscriptionTypes = Optional.ofNullable(subscriptionTypes); + return this; + } + + /** + *

Restrict the export to companies that have an entitlement for this feature ID

+ */ + @JsonSetter(value = "with_entitlement_for", nulls = Nulls.SKIP) + public Builder withEntitlementFor(Optional withEntitlementFor) { + this.withEntitlementFor = withEntitlementFor; + return this; + } + + public Builder withEntitlementFor(String withEntitlementFor) { + this.withEntitlementFor = Optional.ofNullable(withEntitlementFor); + return this; + } + + /** + *

Restrict the export to companies with a subscription

+ */ + @JsonSetter(value = "with_subscription", nulls = Nulls.SKIP) + public Builder withSubscription(Optional withSubscription) { + this.withSubscription = withSubscription; + return this; + } + + public Builder withSubscription(Boolean withSubscription) { + this.withSubscription = Optional.ofNullable(withSubscription); + return this; + } + + /** + *

Restrict the export to companies without a company-level override for this feature ID

+ */ + @JsonSetter(value = "without_feature_override_for", nulls = Nulls.SKIP) + public Builder withoutFeatureOverrideFor(Optional withoutFeatureOverrideFor) { + this.withoutFeatureOverrideFor = withoutFeatureOverrideFor; + return this; + } + + public Builder withoutFeatureOverrideFor(String withoutFeatureOverrideFor) { + this.withoutFeatureOverrideFor = Optional.ofNullable(withoutFeatureOverrideFor); + return this; + } + + /** + *

Restrict the export to companies without a plan

+ */ + @JsonSetter(value = "without_plan", nulls = Nulls.SKIP) + public Builder withoutPlan(Optional withoutPlan) { + this.withoutPlan = withoutPlan; + return this; + } + + public Builder withoutPlan(Boolean withoutPlan) { + this.withoutPlan = Optional.ofNullable(withoutPlan); + return this; + } + + /** + *

Restrict the export to companies without a subscription

+ */ + @JsonSetter(value = "without_subscription", nulls = Nulls.SKIP) + public Builder withoutSubscription(Optional withoutSubscription) { + this.withoutSubscription = withoutSubscription; + return this; + } + + public Builder withoutSubscription(Boolean withoutSubscription) { + this.withoutSubscription = Optional.ofNullable(withoutSubscription); + return this; + } + + public CompanyFeatureUsageExportMetadata build() { + return new CompanyFeatureUsageExportMetadata( + companyIds, + creditTypeIds, + featureIds, + hasScheduledDowngrade, + monetizedSubscriptions, + notificationEmailRecipientEmailAddresses, + planId, + planIds, + planVersionId, + q, + subscriptionStatuses, + subscriptionTypes, + withEntitlementFor, + withSubscription, + withoutFeatureOverrideFor, + withoutPlan, + withoutSubscription, + 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/types/CompanyPlanDetailResponseData.java b/src/main/java/com/schematic/api/types/CompanyPlanDetailResponseData.java index 03bc2e9c..0b73ba92 100644 --- a/src/main/java/com/schematic/api/types/CompanyPlanDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/CompanyPlanDetailResponseData.java @@ -36,6 +36,8 @@ public final class CompanyPlanDetailResponseData { private final BillingStrategy billingStrategy; + private final Optional> catalogs; + private final ChargeType chargeType; private final boolean companyCanTrial; @@ -121,6 +123,7 @@ private CompanyPlanDetailResponseData( Optional billingLinkedResource, Optional billingProduct, BillingStrategy billingStrategy, + Optional> catalogs, ChargeType chargeType, boolean companyCanTrial, long companyCount, @@ -166,6 +169,7 @@ private CompanyPlanDetailResponseData( this.billingLinkedResource = billingLinkedResource; this.billingProduct = billingProduct; this.billingStrategy = billingStrategy; + this.catalogs = catalogs; this.chargeType = chargeType; this.companyCanTrial = companyCanTrial; this.companyCount = companyCount; @@ -237,6 +241,11 @@ public BillingStrategy getBillingStrategy() { return billingStrategy; } + @JsonProperty("catalogs") + public Optional> getCatalogs() { + return catalogs; + } + @JsonProperty("charge_type") public ChargeType getChargeType() { return chargeType; @@ -448,6 +457,7 @@ private boolean equalTo(CompanyPlanDetailResponseData other) { && billingLinkedResource.equals(other.billingLinkedResource) && billingProduct.equals(other.billingProduct) && billingStrategy.equals(other.billingStrategy) + && catalogs.equals(other.catalogs) && chargeType.equals(other.chargeType) && companyCanTrial == other.companyCanTrial && companyCount == other.companyCount @@ -497,6 +507,7 @@ public int hashCode() { this.billingLinkedResource, this.billingProduct, this.billingStrategy, + this.catalogs, this.chargeType, this.companyCanTrial, this.companyCount, @@ -656,6 +667,10 @@ public interface _FinalStage { _FinalStage billingProduct(BillingProductDetailResponseData billingProduct); + _FinalStage catalogs(Optional> catalogs); + + _FinalStage catalogs(List catalogs); + _FinalStage companyId(Optional companyId); _FinalStage companyId(String companyId); @@ -851,6 +866,8 @@ public static final class Builder private Optional companyId = Optional.empty(); + private Optional> catalogs = Optional.empty(); + private Optional billingProduct = Optional.empty(); private Optional billingLinkedResource = Optional.empty(); @@ -874,6 +891,7 @@ public Builder from(CompanyPlanDetailResponseData other) { billingLinkedResource(other.getBillingLinkedResource()); billingProduct(other.getBillingProduct()); billingStrategy(other.getBillingStrategy()); + catalogs(other.getCatalogs()); chargeType(other.getChargeType()); companyCanTrial(other.getCompanyCanTrial()); companyCount(other.getCompanyCount()); @@ -1389,6 +1407,19 @@ public _FinalStage companyId(Optional companyId) { return this; } + @java.lang.Override + public _FinalStage catalogs(List catalogs) { + this.catalogs = Optional.ofNullable(catalogs); + return this; + } + + @java.lang.Override + @JsonSetter(value = "catalogs", nulls = Nulls.SKIP) + public _FinalStage catalogs(Optional> catalogs) { + this.catalogs = catalogs; + return this; + } + @java.lang.Override public _FinalStage billingProduct(BillingProductDetailResponseData billingProduct) { this.billingProduct = Optional.ofNullable(billingProduct); @@ -1474,6 +1505,7 @@ public CompanyPlanDetailResponseData build() { billingLinkedResource, billingProduct, billingStrategy, + catalogs, chargeType, companyCanTrial, companyCount, diff --git a/src/main/java/com/schematic/api/types/ComponentResponseData.java b/src/main/java/com/schematic/api/types/ComponentResponseData.java index 1582dedf..62be8f37 100644 --- a/src/main/java/com/schematic/api/types/ComponentResponseData.java +++ b/src/main/java/com/schematic/api/types/ComponentResponseData.java @@ -24,6 +24,8 @@ public final class ComponentResponseData { private final Optional> ast; + private final Optional catalogId; + private final OffsetDateTime createdAt; private final String id; @@ -40,6 +42,7 @@ public final class ComponentResponseData { private ComponentResponseData( Optional> ast, + Optional catalogId, OffsetDateTime createdAt, String id, String name, @@ -48,6 +51,7 @@ private ComponentResponseData( OffsetDateTime updatedAt, Map additionalProperties) { this.ast = ast; + this.catalogId = catalogId; this.createdAt = createdAt; this.id = id; this.name = name; @@ -62,6 +66,11 @@ public Optional> getAst() { return ast; } + @JsonProperty("catalog_id") + public Optional getCatalogId() { + return catalogId; + } + @JsonProperty("created_at") public OffsetDateTime getCreatedAt() { return createdAt; @@ -105,6 +114,7 @@ public Map getAdditionalProperties() { private boolean equalTo(ComponentResponseData other) { return ast.equals(other.ast) + && catalogId.equals(other.catalogId) && createdAt.equals(other.createdAt) && id.equals(other.id) && name.equals(other.name) @@ -115,7 +125,8 @@ private boolean equalTo(ComponentResponseData other) { @java.lang.Override public int hashCode() { - return Objects.hash(this.ast, this.createdAt, this.id, this.name, this.state, this.type, this.updatedAt); + return Objects.hash( + this.ast, this.catalogId, this.createdAt, this.id, this.name, this.state, this.type, this.updatedAt); } @java.lang.Override @@ -163,6 +174,10 @@ public interface _FinalStage { _FinalStage ast(Optional> ast); _FinalStage ast(Map ast); + + _FinalStage catalogId(Optional catalogId); + + _FinalStage catalogId(String catalogId); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -180,6 +195,8 @@ public static final class Builder private OffsetDateTime updatedAt; + private Optional catalogId = Optional.empty(); + private Optional> ast = Optional.empty(); @JsonAnySetter @@ -190,6 +207,7 @@ private Builder() {} @java.lang.Override public Builder from(ComponentResponseData other) { ast(other.getAst()); + catalogId(other.getCatalogId()); createdAt(other.getCreatedAt()); id(other.getId()); name(other.getName()); @@ -241,6 +259,19 @@ public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { return this; } + @java.lang.Override + public _FinalStage catalogId(String catalogId) { + this.catalogId = Optional.ofNullable(catalogId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "catalog_id", nulls = Nulls.SKIP) + public _FinalStage catalogId(Optional catalogId) { + this.catalogId = catalogId; + return this; + } + @java.lang.Override public _FinalStage ast(Map ast) { this.ast = Optional.ofNullable(ast); @@ -256,7 +287,8 @@ public _FinalStage ast(Optional> ast) { @java.lang.Override public ComponentResponseData build() { - return new ComponentResponseData(ast, createdAt, id, name, state, type, updatedAt, additionalProperties); + return new ComponentResponseData( + ast, catalogId, createdAt, id, name, state, type, updatedAt, additionalProperties); } @java.lang.Override diff --git a/src/main/java/com/schematic/api/types/CreateEntitlementInBundleRequestBody.java b/src/main/java/com/schematic/api/types/CreateEntitlementInBundleRequestBody.java index 1031f6d3..3c14f853 100644 --- a/src/main/java/com/schematic/api/types/CreateEntitlementInBundleRequestBody.java +++ b/src/main/java/com/schematic/api/types/CreateEntitlementInBundleRequestBody.java @@ -80,6 +80,8 @@ public final class CreateEntitlementInBundleRequestBody { private final EntitlementValueType valueType; + private final Optional> warningTiers; + private final Optional yearlyMeteredPriceId; private final Optional> yearlyPriceTiers; @@ -120,6 +122,7 @@ private CreateEntitlementInBundleRequestBody( Optional valueNumeric, Optional valueTraitId, EntitlementValueType valueType, + Optional> warningTiers, Optional yearlyMeteredPriceId, Optional> yearlyPriceTiers, Optional yearlyUnitPrice, @@ -154,6 +157,7 @@ private CreateEntitlementInBundleRequestBody( this.valueNumeric = valueNumeric; this.valueTraitId = valueTraitId; this.valueType = valueType; + this.warningTiers = warningTiers; this.yearlyMeteredPriceId = yearlyMeteredPriceId; this.yearlyPriceTiers = yearlyPriceTiers; this.yearlyUnitPrice = yearlyUnitPrice; @@ -312,6 +316,11 @@ public EntitlementValueType getValueType() { return valueType; } + @JsonProperty("warning_tiers") + public Optional> getWarningTiers() { + return warningTiers; + } + @JsonProperty("yearly_metered_price_id") public Optional getYearlyMeteredPriceId() { return yearlyMeteredPriceId; @@ -374,6 +383,7 @@ private boolean equalTo(CreateEntitlementInBundleRequestBody other) { && valueNumeric.equals(other.valueNumeric) && valueTraitId.equals(other.valueTraitId) && valueType.equals(other.valueType) + && warningTiers.equals(other.warningTiers) && yearlyMeteredPriceId.equals(other.yearlyMeteredPriceId) && yearlyPriceTiers.equals(other.yearlyPriceTiers) && yearlyUnitPrice.equals(other.yearlyUnitPrice) @@ -412,6 +422,7 @@ public int hashCode() { this.valueNumeric, this.valueTraitId, this.valueType, + this.warningTiers, this.yearlyMeteredPriceId, this.yearlyPriceTiers, this.yearlyUnitPrice, @@ -558,6 +569,10 @@ public interface _FinalStage { _FinalStage valueTraitId(String valueTraitId); + _FinalStage warningTiers(Optional> warningTiers); + + _FinalStage warningTiers(List warningTiers); + _FinalStage yearlyMeteredPriceId(Optional yearlyMeteredPriceId); _FinalStage yearlyMeteredPriceId(String yearlyMeteredPriceId); @@ -591,6 +606,8 @@ public static final class Builder implements FeatureIdStage, PlanIdStage, ValueT private Optional yearlyMeteredPriceId = Optional.empty(); + private Optional> warningTiers = Optional.empty(); + private Optional valueTraitId = Optional.empty(); private Optional valueNumeric = Optional.empty(); @@ -679,6 +696,7 @@ public Builder from(CreateEntitlementInBundleRequestBody other) { valueNumeric(other.getValueNumeric()); valueTraitId(other.getValueTraitId()); valueType(other.getValueType()); + warningTiers(other.getWarningTiers()); yearlyMeteredPriceId(other.getYearlyMeteredPriceId()); yearlyPriceTiers(other.getYearlyPriceTiers()); yearlyUnitPrice(other.getYearlyUnitPrice()); @@ -759,6 +777,19 @@ public _FinalStage yearlyMeteredPriceId(Optional yearlyMeteredPriceId) { return this; } + @java.lang.Override + public _FinalStage warningTiers(List warningTiers) { + this.warningTiers = Optional.ofNullable(warningTiers); + return this; + } + + @java.lang.Override + @JsonSetter(value = "warning_tiers", nulls = Nulls.SKIP) + public _FinalStage warningTiers(Optional> warningTiers) { + this.warningTiers = warningTiers; + return this; + } + @java.lang.Override public _FinalStage valueTraitId(String valueTraitId) { this.valueTraitId = Optional.ofNullable(valueTraitId); @@ -1143,6 +1174,7 @@ public CreateEntitlementInBundleRequestBody build() { valueNumeric, valueTraitId, valueType, + warningTiers, yearlyMeteredPriceId, yearlyPriceTiers, yearlyUnitPrice, diff --git a/src/main/java/com/schematic/api/types/CreditsAutoTopupSuccess.java b/src/main/java/com/schematic/api/types/CreditsAutoTopupSuccess.java new file mode 100644 index 00000000..ca2c7050 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CreditsAutoTopupSuccess.java @@ -0,0 +1,206 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.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.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 = CreditsAutoTopupSuccess.Builder.class) +public final class CreditsAutoTopupSuccess { + private final Optional company; + + private final Optional credit; + + private final String grantId; + + private final long quantity; + + private final Map additionalProperties; + + private CreditsAutoTopupSuccess( + Optional company, + Optional credit, + String grantId, + long quantity, + Map additionalProperties) { + this.company = company; + this.credit = credit; + this.grantId = grantId; + this.quantity = quantity; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("company") + public Optional getCompany() { + return company; + } + + @JsonProperty("credit") + public Optional getCredit() { + return credit; + } + + @JsonProperty("grant_id") + public String getGrantId() { + return grantId; + } + + @JsonProperty("quantity") + public long getQuantity() { + return quantity; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreditsAutoTopupSuccess && equalTo((CreditsAutoTopupSuccess) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreditsAutoTopupSuccess other) { + return company.equals(other.company) + && credit.equals(other.credit) + && grantId.equals(other.grantId) + && quantity == other.quantity; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.company, this.credit, this.grantId, this.quantity); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static GrantIdStage builder() { + return new Builder(); + } + + public interface GrantIdStage { + QuantityStage grantId(@NotNull String grantId); + + Builder from(CreditsAutoTopupSuccess other); + } + + public interface QuantityStage { + _FinalStage quantity(long quantity); + } + + public interface _FinalStage { + CreditsAutoTopupSuccess build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage company(Optional company); + + _FinalStage company(CreditsAutoTopupCompanySummary company); + + _FinalStage credit(Optional credit); + + _FinalStage credit(CreditsAutoTopupCreditSummary credit); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements GrantIdStage, QuantityStage, _FinalStage { + private String grantId; + + private long quantity; + + private Optional credit = Optional.empty(); + + private Optional company = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreditsAutoTopupSuccess other) { + company(other.getCompany()); + credit(other.getCredit()); + grantId(other.getGrantId()); + quantity(other.getQuantity()); + return this; + } + + @java.lang.Override + @JsonSetter("grant_id") + public QuantityStage grantId(@NotNull String grantId) { + this.grantId = Objects.requireNonNull(grantId, "grantId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("quantity") + public _FinalStage quantity(long quantity) { + this.quantity = quantity; + return this; + } + + @java.lang.Override + public _FinalStage credit(CreditsAutoTopupCreditSummary credit) { + this.credit = Optional.ofNullable(credit); + return this; + } + + @java.lang.Override + @JsonSetter(value = "credit", nulls = Nulls.SKIP) + public _FinalStage credit(Optional credit) { + this.credit = credit; + return this; + } + + @java.lang.Override + public _FinalStage company(CreditsAutoTopupCompanySummary company) { + this.company = Optional.ofNullable(company); + return this; + } + + @java.lang.Override + @JsonSetter(value = "company", nulls = Nulls.SKIP) + public _FinalStage company(Optional company) { + this.company = company; + return this; + } + + @java.lang.Override + public CreditsAutoTopupSuccess build() { + return new CreditsAutoTopupSuccess(company, credit, grantId, quantity, 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/types/CreditsCreditPurchaseSuccess.java b/src/main/java/com/schematic/api/types/CreditsCreditPurchaseSuccess.java new file mode 100644 index 00000000..2aa90d27 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CreditsCreditPurchaseSuccess.java @@ -0,0 +1,276 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.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.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreditsCreditPurchaseSuccess.Builder.class) +public final class CreditsCreditPurchaseSuccess { + private final String bundleId; + + private final String bundleName; + + private final Optional company; + + private final Optional credit; + + private final List grantIds; + + private final long quantity; + + private final Map additionalProperties; + + private CreditsCreditPurchaseSuccess( + String bundleId, + String bundleName, + Optional company, + Optional credit, + List grantIds, + long quantity, + Map additionalProperties) { + this.bundleId = bundleId; + this.bundleName = bundleName; + this.company = company; + this.credit = credit; + this.grantIds = grantIds; + this.quantity = quantity; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("bundle_id") + public String getBundleId() { + return bundleId; + } + + @JsonProperty("bundle_name") + public String getBundleName() { + return bundleName; + } + + @JsonProperty("company") + public Optional getCompany() { + return company; + } + + @JsonProperty("credit") + public Optional getCredit() { + return credit; + } + + @JsonProperty("grant_ids") + public List getGrantIds() { + return grantIds; + } + + @JsonProperty("quantity") + public long getQuantity() { + return quantity; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreditsCreditPurchaseSuccess && equalTo((CreditsCreditPurchaseSuccess) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreditsCreditPurchaseSuccess other) { + return bundleId.equals(other.bundleId) + && bundleName.equals(other.bundleName) + && company.equals(other.company) + && credit.equals(other.credit) + && grantIds.equals(other.grantIds) + && quantity == other.quantity; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.bundleId, this.bundleName, this.company, this.credit, this.grantIds, this.quantity); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BundleIdStage builder() { + return new Builder(); + } + + public interface BundleIdStage { + BundleNameStage bundleId(@NotNull String bundleId); + + Builder from(CreditsCreditPurchaseSuccess other); + } + + public interface BundleNameStage { + QuantityStage bundleName(@NotNull String bundleName); + } + + public interface QuantityStage { + _FinalStage quantity(long quantity); + } + + public interface _FinalStage { + CreditsCreditPurchaseSuccess build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage company(Optional company); + + _FinalStage company(CreditsWebhookCompanySummary company); + + _FinalStage credit(Optional credit); + + _FinalStage credit(CreditsWebhookCreditSummary credit); + + _FinalStage grantIds(List grantIds); + + _FinalStage addGrantIds(String grantIds); + + _FinalStage addAllGrantIds(List grantIds); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BundleIdStage, BundleNameStage, QuantityStage, _FinalStage { + private String bundleId; + + private String bundleName; + + private long quantity; + + private List grantIds = new ArrayList<>(); + + private Optional credit = Optional.empty(); + + private Optional company = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreditsCreditPurchaseSuccess other) { + bundleId(other.getBundleId()); + bundleName(other.getBundleName()); + company(other.getCompany()); + credit(other.getCredit()); + grantIds(other.getGrantIds()); + quantity(other.getQuantity()); + return this; + } + + @java.lang.Override + @JsonSetter("bundle_id") + public BundleNameStage bundleId(@NotNull String bundleId) { + this.bundleId = Objects.requireNonNull(bundleId, "bundleId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("bundle_name") + public QuantityStage bundleName(@NotNull String bundleName) { + this.bundleName = Objects.requireNonNull(bundleName, "bundleName must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("quantity") + public _FinalStage quantity(long quantity) { + this.quantity = quantity; + return this; + } + + @java.lang.Override + public _FinalStage addAllGrantIds(List grantIds) { + if (grantIds != null) { + this.grantIds.addAll(grantIds); + } + return this; + } + + @java.lang.Override + public _FinalStage addGrantIds(String grantIds) { + this.grantIds.add(grantIds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "grant_ids", nulls = Nulls.SKIP) + public _FinalStage grantIds(List grantIds) { + this.grantIds.clear(); + if (grantIds != null) { + this.grantIds.addAll(grantIds); + } + return this; + } + + @java.lang.Override + public _FinalStage credit(CreditsWebhookCreditSummary credit) { + this.credit = Optional.ofNullable(credit); + return this; + } + + @java.lang.Override + @JsonSetter(value = "credit", nulls = Nulls.SKIP) + public _FinalStage credit(Optional credit) { + this.credit = credit; + return this; + } + + @java.lang.Override + public _FinalStage company(CreditsWebhookCompanySummary company) { + this.company = Optional.ofNullable(company); + return this; + } + + @java.lang.Override + @JsonSetter(value = "company", nulls = Nulls.SKIP) + public _FinalStage company(Optional company) { + this.company = company; + return this; + } + + @java.lang.Override + public CreditsCreditPurchaseSuccess build() { + return new CreditsCreditPurchaseSuccess( + bundleId, bundleName, company, credit, grantIds, quantity, 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/types/CreditsWebhookCompanySummary.java b/src/main/java/com/schematic/api/types/CreditsWebhookCompanySummary.java new file mode 100644 index 00000000..e42f3da5 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CreditsWebhookCompanySummary.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.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.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreditsWebhookCompanySummary.Builder.class) +public final class CreditsWebhookCompanySummary { + private final String id; + + private final String name; + + private final Map additionalProperties; + + private CreditsWebhookCompanySummary(String id, String name, Map additionalProperties) { + this.id = id; + this.name = name; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreditsWebhookCompanySummary && equalTo((CreditsWebhookCompanySummary) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreditsWebhookCompanySummary other) { + return id.equals(other.id) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + NameStage id(@NotNull String id); + + Builder from(CreditsWebhookCompanySummary other); + } + + public interface NameStage { + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + CreditsWebhookCompanySummary build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, NameStage, _FinalStage { + private String id; + + private String name; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreditsWebhookCompanySummary other) { + id(other.getId()); + name(other.getName()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + 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 CreditsWebhookCompanySummary build() { + return new CreditsWebhookCompanySummary(id, 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/types/CreditsWebhookCreditSummary.java b/src/main/java/com/schematic/api/types/CreditsWebhookCreditSummary.java new file mode 100644 index 00000000..c198c3c0 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CreditsWebhookCreditSummary.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.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.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreditsWebhookCreditSummary.Builder.class) +public final class CreditsWebhookCreditSummary { + private final String id; + + private final String name; + + private final Map additionalProperties; + + private CreditsWebhookCreditSummary(String id, String name, Map additionalProperties) { + this.id = id; + this.name = name; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreditsWebhookCreditSummary && equalTo((CreditsWebhookCreditSummary) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreditsWebhookCreditSummary other) { + return id.equals(other.id) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + NameStage id(@NotNull String id); + + Builder from(CreditsWebhookCreditSummary other); + } + + public interface NameStage { + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + CreditsWebhookCreditSummary build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, NameStage, _FinalStage { + private String id; + + private String name; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreditsWebhookCreditSummary other) { + id(other.getId()); + name(other.getName()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + 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 CreditsWebhookCreditSummary build() { + return new CreditsWebhookCreditSummary(id, 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/types/CustomerBillingAddress.java b/src/main/java/com/schematic/api/types/CustomerBillingAddress.java new file mode 100644 index 00000000..5658258d --- /dev/null +++ b/src/main/java/com/schematic/api/types/CustomerBillingAddress.java @@ -0,0 +1,241 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.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.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CustomerBillingAddress.Builder.class) +public final class CustomerBillingAddress { + private final String city; + + private final String country; + + private final String line1; + + private final String line2; + + private final String postalCode; + + private final String state; + + private final Map additionalProperties; + + private CustomerBillingAddress( + String city, + String country, + String line1, + String line2, + String postalCode, + String state, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.state = state; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("city") + public String getCity() { + return city; + } + + @JsonProperty("country") + public String getCountry() { + return country; + } + + @JsonProperty("line1") + public String getLine1() { + return line1; + } + + @JsonProperty("line2") + public String getLine2() { + return line2; + } + + @JsonProperty("postal_code") + public String getPostalCode() { + return postalCode; + } + + @JsonProperty("state") + public String getState() { + return state; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CustomerBillingAddress && equalTo((CustomerBillingAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CustomerBillingAddress other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && postalCode.equals(other.postalCode) + && state.equals(other.state); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.line1, this.line2, this.postalCode, this.state); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CityStage builder() { + return new Builder(); + } + + public interface CityStage { + CountryStage city(@NotNull String city); + + Builder from(CustomerBillingAddress other); + } + + public interface CountryStage { + Line1Stage country(@NotNull String country); + } + + public interface Line1Stage { + Line2Stage line1(@NotNull String line1); + } + + public interface Line2Stage { + PostalCodeStage line2(@NotNull String line2); + } + + public interface PostalCodeStage { + StateStage postalCode(@NotNull String postalCode); + } + + public interface StateStage { + _FinalStage state(@NotNull String state); + } + + public interface _FinalStage { + CustomerBillingAddress build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CityStage, CountryStage, Line1Stage, Line2Stage, PostalCodeStage, StateStage, _FinalStage { + private String city; + + private String country; + + private String line1; + + private String line2; + + private String postalCode; + + private String state; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CustomerBillingAddress other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + postalCode(other.getPostalCode()); + state(other.getState()); + return this; + } + + @java.lang.Override + @JsonSetter("city") + public CountryStage city(@NotNull String city) { + this.city = Objects.requireNonNull(city, "city must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("country") + public Line1Stage country(@NotNull String country) { + this.country = Objects.requireNonNull(country, "country must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("line1") + public Line2Stage line1(@NotNull String line1) { + this.line1 = Objects.requireNonNull(line1, "line1 must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("line2") + public PostalCodeStage line2(@NotNull String line2) { + this.line2 = Objects.requireNonNull(line2, "line2 must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("postal_code") + public StateStage postalCode(@NotNull String postalCode) { + this.postalCode = Objects.requireNonNull(postalCode, "postalCode must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("state") + public _FinalStage state(@NotNull String state) { + this.state = Objects.requireNonNull(state, "state must not be null"); + return this; + } + + @java.lang.Override + public CustomerBillingAddress build() { + return new CustomerBillingAddress(city, country, line1, line2, postalCode, state, 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/types/DataExportMetadata.java b/src/main/java/com/schematic/api/types/DataExportMetadata.java new file mode 100644 index 00000000..407f0b90 --- /dev/null +++ b/src/main/java/com/schematic/api/types/DataExportMetadata.java @@ -0,0 +1,225 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class DataExportMetadata { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private DataExportMetadata(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static DataExportMetadata auditLog(AuditLogExportMetadata value) { + return new DataExportMetadata(new AuditLogValue(value)); + } + + public static DataExportMetadata companyFeatureUsage(CompanyFeatureUsageExportMetadata value) { + return new DataExportMetadata(new CompanyFeatureUsageValue(value)); + } + + public boolean isAuditLog() { + return value instanceof AuditLogValue; + } + + public boolean isCompanyFeatureUsage() { + return value instanceof CompanyFeatureUsageValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getAuditLog() { + if (isAuditLog()) { + return Optional.of(((AuditLogValue) value).value); + } + return Optional.empty(); + } + + public Optional getCompanyFeatureUsage() { + if (isCompanyFeatureUsage()) { + return Optional.of(((CompanyFeatureUsageValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DataExportMetadata && value.equals(((DataExportMetadata) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitAuditLog(AuditLogExportMetadata auditLog); + + T visitCompanyFeatureUsage(CompanyFeatureUsageExportMetadata companyFeatureUsage); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + property = "export_type", + visible = true, + defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(AuditLogValue.class), @JsonSubTypes.Type(CompanyFeatureUsageValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("audit-log") + @JsonIgnoreProperties("export_type") + private static final class AuditLogValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "export_type", allowSetters = true) + private AuditLogExportMetadata value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AuditLogValue() {} + + private AuditLogValue(AuditLogExportMetadata value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAuditLog(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AuditLogValue && equalTo((AuditLogValue) other); + } + + private boolean equalTo(AuditLogValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "DataExportMetadata{" + "value: " + value + "}"; + } + } + + @JsonTypeName("company-feature-usage") + @JsonIgnoreProperties("export_type") + private static final class CompanyFeatureUsageValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "export_type", allowSetters = true) + private CompanyFeatureUsageExportMetadata value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CompanyFeatureUsageValue() {} + + private CompanyFeatureUsageValue(CompanyFeatureUsageExportMetadata value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitCompanyFeatureUsage(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyFeatureUsageValue && equalTo((CompanyFeatureUsageValue) other); + } + + private boolean equalTo(CompanyFeatureUsageValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "DataExportMetadata{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("export_type") + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "DataExportMetadata{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/schematic/api/types/DataExportOutputFileType.java b/src/main/java/com/schematic/api/types/DataExportOutputFileType.java new file mode 100644 index 00000000..6e538f67 --- /dev/null +++ b/src/main/java/com/schematic/api/types/DataExportOutputFileType.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class DataExportOutputFileType { + public static final DataExportOutputFileType CSV_GZ = new DataExportOutputFileType(Value.CSV_GZ, "csv.gz"); + + public static final DataExportOutputFileType CSV = new DataExportOutputFileType(Value.CSV, "csv"); + + private final Value value; + + private final String string; + + DataExportOutputFileType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof DataExportOutputFileType + && this.string.equals(((DataExportOutputFileType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CSV_GZ: + return visitor.visitCsvGz(); + case CSV: + return visitor.visitCsv(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static DataExportOutputFileType valueOf(String value) { + switch (value) { + case "csv.gz": + return CSV_GZ; + case "csv": + return CSV; + default: + return new DataExportOutputFileType(Value.UNKNOWN, value); + } + } + + public enum Value { + CSV, + + CSV_GZ, + + UNKNOWN + } + + public interface Visitor { + T visitCsv(); + + T visitCsvGz(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/DataExportResponseData.java b/src/main/java/com/schematic/api/types/DataExportResponseData.java index 9fd815dc..f1f893f9 100644 --- a/src/main/java/com/schematic/api/types/DataExportResponseData.java +++ b/src/main/java/com/schematic/api/types/DataExportResponseData.java @@ -9,12 +9,14 @@ 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.time.OffsetDateTime; 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) @@ -26,13 +28,13 @@ public final class DataExportResponseData { private final String environmentId; - private final String exportType; + private final DataExportType exportType; private final String id; - private final String metadata; + private final Optional metadata; - private final String outputFileType; + private final DataExportOutputFileType outputFileType; private final DataExportStatus status; @@ -44,10 +46,10 @@ private DataExportResponseData( String accountId, OffsetDateTime createdAt, String environmentId, - String exportType, + DataExportType exportType, String id, - String metadata, - String outputFileType, + Optional metadata, + DataExportOutputFileType outputFileType, DataExportStatus status, OffsetDateTime updatedAt, Map additionalProperties) { @@ -79,7 +81,7 @@ public String getEnvironmentId() { } @JsonProperty("export_type") - public String getExportType() { + public DataExportType getExportType() { return exportType; } @@ -89,12 +91,12 @@ public String getId() { } @JsonProperty("metadata") - public String getMetadata() { + public Optional getMetadata() { return metadata; } @JsonProperty("output_file_type") - public String getOutputFileType() { + public DataExportOutputFileType getOutputFileType() { return outputFileType; } @@ -169,19 +171,15 @@ public interface EnvironmentIdStage { } public interface ExportTypeStage { - IdStage exportType(@NotNull String exportType); + IdStage exportType(@NotNull DataExportType exportType); } public interface IdStage { - MetadataStage id(@NotNull String id); - } - - public interface MetadataStage { - OutputFileTypeStage metadata(@NotNull String metadata); + OutputFileTypeStage id(@NotNull String id); } public interface OutputFileTypeStage { - StatusStage outputFileType(@NotNull String outputFileType); + StatusStage outputFileType(@NotNull DataExportOutputFileType outputFileType); } public interface StatusStage { @@ -198,6 +196,10 @@ public interface _FinalStage { _FinalStage additionalProperty(String key, Object value); _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage metadata(Optional metadata); + + _FinalStage metadata(DataExportMetadata metadata); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -207,7 +209,6 @@ public static final class Builder EnvironmentIdStage, ExportTypeStage, IdStage, - MetadataStage, OutputFileTypeStage, StatusStage, UpdatedAtStage, @@ -218,18 +219,18 @@ public static final class Builder private String environmentId; - private String exportType; + private DataExportType exportType; private String id; - private String metadata; - - private String outputFileType; + private DataExportOutputFileType outputFileType; private DataExportStatus status; private OffsetDateTime updatedAt; + private Optional metadata = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -272,28 +273,21 @@ public ExportTypeStage environmentId(@NotNull String environmentId) { @java.lang.Override @JsonSetter("export_type") - public IdStage exportType(@NotNull String exportType) { + public IdStage exportType(@NotNull DataExportType exportType) { this.exportType = Objects.requireNonNull(exportType, "exportType must not be null"); return this; } @java.lang.Override @JsonSetter("id") - public MetadataStage id(@NotNull String id) { + public OutputFileTypeStage id(@NotNull String id) { this.id = Objects.requireNonNull(id, "id must not be null"); return this; } - @java.lang.Override - @JsonSetter("metadata") - public OutputFileTypeStage metadata(@NotNull String metadata) { - this.metadata = Objects.requireNonNull(metadata, "metadata must not be null"); - return this; - } - @java.lang.Override @JsonSetter("output_file_type") - public StatusStage outputFileType(@NotNull String outputFileType) { + public StatusStage outputFileType(@NotNull DataExportOutputFileType outputFileType) { this.outputFileType = Objects.requireNonNull(outputFileType, "outputFileType must not be null"); return this; } @@ -312,6 +306,19 @@ public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { return this; } + @java.lang.Override + public _FinalStage metadata(DataExportMetadata metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional metadata) { + this.metadata = metadata; + return this; + } + @java.lang.Override public DataExportResponseData build() { return new DataExportResponseData( diff --git a/src/main/java/com/schematic/api/types/DataExportType.java b/src/main/java/com/schematic/api/types/DataExportType.java new file mode 100644 index 00000000..774c1f96 --- /dev/null +++ b/src/main/java/com/schematic/api/types/DataExportType.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class DataExportType { + public static final DataExportType COMPANY_FEATURE_USAGE = + new DataExportType(Value.COMPANY_FEATURE_USAGE, "company-feature-usage"); + + public static final DataExportType AUDIT_LOG = new DataExportType(Value.AUDIT_LOG, "audit-log"); + + private final Value value; + + private final String string; + + DataExportType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof DataExportType && this.string.equals(((DataExportType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case COMPANY_FEATURE_USAGE: + return visitor.visitCompanyFeatureUsage(); + case AUDIT_LOG: + return visitor.visitAuditLog(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static DataExportType valueOf(String value) { + switch (value) { + case "company-feature-usage": + return COMPANY_FEATURE_USAGE; + case "audit-log": + return AUDIT_LOG; + default: + return new DataExportType(Value.UNKNOWN, value); + } + } + + public enum Value { + AUDIT_LOG, + + COMPANY_FEATURE_USAGE, + + UNKNOWN + } + + public interface Visitor { + T visitAuditLog(); + + T visitCompanyFeatureUsage(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/FeatureEntitlement.java b/src/main/java/com/schematic/api/types/FeatureEntitlement.java index 9083b916..7d4d7594 100644 --- a/src/main/java/com/schematic/api/types/FeatureEntitlement.java +++ b/src/main/java/com/schematic/api/types/FeatureEntitlement.java @@ -14,6 +14,7 @@ import com.schematic.api.core.ObjectMappers; import java.time.OffsetDateTime; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -58,6 +59,8 @@ public final class FeatureEntitlement { private final EntitlementValueType valueType; + private final Optional> warningTiers; + private final Map additionalProperties; private FeatureEntitlement( @@ -79,6 +82,7 @@ private FeatureEntitlement( Optional softLimit, Optional usage, EntitlementValueType valueType, + Optional> warningTiers, Map additionalProperties) { this.allocation = allocation; this.consumptionRate = consumptionRate; @@ -98,6 +102,7 @@ private FeatureEntitlement( this.softLimit = softLimit; this.usage = usage; this.valueType = valueType; + this.warningTiers = warningTiers; this.additionalProperties = additionalProperties; } @@ -245,6 +250,14 @@ public EntitlementValueType getValueType() { return valueType; } + /** + * @return Customer-defined usage warning thresholds configured on this entitlement + */ + @JsonProperty("warning_tiers") + public Optional> getWarningTiers() { + return warningTiers; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -274,7 +287,8 @@ private boolean equalTo(FeatureEntitlement other) { && monthReset.equals(other.monthReset) && softLimit.equals(other.softLimit) && usage.equals(other.usage) - && valueType.equals(other.valueType); + && valueType.equals(other.valueType) + && warningTiers.equals(other.warningTiers); } @java.lang.Override @@ -297,7 +311,8 @@ public int hashCode() { this.monthReset, this.softLimit, this.usage, - this.valueType); + this.valueType, + this.warningTiers); } @java.lang.Override @@ -443,6 +458,13 @@ public interface _FinalStage { _FinalStage usage(Optional usage); _FinalStage usage(Long usage); + + /** + *

Customer-defined usage warning thresholds configured on this entitlement

+ */ + _FinalStage warningTiers(Optional> warningTiers); + + _FinalStage warningTiers(List warningTiers); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -453,6 +475,8 @@ public static final class Builder implements FeatureIdStage, FeatureKeyStage, Va private EntitlementValueType valueType; + private Optional> warningTiers = Optional.empty(); + private Optional usage = Optional.empty(); private Optional softLimit = Optional.empty(); @@ -508,6 +532,7 @@ public Builder from(FeatureEntitlement other) { softLimit(other.getSoftLimit()); usage(other.getUsage()); valueType(other.getValueType()); + warningTiers(other.getWarningTiers()); return this; } @@ -544,6 +569,26 @@ public _FinalStage valueType(@NotNull EntitlementValueType valueType) { return this; } + /** + *

Customer-defined usage warning thresholds configured on this entitlement

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage warningTiers(List warningTiers) { + this.warningTiers = Optional.ofNullable(warningTiers); + return this; + } + + /** + *

Customer-defined usage warning thresholds configured on this entitlement

+ */ + @java.lang.Override + @JsonSetter(value = "warning_tiers", nulls = Nulls.SKIP) + public _FinalStage warningTiers(Optional> warningTiers) { + this.warningTiers = warningTiers; + return this; + } + /** *

If the company has a numeric entitlement for this feature, the current usage amount

* @return Reference to {@code this} so that method calls can be chained together. @@ -865,6 +910,7 @@ public FeatureEntitlement build() { softLimit, usage, valueType, + warningTiers, additionalProperties); } diff --git a/src/main/java/com/schematic/api/types/PlanCatalogMembershipResponseData.java b/src/main/java/com/schematic/api/types/PlanCatalogMembershipResponseData.java new file mode 100644 index 00000000..e1b05ab8 --- /dev/null +++ b/src/main/java/com/schematic/api/types/PlanCatalogMembershipResponseData.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.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.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PlanCatalogMembershipResponseData.Builder.class) +public final class PlanCatalogMembershipResponseData { + private final String id; + + private final String name; + + private final Map additionalProperties; + + private PlanCatalogMembershipResponseData(String id, String name, Map additionalProperties) { + this.id = id; + this.name = name; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PlanCatalogMembershipResponseData && equalTo((PlanCatalogMembershipResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PlanCatalogMembershipResponseData other) { + return id.equals(other.id) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + NameStage id(@NotNull String id); + + Builder from(PlanCatalogMembershipResponseData other); + } + + public interface NameStage { + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + PlanCatalogMembershipResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, NameStage, _FinalStage { + private String id; + + private String name; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PlanCatalogMembershipResponseData other) { + id(other.getId()); + name(other.getName()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + 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 PlanCatalogMembershipResponseData build() { + return new PlanCatalogMembershipResponseData(id, 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/types/PlanDetailResponseData.java b/src/main/java/com/schematic/api/types/PlanDetailResponseData.java index 1515c0a0..18e6ea34 100644 --- a/src/main/java/com/schematic/api/types/PlanDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanDetailResponseData.java @@ -34,6 +34,8 @@ public final class PlanDetailResponseData { private final BillingStrategy billingStrategy; + private final Optional> catalogs; + private final ChargeType chargeType; private final long companyCount; @@ -100,6 +102,7 @@ private PlanDetailResponseData( Optional billingLinkedResource, Optional billingProduct, BillingStrategy billingStrategy, + Optional> catalogs, ChargeType chargeType, long companyCount, Optional companyId, @@ -135,6 +138,7 @@ private PlanDetailResponseData( this.billingLinkedResource = billingLinkedResource; this.billingProduct = billingProduct; this.billingStrategy = billingStrategy; + this.catalogs = catalogs; this.chargeType = chargeType; this.companyCount = companyCount; this.companyId = companyId; @@ -192,6 +196,11 @@ public BillingStrategy getBillingStrategy() { return billingStrategy; } + @JsonProperty("catalogs") + public Optional> getCatalogs() { + return catalogs; + } + @JsonProperty("charge_type") public ChargeType getChargeType() { return chargeType; @@ -357,6 +366,7 @@ private boolean equalTo(PlanDetailResponseData other) { && billingLinkedResource.equals(other.billingLinkedResource) && billingProduct.equals(other.billingProduct) && billingStrategy.equals(other.billingStrategy) + && catalogs.equals(other.catalogs) && chargeType.equals(other.chargeType) && companyCount == other.companyCount && companyId.equals(other.companyId) @@ -396,6 +406,7 @@ public int hashCode() { this.billingLinkedResource, this.billingProduct, this.billingStrategy, + this.catalogs, this.chargeType, this.companyCount, this.companyId, @@ -520,6 +531,10 @@ public interface _FinalStage { _FinalStage billingProduct(BillingProductDetailResponseData billingProduct); + _FinalStage catalogs(Optional> catalogs); + + _FinalStage catalogs(List catalogs); + _FinalStage companyId(Optional companyId); _FinalStage companyId(String companyId); @@ -670,6 +685,8 @@ public static final class Builder private Optional companyId = Optional.empty(); + private Optional> catalogs = Optional.empty(); + private Optional billingProduct = Optional.empty(); private Optional billingLinkedResource = Optional.empty(); @@ -690,6 +707,7 @@ public Builder from(PlanDetailResponseData other) { billingLinkedResource(other.getBillingLinkedResource()); billingProduct(other.getBillingProduct()); billingStrategy(other.getBillingStrategy()); + catalogs(other.getCatalogs()); chargeType(other.getChargeType()); companyCount(other.getCompanyCount()); companyId(other.getCompanyId()); @@ -1077,6 +1095,19 @@ public _FinalStage companyId(Optional companyId) { return this; } + @java.lang.Override + public _FinalStage catalogs(List catalogs) { + this.catalogs = Optional.ofNullable(catalogs); + return this; + } + + @java.lang.Override + @JsonSetter(value = "catalogs", nulls = Nulls.SKIP) + public _FinalStage catalogs(Optional> catalogs) { + this.catalogs = catalogs; + return this; + } + @java.lang.Override public _FinalStage billingProduct(BillingProductDetailResponseData billingProduct) { this.billingProduct = Optional.ofNullable(billingProduct); @@ -1137,6 +1168,7 @@ public PlanDetailResponseData build() { billingLinkedResource, billingProduct, billingStrategy, + catalogs, chargeType, companyCount, companyId, diff --git a/src/main/java/com/schematic/api/types/PlanGroupPlanDetailResponseData.java b/src/main/java/com/schematic/api/types/PlanGroupPlanDetailResponseData.java index 5f57ff14..fb7ac916 100644 --- a/src/main/java/com/schematic/api/types/PlanGroupPlanDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanGroupPlanDetailResponseData.java @@ -36,6 +36,8 @@ public final class PlanGroupPlanDetailResponseData { private final BillingStrategy billingStrategy; + private final Optional> catalogs; + private final ChargeType chargeType; private final long companyCount; @@ -109,6 +111,7 @@ private PlanGroupPlanDetailResponseData( Optional billingLinkedResource, Optional billingProduct, BillingStrategy billingStrategy, + Optional> catalogs, ChargeType chargeType, long companyCount, Optional companyId, @@ -148,6 +151,7 @@ private PlanGroupPlanDetailResponseData( this.billingLinkedResource = billingLinkedResource; this.billingProduct = billingProduct; this.billingStrategy = billingStrategy; + this.catalogs = catalogs; this.chargeType = chargeType; this.companyCount = companyCount; this.companyId = companyId; @@ -213,6 +217,11 @@ public BillingStrategy getBillingStrategy() { return billingStrategy; } + @JsonProperty("catalogs") + public Optional> getCatalogs() { + return catalogs; + } + @JsonProperty("charge_type") public ChargeType getChargeType() { return chargeType; @@ -394,6 +403,7 @@ private boolean equalTo(PlanGroupPlanDetailResponseData other) { && billingLinkedResource.equals(other.billingLinkedResource) && billingProduct.equals(other.billingProduct) && billingStrategy.equals(other.billingStrategy) + && catalogs.equals(other.catalogs) && chargeType.equals(other.chargeType) && companyCount == other.companyCount && companyId.equals(other.companyId) @@ -437,6 +447,7 @@ public int hashCode() { this.billingLinkedResource, this.billingProduct, this.billingStrategy, + this.catalogs, this.chargeType, this.companyCount, this.companyId, @@ -574,6 +585,10 @@ public interface _FinalStage { _FinalStage billingProduct(BillingProductDetailResponseData billingProduct); + _FinalStage catalogs(Optional> catalogs); + + _FinalStage catalogs(List catalogs); + _FinalStage companyId(Optional companyId); _FinalStage companyId(String companyId); @@ -741,6 +756,8 @@ public static final class Builder private Optional companyId = Optional.empty(); + private Optional> catalogs = Optional.empty(); + private Optional billingProduct = Optional.empty(); private Optional billingLinkedResource = Optional.empty(); @@ -764,6 +781,7 @@ public Builder from(PlanGroupPlanDetailResponseData other) { billingLinkedResource(other.getBillingLinkedResource()); billingProduct(other.getBillingProduct()); billingStrategy(other.getBillingStrategy()); + catalogs(other.getCatalogs()); chargeType(other.getChargeType()); companyCount(other.getCompanyCount()); companyId(other.getCompanyId()); @@ -1198,6 +1216,19 @@ public _FinalStage companyId(Optional companyId) { return this; } + @java.lang.Override + public _FinalStage catalogs(List catalogs) { + this.catalogs = Optional.ofNullable(catalogs); + return this; + } + + @java.lang.Override + @JsonSetter(value = "catalogs", nulls = Nulls.SKIP) + public _FinalStage catalogs(Optional> catalogs) { + this.catalogs = catalogs; + return this; + } + @java.lang.Override public _FinalStage billingProduct(BillingProductDetailResponseData billingProduct) { this.billingProduct = Optional.ofNullable(billingProduct); @@ -1283,6 +1314,7 @@ public PlanGroupPlanDetailResponseData build() { billingLinkedResource, billingProduct, billingStrategy, + catalogs, chargeType, companyCount, companyId, diff --git a/src/main/java/com/schematic/api/types/PlanViewPublicResponseData.java b/src/main/java/com/schematic/api/types/PlanViewPublicResponseData.java index f004241f..57ed4a79 100644 --- a/src/main/java/com/schematic/api/types/PlanViewPublicResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanViewPublicResponseData.java @@ -36,6 +36,8 @@ public final class PlanViewPublicResponseData { private final BillingStrategy billingStrategy; + private final Optional> catalogs; + private final ChargeType chargeType; private final long companyCount; @@ -111,6 +113,7 @@ private PlanViewPublicResponseData( Optional billingLinkedResource, Optional billingProduct, BillingStrategy billingStrategy, + Optional> catalogs, ChargeType chargeType, long companyCount, Optional companyId, @@ -151,6 +154,7 @@ private PlanViewPublicResponseData( this.billingLinkedResource = billingLinkedResource; this.billingProduct = billingProduct; this.billingStrategy = billingStrategy; + this.catalogs = catalogs; this.chargeType = chargeType; this.companyCount = companyCount; this.companyId = companyId; @@ -217,6 +221,11 @@ public BillingStrategy getBillingStrategy() { return billingStrategy; } + @JsonProperty("catalogs") + public Optional> getCatalogs() { + return catalogs; + } + @JsonProperty("charge_type") public ChargeType getChargeType() { return chargeType; @@ -403,6 +412,7 @@ private boolean equalTo(PlanViewPublicResponseData other) { && billingLinkedResource.equals(other.billingLinkedResource) && billingProduct.equals(other.billingProduct) && billingStrategy.equals(other.billingStrategy) + && catalogs.equals(other.catalogs) && chargeType.equals(other.chargeType) && companyCount == other.companyCount && companyId.equals(other.companyId) @@ -447,6 +457,7 @@ public int hashCode() { this.billingLinkedResource, this.billingProduct, this.billingStrategy, + this.catalogs, this.chargeType, this.companyCount, this.companyId, @@ -589,6 +600,10 @@ public interface _FinalStage { _FinalStage billingProduct(BillingProductDetailResponseData billingProduct); + _FinalStage catalogs(Optional> catalogs); + + _FinalStage catalogs(List catalogs); + _FinalStage companyId(Optional companyId); _FinalStage companyId(String companyId); @@ -761,6 +776,8 @@ public static final class Builder private Optional companyId = Optional.empty(); + private Optional> catalogs = Optional.empty(); + private Optional billingProduct = Optional.empty(); private Optional billingLinkedResource = Optional.empty(); @@ -784,6 +801,7 @@ public Builder from(PlanViewPublicResponseData other) { billingLinkedResource(other.getBillingLinkedResource()); billingProduct(other.getBillingProduct()); billingStrategy(other.getBillingStrategy()); + catalogs(other.getCatalogs()); chargeType(other.getChargeType()); companyCount(other.getCompanyCount()); companyId(other.getCompanyId()); @@ -1236,6 +1254,19 @@ public _FinalStage companyId(Optional companyId) { return this; } + @java.lang.Override + public _FinalStage catalogs(List catalogs) { + this.catalogs = Optional.ofNullable(catalogs); + return this; + } + + @java.lang.Override + @JsonSetter(value = "catalogs", nulls = Nulls.SKIP) + public _FinalStage catalogs(Optional> catalogs) { + this.catalogs = catalogs; + return this; + } + @java.lang.Override public _FinalStage billingProduct(BillingProductDetailResponseData billingProduct) { this.billingProduct = Optional.ofNullable(billingProduct); @@ -1321,6 +1352,7 @@ public PlanViewPublicResponseData build() { billingLinkedResource, billingProduct, billingStrategy, + catalogs, chargeType, companyCount, companyId, diff --git a/src/main/java/com/schematic/api/types/PreviewSubscriptionDiscountResponseData.java b/src/main/java/com/schematic/api/types/PreviewSubscriptionDiscountResponseData.java new file mode 100644 index 00000000..befaa004 --- /dev/null +++ b/src/main/java/com/schematic/api/types/PreviewSubscriptionDiscountResponseData.java @@ -0,0 +1,430 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.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.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.time.OffsetDateTime; +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 = PreviewSubscriptionDiscountResponseData.Builder.class) +public final class PreviewSubscriptionDiscountResponseData { + private final Optional amountOff; + + private final String couponName; + + private final Optional currency; + + private final Optional customerFacingCode; + + private final String duration; + + private final Optional durationInMonths; + + private final Optional endedAt; + + private final boolean isActive; + + private final Optional percentOff; + + private final Optional promoCodeExternalId; + + private final OffsetDateTime startedAt; + + private final Map additionalProperties; + + private PreviewSubscriptionDiscountResponseData( + Optional amountOff, + String couponName, + Optional currency, + Optional customerFacingCode, + String duration, + Optional durationInMonths, + Optional endedAt, + boolean isActive, + Optional percentOff, + Optional promoCodeExternalId, + OffsetDateTime startedAt, + Map additionalProperties) { + this.amountOff = amountOff; + this.couponName = couponName; + this.currency = currency; + this.customerFacingCode = customerFacingCode; + this.duration = duration; + this.durationInMonths = durationInMonths; + this.endedAt = endedAt; + this.isActive = isActive; + this.percentOff = percentOff; + this.promoCodeExternalId = promoCodeExternalId; + this.startedAt = startedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("amount_off") + public Optional getAmountOff() { + return amountOff; + } + + @JsonProperty("coupon_name") + public String getCouponName() { + return couponName; + } + + @JsonProperty("currency") + public Optional getCurrency() { + return currency; + } + + @JsonProperty("customer_facing_code") + public Optional getCustomerFacingCode() { + return customerFacingCode; + } + + @JsonProperty("duration") + public String getDuration() { + return duration; + } + + @JsonProperty("duration_in_months") + public Optional getDurationInMonths() { + return durationInMonths; + } + + @JsonProperty("ended_at") + public Optional getEndedAt() { + return endedAt; + } + + @JsonProperty("is_active") + public boolean getIsActive() { + return isActive; + } + + @JsonProperty("percent_off") + public Optional getPercentOff() { + return percentOff; + } + + @JsonProperty("promo_code_external_id") + public Optional getPromoCodeExternalId() { + return promoCodeExternalId; + } + + @JsonProperty("started_at") + public OffsetDateTime getStartedAt() { + return startedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PreviewSubscriptionDiscountResponseData + && equalTo((PreviewSubscriptionDiscountResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PreviewSubscriptionDiscountResponseData other) { + return amountOff.equals(other.amountOff) + && couponName.equals(other.couponName) + && currency.equals(other.currency) + && customerFacingCode.equals(other.customerFacingCode) + && duration.equals(other.duration) + && durationInMonths.equals(other.durationInMonths) + && endedAt.equals(other.endedAt) + && isActive == other.isActive + && percentOff.equals(other.percentOff) + && promoCodeExternalId.equals(other.promoCodeExternalId) + && startedAt.equals(other.startedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amountOff, + this.couponName, + this.currency, + this.customerFacingCode, + this.duration, + this.durationInMonths, + this.endedAt, + this.isActive, + this.percentOff, + this.promoCodeExternalId, + this.startedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CouponNameStage builder() { + return new Builder(); + } + + public interface CouponNameStage { + DurationStage couponName(@NotNull String couponName); + + Builder from(PreviewSubscriptionDiscountResponseData other); + } + + public interface DurationStage { + IsActiveStage duration(@NotNull String duration); + } + + public interface IsActiveStage { + StartedAtStage isActive(boolean isActive); + } + + public interface StartedAtStage { + _FinalStage startedAt(@NotNull OffsetDateTime startedAt); + } + + public interface _FinalStage { + PreviewSubscriptionDiscountResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage amountOff(Optional amountOff); + + _FinalStage amountOff(Long amountOff); + + _FinalStage currency(Optional currency); + + _FinalStage currency(String currency); + + _FinalStage customerFacingCode(Optional customerFacingCode); + + _FinalStage customerFacingCode(String customerFacingCode); + + _FinalStage durationInMonths(Optional durationInMonths); + + _FinalStage durationInMonths(Long durationInMonths); + + _FinalStage endedAt(Optional endedAt); + + _FinalStage endedAt(OffsetDateTime endedAt); + + _FinalStage percentOff(Optional percentOff); + + _FinalStage percentOff(Double percentOff); + + _FinalStage promoCodeExternalId(Optional promoCodeExternalId); + + _FinalStage promoCodeExternalId(String promoCodeExternalId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CouponNameStage, DurationStage, IsActiveStage, StartedAtStage, _FinalStage { + private String couponName; + + private String duration; + + private boolean isActive; + + private OffsetDateTime startedAt; + + private Optional promoCodeExternalId = Optional.empty(); + + private Optional percentOff = Optional.empty(); + + private Optional endedAt = Optional.empty(); + + private Optional durationInMonths = Optional.empty(); + + private Optional customerFacingCode = Optional.empty(); + + private Optional currency = Optional.empty(); + + private Optional amountOff = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PreviewSubscriptionDiscountResponseData other) { + amountOff(other.getAmountOff()); + couponName(other.getCouponName()); + currency(other.getCurrency()); + customerFacingCode(other.getCustomerFacingCode()); + duration(other.getDuration()); + durationInMonths(other.getDurationInMonths()); + endedAt(other.getEndedAt()); + isActive(other.getIsActive()); + percentOff(other.getPercentOff()); + promoCodeExternalId(other.getPromoCodeExternalId()); + startedAt(other.getStartedAt()); + return this; + } + + @java.lang.Override + @JsonSetter("coupon_name") + public DurationStage couponName(@NotNull String couponName) { + this.couponName = Objects.requireNonNull(couponName, "couponName must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("duration") + public IsActiveStage duration(@NotNull String duration) { + this.duration = Objects.requireNonNull(duration, "duration must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("is_active") + public StartedAtStage isActive(boolean isActive) { + this.isActive = isActive; + return this; + } + + @java.lang.Override + @JsonSetter("started_at") + public _FinalStage startedAt(@NotNull OffsetDateTime startedAt) { + this.startedAt = Objects.requireNonNull(startedAt, "startedAt must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage promoCodeExternalId(String promoCodeExternalId) { + this.promoCodeExternalId = Optional.ofNullable(promoCodeExternalId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "promo_code_external_id", nulls = Nulls.SKIP) + public _FinalStage promoCodeExternalId(Optional promoCodeExternalId) { + this.promoCodeExternalId = promoCodeExternalId; + return this; + } + + @java.lang.Override + public _FinalStage percentOff(Double percentOff) { + this.percentOff = Optional.ofNullable(percentOff); + return this; + } + + @java.lang.Override + @JsonSetter(value = "percent_off", nulls = Nulls.SKIP) + public _FinalStage percentOff(Optional percentOff) { + this.percentOff = percentOff; + return this; + } + + @java.lang.Override + public _FinalStage endedAt(OffsetDateTime endedAt) { + this.endedAt = Optional.ofNullable(endedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "ended_at", nulls = Nulls.SKIP) + public _FinalStage endedAt(Optional endedAt) { + this.endedAt = endedAt; + return this; + } + + @java.lang.Override + public _FinalStage durationInMonths(Long durationInMonths) { + this.durationInMonths = Optional.ofNullable(durationInMonths); + return this; + } + + @java.lang.Override + @JsonSetter(value = "duration_in_months", nulls = Nulls.SKIP) + public _FinalStage durationInMonths(Optional durationInMonths) { + this.durationInMonths = durationInMonths; + return this; + } + + @java.lang.Override + public _FinalStage customerFacingCode(String customerFacingCode) { + this.customerFacingCode = Optional.ofNullable(customerFacingCode); + return this; + } + + @java.lang.Override + @JsonSetter(value = "customer_facing_code", nulls = Nulls.SKIP) + public _FinalStage customerFacingCode(Optional customerFacingCode) { + this.customerFacingCode = customerFacingCode; + return this; + } + + @java.lang.Override + public _FinalStage currency(String currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + @java.lang.Override + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public _FinalStage currency(Optional currency) { + this.currency = currency; + return this; + } + + @java.lang.Override + public _FinalStage amountOff(Long amountOff) { + this.amountOff = Optional.ofNullable(amountOff); + return this; + } + + @java.lang.Override + @JsonSetter(value = "amount_off", nulls = Nulls.SKIP) + public _FinalStage amountOff(Optional amountOff) { + this.amountOff = amountOff; + return this; + } + + @java.lang.Override + public PreviewSubscriptionDiscountResponseData build() { + return new PreviewSubscriptionDiscountResponseData( + amountOff, + couponName, + currency, + customerFacingCode, + duration, + durationInMonths, + endedAt, + isActive, + percentOff, + promoCodeExternalId, + startedAt, + 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/types/PreviewSubscriptionFinanceResponseData.java b/src/main/java/com/schematic/api/types/PreviewSubscriptionFinanceResponseData.java index 8c005ebe..16f8393a 100644 --- a/src/main/java/com/schematic/api/types/PreviewSubscriptionFinanceResponseData.java +++ b/src/main/java/com/schematic/api/types/PreviewSubscriptionFinanceResponseData.java @@ -26,12 +26,16 @@ public final class PreviewSubscriptionFinanceResponseData { private final long amountOff; + private final List discounts; + private final long dueNow; private final long newCharges; private final double percentOff; + private final OffsetDateTime periodEnd; + private final OffsetDateTime periodStart; private final boolean promoCodeApplied; @@ -54,9 +58,11 @@ public final class PreviewSubscriptionFinanceResponseData { private PreviewSubscriptionFinanceResponseData( long amountOff, + List discounts, long dueNow, long newCharges, double percentOff, + OffsetDateTime periodEnd, OffsetDateTime periodStart, boolean promoCodeApplied, long proration, @@ -68,9 +74,11 @@ private PreviewSubscriptionFinanceResponseData( List upcomingInvoiceLineItems, Map additionalProperties) { this.amountOff = amountOff; + this.discounts = discounts; this.dueNow = dueNow; this.newCharges = newCharges; this.percentOff = percentOff; + this.periodEnd = periodEnd; this.periodStart = periodStart; this.promoCodeApplied = promoCodeApplied; this.proration = proration; @@ -88,6 +96,11 @@ public long getAmountOff() { return amountOff; } + @JsonProperty("discounts") + public List getDiscounts() { + return discounts; + } + @JsonProperty("due_now") public long getDueNow() { return dueNow; @@ -103,6 +116,11 @@ public double getPercentOff() { return percentOff; } + @JsonProperty("period_end") + public OffsetDateTime getPeriodEnd() { + return periodEnd; + } + @JsonProperty("period_start") public OffsetDateTime getPeriodStart() { return periodStart; @@ -162,9 +180,11 @@ public Map getAdditionalProperties() { private boolean equalTo(PreviewSubscriptionFinanceResponseData other) { return amountOff == other.amountOff + && discounts.equals(other.discounts) && dueNow == other.dueNow && newCharges == other.newCharges && percentOff == other.percentOff + && periodEnd.equals(other.periodEnd) && periodStart.equals(other.periodStart) && promoCodeApplied == other.promoCodeApplied && proration == other.proration @@ -180,9 +200,11 @@ private boolean equalTo(PreviewSubscriptionFinanceResponseData other) { public int hashCode() { return Objects.hash( this.amountOff, + this.discounts, this.dueNow, this.newCharges, this.percentOff, + this.periodEnd, this.periodStart, this.promoCodeApplied, this.proration, @@ -218,7 +240,11 @@ public interface NewChargesStage { } public interface PercentOffStage { - PeriodStartStage percentOff(double percentOff); + PeriodEndStage percentOff(double percentOff); + } + + public interface PeriodEndStage { + PeriodStartStage periodEnd(@NotNull OffsetDateTime periodEnd); } public interface PeriodStartStage { @@ -248,6 +274,12 @@ public interface _FinalStage { _FinalStage additionalProperties(Map additionalProperties); + _FinalStage discounts(List discounts); + + _FinalStage addDiscounts(PreviewSubscriptionDiscountResponseData discounts); + + _FinalStage addAllDiscounts(List discounts); + _FinalStage taxAmount(Optional taxAmount); _FinalStage taxAmount(Long taxAmount); @@ -275,6 +307,7 @@ public static final class Builder DueNowStage, NewChargesStage, PercentOffStage, + PeriodEndStage, PeriodStartStage, PromoCodeAppliedStage, ProrationStage, @@ -289,6 +322,8 @@ public static final class Builder private double percentOff; + private OffsetDateTime periodEnd; + private OffsetDateTime periodStart; private boolean promoCodeApplied; @@ -307,6 +342,8 @@ public static final class Builder private Optional taxAmount = Optional.empty(); + private List discounts = new ArrayList<>(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -315,9 +352,11 @@ private Builder() {} @java.lang.Override public Builder from(PreviewSubscriptionFinanceResponseData other) { amountOff(other.getAmountOff()); + discounts(other.getDiscounts()); dueNow(other.getDueNow()); newCharges(other.getNewCharges()); percentOff(other.getPercentOff()); + periodEnd(other.getPeriodEnd()); periodStart(other.getPeriodStart()); promoCodeApplied(other.getPromoCodeApplied()); proration(other.getProration()); @@ -353,11 +392,18 @@ public PercentOffStage newCharges(long newCharges) { @java.lang.Override @JsonSetter("percent_off") - public PeriodStartStage percentOff(double percentOff) { + public PeriodEndStage percentOff(double percentOff) { this.percentOff = percentOff; return this; } + @java.lang.Override + @JsonSetter("period_end") + public PeriodStartStage periodEnd(@NotNull OffsetDateTime periodEnd) { + this.periodEnd = Objects.requireNonNull(periodEnd, "periodEnd must not be null"); + return this; + } + @java.lang.Override @JsonSetter("period_start") public PromoCodeAppliedStage periodStart(@NotNull OffsetDateTime periodStart) { @@ -459,13 +505,39 @@ public _FinalStage taxAmount(Optional taxAmount) { return this; } + @java.lang.Override + public _FinalStage addAllDiscounts(List discounts) { + if (discounts != null) { + this.discounts.addAll(discounts); + } + return this; + } + + @java.lang.Override + public _FinalStage addDiscounts(PreviewSubscriptionDiscountResponseData discounts) { + this.discounts.add(discounts); + return this; + } + + @java.lang.Override + @JsonSetter(value = "discounts", nulls = Nulls.SKIP) + public _FinalStage discounts(List discounts) { + this.discounts.clear(); + if (discounts != null) { + this.discounts.addAll(discounts); + } + return this; + } + @java.lang.Override public PreviewSubscriptionFinanceResponseData build() { return new PreviewSubscriptionFinanceResponseData( amountOff, + discounts, dueNow, newCharges, percentOff, + periodEnd, periodStart, promoCodeApplied, proration, diff --git a/src/main/java/com/schematic/api/types/RulesengineFeatureEntitlement.java b/src/main/java/com/schematic/api/types/RulesengineFeatureEntitlement.java index 5a544bef..6358d5e7 100644 --- a/src/main/java/com/schematic/api/types/RulesengineFeatureEntitlement.java +++ b/src/main/java/com/schematic/api/types/RulesengineFeatureEntitlement.java @@ -14,6 +14,7 @@ import com.schematic.api.core.ObjectMappers; import java.time.OffsetDateTime; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -58,6 +59,8 @@ public final class RulesengineFeatureEntitlement { private final RulesengineEntitlementValueType valueType; + private final Optional> warningTiers; + private final Map additionalProperties; private RulesengineFeatureEntitlement( @@ -79,6 +82,7 @@ private RulesengineFeatureEntitlement( Optional softLimit, Optional usage, RulesengineEntitlementValueType valueType, + Optional> warningTiers, Map additionalProperties) { this.allocation = allocation; this.consumptionRate = consumptionRate; @@ -98,6 +102,7 @@ private RulesengineFeatureEntitlement( this.softLimit = softLimit; this.usage = usage; this.valueType = valueType; + this.warningTiers = warningTiers; this.additionalProperties = additionalProperties; } @@ -245,6 +250,14 @@ public RulesengineEntitlementValueType getValueType() { return valueType; } + /** + * @return Customer-defined usage warning thresholds configured on this entitlement + */ + @JsonProperty("warning_tiers") + public Optional> getWarningTiers() { + return warningTiers; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -274,7 +287,8 @@ private boolean equalTo(RulesengineFeatureEntitlement other) { && monthReset.equals(other.monthReset) && softLimit.equals(other.softLimit) && usage.equals(other.usage) - && valueType.equals(other.valueType); + && valueType.equals(other.valueType) + && warningTiers.equals(other.warningTiers); } @java.lang.Override @@ -297,7 +311,8 @@ public int hashCode() { this.monthReset, this.softLimit, this.usage, - this.valueType); + this.valueType, + this.warningTiers); } @java.lang.Override @@ -443,6 +458,13 @@ public interface _FinalStage { _FinalStage usage(Optional usage); _FinalStage usage(Long usage); + + /** + *

Customer-defined usage warning thresholds configured on this entitlement

+ */ + _FinalStage warningTiers(Optional> warningTiers); + + _FinalStage warningTiers(List warningTiers); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -453,6 +475,8 @@ public static final class Builder implements FeatureIdStage, FeatureKeyStage, Va private RulesengineEntitlementValueType valueType; + private Optional> warningTiers = Optional.empty(); + private Optional usage = Optional.empty(); private Optional softLimit = Optional.empty(); @@ -508,6 +532,7 @@ public Builder from(RulesengineFeatureEntitlement other) { softLimit(other.getSoftLimit()); usage(other.getUsage()); valueType(other.getValueType()); + warningTiers(other.getWarningTiers()); return this; } @@ -544,6 +569,26 @@ public _FinalStage valueType(@NotNull RulesengineEntitlementValueType valueType) return this; } + /** + *

Customer-defined usage warning thresholds configured on this entitlement

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage warningTiers(List warningTiers) { + this.warningTiers = Optional.ofNullable(warningTiers); + return this; + } + + /** + *

Customer-defined usage warning thresholds configured on this entitlement

+ */ + @java.lang.Override + @JsonSetter(value = "warning_tiers", nulls = Nulls.SKIP) + public _FinalStage warningTiers(Optional> warningTiers) { + this.warningTiers = warningTiers; + return this; + } + /** *

If the company has a numeric entitlement for this feature, the current usage amount

* @return Reference to {@code this} so that method calls can be chained together. @@ -865,6 +910,7 @@ public RulesengineFeatureEntitlement build() { softLimit, usage, valueType, + warningTiers, additionalProperties); } diff --git a/src/main/java/com/schematic/api/types/RulesengineWarningTier.java b/src/main/java/com/schematic/api/types/RulesengineWarningTier.java new file mode 100644 index 00000000..a2039a7e --- /dev/null +++ b/src/main/java/com/schematic/api/types/RulesengineWarningTier.java @@ -0,0 +1,160 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.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.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RulesengineWarningTier.Builder.class) +public final class RulesengineWarningTier { + private final String key; + + private final long value; + + private final Map additionalProperties; + + private RulesengineWarningTier(String key, long value, Map additionalProperties) { + this.key = key; + this.value = value; + this.additionalProperties = additionalProperties; + } + + /** + * @return A customer-defined identifier for the warning tier + */ + @JsonProperty("key") + public String getKey() { + return key; + } + + /** + * @return The warning threshold, in the entitlement's usage units + */ + @JsonProperty("value") + public long getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RulesengineWarningTier && equalTo((RulesengineWarningTier) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RulesengineWarningTier other) { + return key.equals(other.key) && value == other.value; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.key, this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static KeyStage builder() { + return new Builder(); + } + + public interface KeyStage { + /** + *

A customer-defined identifier for the warning tier

+ */ + ValueStage key(@NotNull String key); + + Builder from(RulesengineWarningTier other); + } + + public interface ValueStage { + /** + *

The warning threshold, in the entitlement's usage units

+ */ + _FinalStage value(long value); + } + + public interface _FinalStage { + RulesengineWarningTier build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements KeyStage, ValueStage, _FinalStage { + private String key; + + private long value; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RulesengineWarningTier other) { + key(other.getKey()); + value(other.getValue()); + return this; + } + + /** + *

A customer-defined identifier for the warning tier

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("key") + public ValueStage key(@NotNull String key) { + this.key = Objects.requireNonNull(key, "key must not be null"); + return this; + } + + /** + *

The warning threshold, in the entitlement's usage units

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("value") + public _FinalStage value(long value) { + this.value = value; + return this; + } + + @java.lang.Override + public RulesengineWarningTier build() { + return new RulesengineWarningTier(key, value, 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/types/UpsertCompanyRequestBody.java b/src/main/java/com/schematic/api/types/UpsertCompanyRequestBody.java index dfbeb19f..0df19885 100644 --- a/src/main/java/com/schematic/api/types/UpsertCompanyRequestBody.java +++ b/src/main/java/com/schematic/api/types/UpsertCompanyRequestBody.java @@ -23,6 +23,10 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = UpsertCompanyRequestBody.Builder.class) public final class UpsertCompanyRequestBody { + private final Optional basePlanId; + + private final Optional basePlanPriceId; + private final Optional id; private final Map keys; @@ -40,6 +44,8 @@ public final class UpsertCompanyRequestBody { private final Map additionalProperties; private UpsertCompanyRequestBody( + Optional basePlanId, + Optional basePlanPriceId, Optional id, Map keys, Optional lastSeenAt, @@ -48,6 +54,8 @@ private UpsertCompanyRequestBody( Optional> traits, Optional updateOnly, Map additionalProperties) { + this.basePlanId = basePlanId; + this.basePlanPriceId = basePlanPriceId; this.id = id; this.keys = keys; this.lastSeenAt = lastSeenAt; @@ -58,6 +66,22 @@ private UpsertCompanyRequestBody( this.additionalProperties = additionalProperties; } + /** + * @return Assign this base plan when creating the company (starts with plan_). Takes precedence over the environment's initial plan and must be provisionable without a payment method. + */ + @JsonProperty("base_plan_id") + public Optional getBasePlanId() { + return basePlanId; + } + + /** + * @return The Schematic price to provision for base_plan_id (starts with bilpp_). Required and must be $0 for a billing-linked plan; omit for a plan that is not billing-linked. + */ + @JsonProperty("base_plan_price_id") + public Optional getBasePlanPriceId() { + return basePlanPriceId; + } + /** * @return If you know the Schematic ID, you can use that here instead of keys */ @@ -114,7 +138,9 @@ public Map getAdditionalProperties() { } private boolean equalTo(UpsertCompanyRequestBody other) { - return id.equals(other.id) + return basePlanId.equals(other.basePlanId) + && basePlanPriceId.equals(other.basePlanPriceId) + && id.equals(other.id) && keys.equals(other.keys) && lastSeenAt.equals(other.lastSeenAt) && name.equals(other.name) @@ -126,7 +152,15 @@ private boolean equalTo(UpsertCompanyRequestBody other) { @java.lang.Override public int hashCode() { return Objects.hash( - this.id, this.keys, this.lastSeenAt, this.name, this.preventKeyRemap, this.traits, this.updateOnly); + this.basePlanId, + this.basePlanPriceId, + this.id, + this.keys, + this.lastSeenAt, + this.name, + this.preventKeyRemap, + this.traits, + this.updateOnly); } @java.lang.Override @@ -140,6 +174,10 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { + private Optional basePlanId = Optional.empty(); + + private Optional basePlanPriceId = Optional.empty(); + private Optional id = Optional.empty(); private Map keys = new LinkedHashMap<>(); @@ -160,6 +198,8 @@ public static final class Builder { private Builder() {} public Builder from(UpsertCompanyRequestBody other) { + basePlanId(other.getBasePlanId()); + basePlanPriceId(other.getBasePlanPriceId()); id(other.getId()); keys(other.getKeys()); lastSeenAt(other.getLastSeenAt()); @@ -170,6 +210,34 @@ public Builder from(UpsertCompanyRequestBody other) { return this; } + /** + *

Assign this base plan when creating the company (starts with plan_). Takes precedence over the environment's initial plan and must be provisionable without a payment method.

+ */ + @JsonSetter(value = "base_plan_id", nulls = Nulls.SKIP) + public Builder basePlanId(Optional basePlanId) { + this.basePlanId = basePlanId; + return this; + } + + public Builder basePlanId(String basePlanId) { + this.basePlanId = Optional.ofNullable(basePlanId); + return this; + } + + /** + *

The Schematic price to provision for base_plan_id (starts with bilpp_). Required and must be $0 for a billing-linked plan; omit for a plan that is not billing-linked.

+ */ + @JsonSetter(value = "base_plan_price_id", nulls = Nulls.SKIP) + public Builder basePlanPriceId(Optional basePlanPriceId) { + this.basePlanPriceId = basePlanPriceId; + return this; + } + + public Builder basePlanPriceId(String basePlanPriceId) { + this.basePlanPriceId = Optional.ofNullable(basePlanPriceId); + return this; + } + /** *

If you know the Schematic ID, you can use that here instead of keys

*/ @@ -268,7 +336,16 @@ public Builder updateOnly(Boolean updateOnly) { public UpsertCompanyRequestBody build() { return new UpsertCompanyRequestBody( - id, keys, lastSeenAt, name, preventKeyRemap, traits, updateOnly, additionalProperties); + basePlanId, + basePlanPriceId, + id, + keys, + lastSeenAt, + name, + preventKeyRemap, + traits, + updateOnly, + additionalProperties); } public Builder additionalProperty(String key, Object value) { diff --git a/src/main/java/com/schematic/api/types/WarningTier.java b/src/main/java/com/schematic/api/types/WarningTier.java new file mode 100644 index 00000000..76ff3d73 --- /dev/null +++ b/src/main/java/com/schematic/api/types/WarningTier.java @@ -0,0 +1,160 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.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.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = WarningTier.Builder.class) +public final class WarningTier { + private final String key; + + private final long value; + + private final Map additionalProperties; + + private WarningTier(String key, long value, Map additionalProperties) { + this.key = key; + this.value = value; + this.additionalProperties = additionalProperties; + } + + /** + * @return A customer-defined identifier for the warning tier + */ + @JsonProperty("key") + public String getKey() { + return key; + } + + /** + * @return The warning threshold, in the entitlement's usage units + */ + @JsonProperty("value") + public long getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof WarningTier && equalTo((WarningTier) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(WarningTier other) { + return key.equals(other.key) && value == other.value; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.key, this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static KeyStage builder() { + return new Builder(); + } + + public interface KeyStage { + /** + *

A customer-defined identifier for the warning tier

+ */ + ValueStage key(@NotNull String key); + + Builder from(WarningTier other); + } + + public interface ValueStage { + /** + *

The warning threshold, in the entitlement's usage units

+ */ + _FinalStage value(long value); + } + + public interface _FinalStage { + WarningTier build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements KeyStage, ValueStage, _FinalStage { + private String key; + + private long value; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(WarningTier other) { + key(other.getKey()); + value(other.getValue()); + return this; + } + + /** + *

A customer-defined identifier for the warning tier

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("key") + public ValueStage key(@NotNull String key) { + this.key = Objects.requireNonNull(key, "key must not be null"); + return this; + } + + /** + *

The warning threshold, in the entitlement's usage units

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("value") + public _FinalStage value(long value) { + this.value = value; + return this; + } + + @java.lang.Override + public WarningTier build() { + return new WarningTier(key, value, 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/types/WebhookRequestType.java b/src/main/java/com/schematic/api/types/WebhookRequestType.java index f66067ec..9213f3dd 100644 --- a/src/main/java/com/schematic/api/types/WebhookRequestType.java +++ b/src/main/java/com/schematic/api/types/WebhookRequestType.java @@ -101,6 +101,9 @@ public final class WebhookRequestType { public static final WebhookRequestType COMPANY_CREATED = new WebhookRequestType(Value.COMPANY_CREATED, "company.created"); + public static final WebhookRequestType AUTO_TOPUP_SUCCESS = + new WebhookRequestType(Value.AUTO_TOPUP_SUCCESS, "auto.topup.success"); + public static final WebhookRequestType ENTITLEMENT_TIER_LIMIT_WARNING = new WebhookRequestType(Value.ENTITLEMENT_TIER_LIMIT_WARNING, "entitlement.tier_limit.warning"); @@ -108,6 +111,9 @@ public final class WebhookRequestType { public static final WebhookRequestType PLAN_CREATED = new WebhookRequestType(Value.PLAN_CREATED, "plan.created"); + public static final WebhookRequestType CREDIT_PURCHASE_SUCCESS = + new WebhookRequestType(Value.CREDIT_PURCHASE_SUCCESS, "credit.purchase.success"); + public static final WebhookRequestType TEST_SEND = new WebhookRequestType(Value.TEST_SEND, "test.send"); public static final WebhookRequestType FEATURE_UPDATED = @@ -213,12 +219,16 @@ public T visit(Visitor visitor) { return visitor.visitCompanyUpdated(); case COMPANY_CREATED: return visitor.visitCompanyCreated(); + case AUTO_TOPUP_SUCCESS: + return visitor.visitAutoTopupSuccess(); case ENTITLEMENT_TIER_LIMIT_WARNING: return visitor.visitEntitlementTierLimitWarning(); case FLAG_DELETED: return visitor.visitFlagDeleted(); case PLAN_CREATED: return visitor.visitPlanCreated(); + case CREDIT_PURCHASE_SUCCESS: + return visitor.visitCreditPurchaseSuccess(); case TEST_SEND: return visitor.visitTestSend(); case FEATURE_UPDATED: @@ -300,12 +310,16 @@ public static WebhookRequestType valueOf(String value) { return COMPANY_UPDATED; case "company.created": return COMPANY_CREATED; + case "auto.topup.success": + return AUTO_TOPUP_SUCCESS; case "entitlement.tier_limit.warning": return ENTITLEMENT_TIER_LIMIT_WARNING; case "flag.deleted": return FLAG_DELETED; case "plan.created": return PLAN_CREATED; + case "credit.purchase.success": + return CREDIT_PURCHASE_SUCCESS; case "test.send": return TEST_SEND; case "feature.updated": @@ -340,6 +354,8 @@ public enum Value { CREDIT_LIMIT_WARNING, + CREDIT_PURCHASE_SUCCESS, + ENTITLEMENT_LIMIT_REACHED, ENTITLEMENT_LIMIT_WARNING, @@ -394,6 +410,8 @@ public enum Value { AUTO_TOPUP_RETRY_EXCEEDED, + AUTO_TOPUP_SUCCESS, + UNKNOWN } @@ -422,6 +440,8 @@ public interface Visitor { T visitCreditLimitWarning(); + T visitCreditPurchaseSuccess(); + T visitEntitlementLimitReached(); T visitEntitlementLimitWarning(); @@ -476,6 +496,8 @@ public interface Visitor { T visitAutoTopupRetryExceeded(); + T visitAutoTopupSuccess(); + T visitUnknown(String unknownType); } }